Overview
Max Total Supply
0.00000461852778244 Ponzio
Holders
1,620 ( 0.247%)
Market
Price
$82,364,118,675.24 @ 22,790,266.331825 ETH (+47.09%)
Onchain Market Cap
$380,400.97
Circulating Supply Market Cap
$0.00
Other Info
Token Contract (WITH 18 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
PonzioTheCat
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 999999 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.25; import { ERC20Rebasable } from "src/ERC20Rebasable.sol"; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IStake } from "src/interfaces/IStake.sol"; import { IPonzioTheCat } from "src/interfaces/IPonzioTheCat.sol"; import { IERC20Rebasable } from "src/interfaces/IERC20Rebasable.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IUniswapV2Pair } from "src/interfaces/UniswapV2/IUniswapV2Pair.sol"; import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; /** * @title PonzioTheCat * @notice Implementation of the PONZIO token. * @dev PONZIO is a rebasable token, which means that the total supply can be updated. Its particularity is that * every 4 days the supply is divided by 2, and in between the supply is constantly decreasing linearly. The balances * stays fixed for 34 minutes. Then every 34 minutes, the supply is updated, and the balances are updated * proportionally. * At each rebase, 13.37% of the debased supply is sent to the feesCollector. */ contract PonzioTheCat is IPonzioTheCat, ERC20Rebasable, Ownable { using Math for uint256; using SafeCast for uint256; using SafeERC20 for IERC20; /// @notice The name of the token string internal constant NAME = "Ponzio The Cat"; /// @notice The symbol of the token string internal constant SYMBOL = "Ponzio"; /// @notice The number of decimals of the token uint8 internal constant DECIMALS = 18; /// @inheritdoc IPonzioTheCat uint256 public constant INITIAL_SUPPLY = 21_000_000 * 10 ** DECIMALS; // in wei /// @inheritdoc IPonzioTheCat uint256 public constant HALVING_EVERY = 4 days + 144 seconds; // needs a factor of 168 between DEBASE_EVERY and // HALVING_EVERY /// @inheritdoc IPonzioTheCat uint256 public constant DEBASE_EVERY = 34 minutes + 18 seconds; /// @inheritdoc IPonzioTheCat uint256 public constant NB_DEBASE_PER_HALVING = HALVING_EVERY / DEBASE_EVERY; /// @inheritdoc IPonzioTheCat uint256 public constant MINIMUM_TOTAL_SUPPLY = 10 ** 12; // in wei /// @inheritdoc IPonzioTheCat uint256 public immutable DEPLOYED_TIME; /// @inheritdoc IPonzioTheCat uint256 public constant FEES_STAKING = 1337; // in BPS = 13.37% /// @inheritdoc IPonzioTheCat uint256 public constant FEES_BASE = 10_000; // in BPS /// @notice the address of the fees collector address internal _feesCollector; /// @notice boolean used to check if fees are collected bool internal _maxSharesReached = false; /// @notice the Uniswap V2 pair address IUniswapV2Pair internal _uniswapV2Pair; /// @notice true if the contract has been initialized bool private _initialized = false; /// @notice the total supply at the last update uint216 private _previousTotalSupply; /// @notice the timestamp of the last update uint40 private _previousUpdateTimestamp; constructor() ERC20Rebasable(NAME, SYMBOL, INITIAL_SUPPLY) Ownable(msg.sender) { DEPLOYED_TIME = block.timestamp; _previousTotalSupply = uint216(INITIAL_SUPPLY); _previousUpdateTimestamp = uint40(block.timestamp); } /* -------------------------------------------------------------------------- */ /* external functions */ /* -------------------------------------------------------------------------- */ /// @inheritdoc IPonzioTheCat function feesCollector() external view returns (address) { return _feesCollector; } /// @inheritdoc IPonzioTheCat function maxSharesReached() external view returns (bool) { return _maxSharesReached; } /// @inheritdoc IPonzioTheCat function uniswapV2Pair() external view returns (IUniswapV2Pair) { return _uniswapV2Pair; } /// @inheritdoc IPonzioTheCat function setUniswapV2Pair(address uniV2PoolAddr) external onlyOwner { _uniswapV2Pair = IUniswapV2Pair(uniV2PoolAddr); emit UniV2PoolPairSet(uniV2PoolAddr); } /// @inheritdoc IPonzioTheCat function setFeesCollector(address feeCollector) external onlyOwner { if (!_initialized) { revert PONZIO_notInitialized(); } else if (feeCollector == address(0)) { revert PONZIO_feeCollectorZeroAddress(); } updateTotalSupply(); _feesCollector = feeCollector; emit FeesCollectorSet(feeCollector); } /// @inheritdoc IPonzioTheCat function setBlacklistForUpdateSupply(address addrToBlacklist, bool value) external onlyOwner { _blacklistForUpdateSupply[addrToBlacklist] = value; emit BlacklistForUpdateSupplySet(addrToBlacklist, value); } /// @inheritdoc IPonzioTheCat function initialize(address feeCollector, address uniV2PoolAddr) external onlyOwner { if (_initialized) { revert PONZIO_alreadyInitialized(); } if (feeCollector == address(0)) { revert PONZIO_feeCollectorZeroAddress(); } _initialized = true; _uniswapV2Pair = IUniswapV2Pair(uniV2PoolAddr); emit UniV2PoolPairSet(uniV2PoolAddr); _blacklistForUpdateSupply[uniV2PoolAddr] = true; emit BlacklistForUpdateSupplySet(uniV2PoolAddr, true); _feesCollector = feeCollector; emit FeesCollectorSet(feeCollector); } /// @inheritdoc IPonzioTheCat function realBalanceOf(address account) external view returns (uint256 balance_) { (uint256 newTotalShares, uint256 newTotalSupply,) = computeNewState(); balance_ = sharesToToken(_sharesOf[account], newTotalShares, newTotalSupply); } /* -------------------------------------------------------------------------- */ /* public functions */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC20Rebasable function updateTotalSupply() public override(ERC20Rebasable, IERC20Rebasable) { if (_previousUpdateTimestamp == uint40(block.timestamp)) { return; } (uint256 newTotalSupply, uint256 fees) = computeSupply(); address feeCollector = _feesCollector; // fees are proportional to (_previousTotalSupply - newTotalSupply), // so if fees == 0 then we can be sure that _previousTotalSupply == newTotalSupply // we then only need to update the total supply if fees != 0 if (fees != 0 && feeCollector != address(0)) { // If max shares are reached, the new total supply is the // minimum total supply so this assignment is still valid. uint256 oldTotalSupply = _previousTotalSupply; _previousTotalSupply = newTotalSupply.toUint216(); _previousUpdateTimestamp = uint40(block.timestamp); // We need to mint tokenAmount of tokens, but by minting this amount, we will influence the totalShares. // For this reason, sharesToToken() cannot be used. In the end, the following 2 equations have to be // resolved: // // new_totalShares = old_totalShares + shareToMint // tokenAmount = totalSupply * shareToMint / new_totalShares // // tokenAmount, totalSupply and old_totalShares are known. // The only unknown is shareToMint // // After resolution we have: shareToMint = totalShares * tokenAmount / (totalSupply - tokenAmount) uint256 oldTotalShares = _totalShares; if (fees >= newTotalSupply) { _mintShares(feeCollector, oldTotalShares); } else { _mintShares(feeCollector, oldTotalShares.mulDiv(fees, newTotalSupply - fees)); } emit TotalSupplyUpdated(oldTotalSupply, newTotalSupply, oldTotalShares, _totalShares, fees); /// @dev This check prevents revert in case the feesCollector is an EOA if (address(feeCollector).code.length != 0) { /// @dev This try/catch prevents revert in case of feesCollector does not implement sync() try IStake(feeCollector).sync() { } catch { } } _uniswapV2Pair.sync(); } } /// @inheritdoc IPonzioTheCat function computeSupply() public view returns (uint256 totalSupply_, uint256 fees_) { uint256 previousTotalSupply = _previousTotalSupply; // early return if max shares are reached if (_maxSharesReached) { return (previousTotalSupply, 0); } uint256 previousUpdateTimestamp = _previousUpdateTimestamp; if (previousTotalSupply != MINIMUM_TOTAL_SUPPLY) { uint256 _timeSinceDeploy = block.timestamp - DEPLOYED_TIME; uint256 _tsLastHalving = INITIAL_SUPPLY / (2 ** (_timeSinceDeploy / HALVING_EVERY)); // slither-disable-next-line weak-prng totalSupply_ = _tsLastHalving - (_tsLastHalving * ((_timeSinceDeploy % HALVING_EVERY) / DEBASE_EVERY)) / NB_DEBASE_PER_HALVING / 2; if (totalSupply_ < MINIMUM_TOTAL_SUPPLY) { totalSupply_ = MINIMUM_TOTAL_SUPPLY; } fees_ = ((previousTotalSupply - totalSupply_) * FEES_STAKING) / FEES_BASE; } else { totalSupply_ = MINIMUM_TOTAL_SUPPLY; if (block.timestamp - previousUpdateTimestamp < HALVING_EVERY) { fees_ = (MINIMUM_TOTAL_SUPPLY * FEES_STAKING * (block.timestamp - previousUpdateTimestamp)) / HALVING_EVERY / FEES_BASE; } else { fees_ = (MINIMUM_TOTAL_SUPPLY * FEES_STAKING) / FEES_BASE; } } } /// @inheritdoc IPonzioTheCat function computeNewState() public view returns (uint256 totalShares_, uint256 totalSupply_, uint256 fees_) { uint256 totalShares = _totalShares; (totalSupply_, fees_) = computeSupply(); uint256 newShares; if (fees_ >= totalSupply_) { // if fees are greater than the total supply, we mint totalShares of shares, so we double the supply of the // shares, the fees will be equal to half of the total supply newShares = totalShares; fees_ = totalSupply_ / 2; } else { newShares = totalShares.mulDiv(fees_, totalSupply_ - fees_); } bool success; (success, totalShares_) = totalShares.tryAdd(newShares); if (!success) { totalShares_ = type(uint256).max; fees_ = sharesToToken((type(uint256).max - totalShares), totalShares_, totalSupply_); } } /// @inheritdoc IERC20 function balanceOf(address account) public view override(ERC20Rebasable, IERC20) returns (uint256) { return _sharesOf[account].mulDiv(_previousTotalSupply, _totalShares); } /// @inheritdoc IERC20Permit function nonces(address owner) public view override(ERC20Rebasable, IERC20Permit) returns (uint256) { return super.nonces(owner); } /// @inheritdoc IERC20 function totalSupply() public view override(ERC20, IERC20) returns (uint256) { return _previousTotalSupply; } /* -------------------------------------------------------------------------- */ /* internal functions */ /* -------------------------------------------------------------------------- */ /** * @notice Mint shares to an account. * @param account The account to mint the shares to. * @param shares The number of shares to mint. */ function _mintShares(address account, uint256 shares) internal override { uint256 totalShares = _totalShares; (bool success,) = totalShares.tryAdd(shares); if (!success) { super._mintShares(account, type(uint256).max - totalShares); _maxSharesReached = true; emit MaxSharesReached(block.timestamp); } else { super._mintShares(account, shares); } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.25; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; import { IERC20Rebasable } from "src/interfaces/IERC20Rebasable.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; /** * @title ERC20Rebasable * @dev This abstract contract is an extension of the ERC20 contract that allows for rebasing of the token supply. */ abstract contract ERC20Rebasable is ERC20Permit, IERC20Rebasable { using Math for uint256; /** * @notice the total supply is redefined over time. Each user has a share of the total supply. * @dev balanceOf(user) = sharesOf[user] * totalSupply() / totalShare */ mapping(address => uint256) internal _sharesOf; /// @dev total shares of the contract uint256 internal _totalShares; /// @dev blacklist for addresses that should not trigger a total supply update mapping(address => bool) internal _blacklistForUpdateSupply; /// @inheritdoc IERC20Rebasable uint256 public constant SHARES_PRECISION_FACTOR = 1e3; constructor(string memory name, string memory symbol, uint256 initialSupply) ERC20(name, symbol) ERC20Permit(name) { _sharesOf[msg.sender] = initialSupply * SHARES_PRECISION_FACTOR; _totalShares = initialSupply * SHARES_PRECISION_FACTOR; } /* -------------------------------------------------------------------------- */ /* external functions */ /* -------------------------------------------------------------------------- */ /// @inheritdoc IERC20Rebasable function totalShares() external view override returns (uint256) { return _totalShares; } /// @inheritdoc IERC20Rebasable function sharesOf(address user) external view returns (uint256) { return _sharesOf[user]; } /// @inheritdoc IERC20Rebasable function transferShares(address to, uint256 shares) external returns (bool) { return _transferShares(msg.sender, to, shares, sharesToToken(shares)); } /// @inheritdoc IERC20Rebasable function transferSharesFrom(address from, address to, uint256 shares) external returns (bool) { // round up the token amount to decrease the allowance in all cases uint256 tokenAmount = _sharesToTokenUp(shares); if (tokenAmount == 0 && shares > 0) { tokenAmount += 1; } _spendAllowance(from, msg.sender, tokenAmount); return _transferShares(from, to, shares, tokenAmount); } /// @inheritdoc IERC20Rebasable function updateTotalSupply() external virtual; /* -------------------------------------------------------------------------- */ /* public functions */ /* -------------------------------------------------------------------------- */ /// @inheritdoc IERC20Permit function nonces(address owner) public view virtual override(ERC20Permit, IERC20Permit) returns (uint256) { return super.nonces(owner); } /// @inheritdoc IERC20 function balanceOf(address account) public view virtual override(ERC20, IERC20) returns (uint256) { return sharesToToken(_sharesOf[account]); } /// @inheritdoc IERC20Rebasable function tokenToShares(uint256 amount) public view returns (uint256) { return tokenToShares(amount, _totalShares, totalSupply()); } /// @inheritdoc IERC20Rebasable function tokenToShares(uint256 amount, uint256 newTotalShares, uint256 newTotalSupply) public pure returns (uint256) { return amount.mulDiv(newTotalShares, newTotalSupply); } /// @inheritdoc IERC20Rebasable function sharesToToken(uint256 shares) public view returns (uint256 tokenAmount_) { tokenAmount_ = sharesToToken(shares, _totalShares, totalSupply()); } /// @inheritdoc IERC20Rebasable function sharesToToken(uint256 shares, uint256 newTotalShares, uint256 newTotalSupply) public pure returns (uint256 tokenAmount_) { // we round down to be conservative tokenAmount_ = shares.mulDiv(newTotalSupply, newTotalShares); } /* -------------------------------------------------------------------------- */ /* internal functions */ /* -------------------------------------------------------------------------- */ /** * @notice Transfer tokens to a specified address by specifying the amount of shares. * @param from The address to transfer the tokens from. * @param to The address to transfer the tokens to. * @param shareAmount The amount of shares to be transferred. * @param tokenAmount The amount of token corresponding to the amount of shares (not verified, used for events) * @return True if the transfer was successful, revert otherwise. * @dev this function updates the total supply by calling `updateTotalSupply()` */ function _transferShares(address from, address to, uint256 shareAmount, uint256 tokenAmount) internal returns (bool) { if (from == address(0)) { revert ERC20InvalidSender(from); } if (to == address(0)) { revert ERC20InvalidReceiver(to); } if (shareAmount > _sharesOf[from]) { revert ERC20InsufficientBalance(from, sharesToToken(_sharesOf[from]), tokenAmount); } if ( !_blacklistForUpdateSupply[from] && !_blacklistForUpdateSupply[to] && !_blacklistForUpdateSupply[msg.sender] ) { // slither-disable-next-line reentrancy-no-eth try this.updateTotalSupply() { } catch { } } _sharesOf[from] -= shareAmount; _sharesOf[to] += shareAmount; emit Transfer(from, to, tokenAmount); return true; } /** * @inheritdoc ERC20 * @dev mint and burn will revert, use _mintShares for that, or modify the totalSupply */ function _update(address from, address to, uint256 value) internal override { _transferShares(from, to, tokenToShares(value), value); } /// @inheritdoc ERC20 function _approve(address owner, address spender, uint256 value, bool emitEvent) internal override { try this.updateTotalSupply() { } catch { } super._approve(owner, spender, value, emitEvent); } /** * @notice Mint shares to an account. * @param account The account to mint the shares to. * @param shares The number of shares to mint. */ function _mintShares(address account, uint256 shares) internal virtual { _sharesOf[account] += shares; _totalShares += shares; } function _sharesToTokenUp(uint256 shares) internal view returns (uint256 tokenAmount_) { tokenAmount_ = shares.mulDiv(totalSupply(), _totalShares, Math.Rounding.Ceil); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.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 ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { 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) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { 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) { 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 { 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 { 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) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.20; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeCast { /** * @dev Value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); /** * @dev An int value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedIntToUint(int256 value); /** * @dev Value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); /** * @dev An uint value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedUintToInt(uint256 value); /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits */ function toUint248(uint256 value) internal pure returns (uint248) { if (value > type(uint248).max) { revert SafeCastOverflowedUintDowncast(248, value); } return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits */ function toUint240(uint256 value) internal pure returns (uint240) { if (value > type(uint240).max) { revert SafeCastOverflowedUintDowncast(240, value); } return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits */ function toUint232(uint256 value) internal pure returns (uint232) { if (value > type(uint232).max) { revert SafeCastOverflowedUintDowncast(232, value); } return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { if (value > type(uint224).max) { revert SafeCastOverflowedUintDowncast(224, value); } return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits */ function toUint216(uint256 value) internal pure returns (uint216) { if (value > type(uint216).max) { revert SafeCastOverflowedUintDowncast(216, value); } return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 value) internal pure returns (uint208) { if (value > type(uint208).max) { revert SafeCastOverflowedUintDowncast(208, value); } return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits */ function toUint200(uint256 value) internal pure returns (uint200) { if (value > type(uint200).max) { revert SafeCastOverflowedUintDowncast(200, value); } return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits */ function toUint192(uint256 value) internal pure returns (uint192) { if (value > type(uint192).max) { revert SafeCastOverflowedUintDowncast(192, value); } return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits */ function toUint184(uint256 value) internal pure returns (uint184) { if (value > type(uint184).max) { revert SafeCastOverflowedUintDowncast(184, value); } return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits */ function toUint176(uint256 value) internal pure returns (uint176) { if (value > type(uint176).max) { revert SafeCastOverflowedUintDowncast(176, value); } return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits */ function toUint168(uint256 value) internal pure returns (uint168) { if (value > type(uint168).max) { revert SafeCastOverflowedUintDowncast(168, value); } return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits */ function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) { revert SafeCastOverflowedUintDowncast(160, value); } return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits */ function toUint152(uint256 value) internal pure returns (uint152) { if (value > type(uint152).max) { revert SafeCastOverflowedUintDowncast(152, value); } return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits */ function toUint144(uint256 value) internal pure returns (uint144) { if (value > type(uint144).max) { revert SafeCastOverflowedUintDowncast(144, value); } return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits */ function toUint136(uint256 value) internal pure returns (uint136) { if (value > type(uint136).max) { revert SafeCastOverflowedUintDowncast(136, value); } return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { if (value > type(uint128).max) { revert SafeCastOverflowedUintDowncast(128, value); } return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { if (value > type(uint120).max) { revert SafeCastOverflowedUintDowncast(120, value); } return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits */ function toUint112(uint256 value) internal pure returns (uint112) { if (value > type(uint112).max) { revert SafeCastOverflowedUintDowncast(112, value); } return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits */ function toUint104(uint256 value) internal pure returns (uint104) { if (value > type(uint104).max) { revert SafeCastOverflowedUintDowncast(104, value); } return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { if (value > type(uint96).max) { revert SafeCastOverflowedUintDowncast(96, value); } return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { if (value > type(uint88).max) { revert SafeCastOverflowedUintDowncast(88, value); } return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { if (value > type(uint80).max) { revert SafeCastOverflowedUintDowncast(80, value); } return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits */ function toUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert SafeCastOverflowedUintDowncast(72, value); } return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { if (value > type(uint64).max) { revert SafeCastOverflowedUintDowncast(64, value); } return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits */ function toUint56(uint256 value) internal pure returns (uint56) { if (value > type(uint56).max) { revert SafeCastOverflowedUintDowncast(56, value); } return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits */ function toUint48(uint256 value) internal pure returns (uint48) { if (value > type(uint48).max) { revert SafeCastOverflowedUintDowncast(48, value); } return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert SafeCastOverflowedUintDowncast(40, value); } return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { if (value > type(uint32).max) { revert SafeCastOverflowedUintDowncast(32, value); } return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits */ function toUint24(uint256 value) internal pure returns (uint24) { if (value > type(uint24).max) { revert SafeCastOverflowedUintDowncast(24, value); } return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { if (value > type(uint16).max) { revert SafeCastOverflowedUintDowncast(16, value); } return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits */ function toUint8(uint256 value) internal pure returns (uint8) { if (value > type(uint8).max) { revert SafeCastOverflowedUintDowncast(8, value); } return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { if (value < 0) { revert SafeCastOverflowedIntToUint(value); } return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(248, value); } } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(240, value); } } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(232, value); } } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(224, value); } } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(216, value); } } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(208, value); } } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(192, value); } } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(176, value); } } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(168, value); } } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(160, value); } } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(152, value); } } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(144, value); } } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(136, value); } } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(128, value); } } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(120, value); } } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(112, value); } } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(104, value); } } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(96, value); } } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(88, value); } } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(80, value); } } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(72, value); } } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(64, value); } } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(56, value); } } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(48, value); } } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(40, value); } } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(32, value); } } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(24, value); } } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(16, value); } } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(8, value); } } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive if (value > uint256(type(int256).max)) { revert SafeCastOverflowedUintToInt(value); } return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.25; import { IPonzioTheCat } from "src/interfaces/IPonzioTheCat.sol"; import { IWrappedPonzioTheCat } from "src/interfaces/IWrappedPonzioTheCat.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IStake { /** * @notice Information about each staker's balance and reward debt. * @param amount staked amount * @param rewardDebt reward debt of the user used to calculate the pending rewards */ struct UserInfo { uint256 amount; uint256 rewardDebt; } /** * @notice Emitted when a user deposits LP tokens to the contract. * @param recipient address of the recipient * @param depositBy address of the msg.sender * @param amount amount of deposited tokens */ event Deposit(address indexed recipient, address depositBy, uint256 amount); /** * @notice Emitted when a user withdraws LP tokens from the contract. * @param user address of the user * @param recipient address of the recipient * @param amount amount of withdrawn tokens */ event Withdraw(address indexed user, address recipient, uint256 amount); /** * @notice Emitted when a user claims rewards from the contract. * @param user address of the user * @param recipient address of the recipient * @param reward amount of claimed tokens */ event ClaimReward(address indexed user, address recipient, uint256 reward); /** * @notice Emitted when a user forces the withdrawal of LP tokens from the contract. * @param user address of the user * @param amount amount of withdrawn LP tokens */ event EmergencyWithdraw(address indexed user, uint256 amount); /** * @notice Emitted when the contract is skimmed. * @param user address of the user * @param amount amount of skimmed lp tokens */ event Skim(address indexed user, uint256 amount); /// @notice Reverted when the user tries to deposit an amount of 0 tokens. error Stake_depositZeroAmount(); /// @notice Reverted when the user tries to withdraw an amount of 0 tokens. error Stake_withdrawZeroAmount(); /// @notice Revert when the refund fails. error Stake_refundFailed(); /// @notice Revert when the refund fails. error Stake_noPendingRewards(); /// @notice Revert when no value was added to the transaction but it was needed error Stake_valueNeeded(); /** * @notice Revert when the user tries to withdraw an amount higher than the staked amount. * @param withdrawAmount amount the user tries to withdraw * @param stakedAmount amount the user has staked */ error Stake_withdrawTooHigh(uint256 withdrawAmount, uint256 stakedAmount); /** * @notice Returns the address of the staking token. * @return IERC20 address of the staking token */ function LP_TOKEN() external view returns (IERC20); /** * @notice Returns the address of the Ponzio. * @return IPonzioTheCat address of the Ponzio */ function PONZIO() external view returns (IPonzioTheCat); /** * @notice Returns the address of the Ponzio token vault. * @return IWrappedPonzioTheCat address of the Ponzio token vault */ function WRAPPED_PONZIO() external view returns (IWrappedPonzioTheCat); /** * @notice Returns the staked amount and the reward debt of a user. * @param user address of the user * @return struct containing the user's staked amount and reward debt */ function userInfo(address user) external view returns (UserInfo memory); /** * @notice Returns the precision factor used to compute the reward per share. * @return The precision factor. */ function PRECISION_FACTOR() external view returns (uint256); /** * @notice Reinvests the user's rewards by adding liquidity to the Uniswap pair and staking the LP tokens. * @param amountPonzioMin The minimum amount of Ponzio tokens the user wants to add as liquidity. * @param amountEthMin The minimum amount of ETH the user wants to add as liquidity. * * This function first harvests the user's rewards. * * It then adds liquidity to the Uniswap pair with the harvested rewards and the ETH sent by the user. The LP * tokens received from adding liquidity are then staked. * * If there are any ETH or Ponzio tokens left in the contract, they are sent back to the user. * * Requirement: * - The `msg.value` (amount of ETH sent) must not be zero. */ function reinvest(uint256 amountPonzioMin, uint256 amountEthMin) external payable; /** * @notice Returns the reward amount that a user has pending to claim. * @param userAddr address of the user * @return rewards_ amount of pending rewards */ function pendingRewards(address userAddr) external view returns (uint256 rewards_); /** * @notice Deposits staking tokens to the contract. * @param amount amount of staking tokens to deposit * @param recipient address of the recipient */ function deposit(uint256 amount, address recipient) external; /** * @notice Withdraws staking tokens from the contract. * @param amount amount of staking tokens to withdraw * @param recipient address of the recipient */ function withdraw(uint256 amount, address recipient) external; /** * @notice Updates the pool and sends the pending reward amount of msg.sender. * @param recipient address of the recipient */ function harvest(address recipient) external; /** * @notice Convert all rewards to vault tokens * @dev Only call the vault if the balance is not zero */ function sync() external; /** * @notice Function to force the withdrawal of LP tokens from the contract. * @dev This function is used to withdraw the LP tokens in case of emergency. * It will send the LP tokens to the user without claiming the rewards. */ function emergencyWithdraw() external; /** * @notice Function to skim any excess lp tokens sent to the contract. * @dev Receiver is msg.sender */ function skim() external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.25; import { IERC20Rebasable } from "src/interfaces/IERC20Rebasable.sol"; import { IUniswapV2Pair } from "src/interfaces/UniswapV2/IUniswapV2Pair.sol"; interface IPonzioTheCat is IERC20Rebasable { /// @notice Error code is thrown when the contract is being initialized a 2nd time. error PONZIO_alreadyInitialized(); /// @notice Error code thrown in setFeesCollector when the contract has not been initialized yet. error PONZIO_notInitialized(); /// @notice Error code thrown in setFeesCollector when the new feesCollector is the zero address. error PONZIO_feeCollectorZeroAddress(); /** * @notice Emitted when the max shares are reached. * @param timestamp The timestamp at which the maximum is reached. */ event MaxSharesReached(uint256 timestamp); /** * @notice Emitted FeesCollector changes. * @param feesCollector The new feesCollector. * It's ok to set the feesCollector to the zero address, in which case no fees will be collected. */ event FeesCollectorSet(address indexed feesCollector); /** * @notice Emitted when the Uniswap V2 pair address is set. * @param uniV2PoolPair The new uniV2PoolPair. */ event UniV2PoolPairSet(address indexed uniV2PoolPair); /** * @notice Emitted when an account is blacklisted for UpdateTotalSupply. * @param account The account that is blacklisted. * @param value The new value of the blacklist. */ event BlacklistForUpdateSupplySet(address indexed account, bool indexed value); /** * @notice Emitted when the total supply is updated. * @param oldTotalSupply The old total supply. * @param newTotalSupply The new total supply. * @param oldTotalShare The old total share. * @param newTotalShare The new total share. * @param fees The fees collected. */ event TotalSupplyUpdated( uint256 oldTotalSupply, uint256 newTotalSupply, uint256 oldTotalShare, uint256 newTotalShare, uint256 fees ); /** * @notice Initial supply of the token. * @return The initial supply of the token. */ function INITIAL_SUPPLY() external view returns (uint256); /** * @notice Time between each halving. * @return The time between each halving. */ function HALVING_EVERY() external view returns (uint256); /** * @notice Time between each debasing. * @return The time between each debasing. */ function DEBASE_EVERY() external view returns (uint256); /** * @notice Number of debasing per halving. * @return The number of debasing per halving. */ function NB_DEBASE_PER_HALVING() external view returns (uint256); /** * @notice Minimum total supply. When the total supply reaches this value, it can't go lower. * @return The minimum total supply. */ function MINIMUM_TOTAL_SUPPLY() external view returns (uint256); /** * @notice The time at which the contract was deployed. * @return The time at which the contract was deployed. */ function DEPLOYED_TIME() external view returns (uint256); /** * @notice Fees collected on each debasing, in FEES_BASE percent. * @return The fees collected on each debasing. */ function FEES_STAKING() external view returns (uint256); /** * @notice The fee base used for FEES_STAKING * @return The fee base */ function FEES_BASE() external view returns (uint256); /** * @notice The address that collects the fees (the staking contract) * @return The address that collects the fees */ function feesCollector() external view returns (address); /** * @notice returns if the max shares are reached. * @return True if the max shares are reached, false otherwise. * @dev The max shares are reached when the total of shares is about to overflow. * When reached, fees are not collected anymore. */ function maxSharesReached() external view returns (bool); /** * @notice The Uniswap V2 pair to sync when debasing. * @return The Uniswap V2 pair. */ function uniswapV2Pair() external view returns (IUniswapV2Pair); /** * @notice Changes the Uniswap V2 pair address. * @param uniV2PoolAddr_ The new Uniswap V2 pair address. * @dev Set the Uniswap V2 pair address to zero address to disable syncing. */ function setUniswapV2Pair(address uniV2PoolAddr_) external; /** * @notice Changes the fees collector. * @param feesCollector_ The new fees collector. */ function setFeesCollector(address feesCollector_) external; /** * @notice Blacklist an address for UpdateTotalSupply. * @param addrToBlacklist The address to blacklist. * @param value The new value of the blacklist. */ function setBlacklistForUpdateSupply(address addrToBlacklist, bool value) external; /** * @notice Initialize the contract by setting the fees collector and staking the first amount of tokens. * @param feesCollector_ The address that will collect the fees. * @param uniV2PoolAddr_ The address of the uniswap V2 pool. */ function initialize(address feesCollector_, address uniV2PoolAddr_) external; /** * @notice Return the real-time balance of an account after an UpdateTotalSupply() call. * @param account_ The account to check the balance of. * @return balance_ The real-time balance of the account. * @dev This function will only return the right balance if the feesCollector is set. */ function realBalanceOf(address account_) external view returns (uint256 balance_); /** * @notice Compute the total supply and the fees to collect. * @return totalSupply_ The new total supply. * @return fees_ The fees to collect. */ function computeSupply() external view returns (uint256 totalSupply_, uint256 fees_); /** * @notice Compute the total shares, supply and the fees to collect. * @return totalShares_ The new total shares. * @return totalSupply_ The new total supply. * @return fees_ The fees to collect. */ function computeNewState() external view returns (uint256 totalShares_, uint256 totalSupply_, uint256 fees_); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.25; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; interface IERC20Rebasable is IERC20, IERC20Permit { /** * @notice returns the precision factor for shares. * @return The precision factor for shares. */ function SHARES_PRECISION_FACTOR() external view returns (uint256); /** * @notice returns the total shares. * @return The total shares. */ function totalShares() external view returns (uint256); /** * @notice returns the share of the user. * @param user The address of the user to get the share of. * @return The share of the user. */ function sharesOf(address user) external view returns (uint256); /** * @notice Transfer tokens to a specified address by specifying the share amount. * @param to The address to transfer the tokens to. * @param shares The amount of shares to be transferred. * @return True if the transfer was successful, revert otherwise. */ function transferShares(address to, uint256 shares) external returns (bool); /** * @notice Transfer shares from a specified address to another specified address. * @param from The address to transfer the shares from. * @param to The address to transfer the shares to. * @param shares The amount of shares to be transferred. * @return True if the transfer was successful, revert otherwise. * @dev This function tries to update the total supply by calling `updateTotalSupply()` */ function transferSharesFrom(address from, address to, uint256 shares) external returns (bool); /** * @notice update the total supply, compute the debase accordingly and transfer the fees to the feesCollector. * @dev This function is already called at each approval and transfer. It needs to be implemented by a child * contract */ function updateTotalSupply() external; /** * @notice Convert tokens to shares. * @param amount The amount of tokens to convert to shares. * @return shares_ The number of shares corresponding to the tokens. */ function tokenToShares(uint256 amount) external view returns (uint256 shares_); /** * @notice Convert tokens to shares given the new total shares and total supply. * @param amount The amount of tokens to convert to shares. * @param newTotalShares The new total shares. * @param newTotalSupply The new total supply. * @return shares_ The number of shares corresponding to the tokens. */ function tokenToShares(uint256 amount, uint256 newTotalShares, uint256 newTotalSupply) external view returns (uint256 shares_); /** * @notice Convert shares to tokens. * @param shares The amount of shares to convert to tokens. * @return tokenAmount_ The amount of tokens corresponding to the shares. */ function sharesToToken(uint256 shares) external view returns (uint256 tokenAmount_); /** * @notice Convert shares to tokens given the new total shares and total supply. * @param shares The amount of shares to convert to tokens. * @param newTotalShares The new total shares. * @param newTotalSupply The new total supply. * @return tokenAmount_ The amount of tokens corresponding to the shares. */ function sharesToToken(uint256 shares, uint256 newTotalShares, uint256 newTotalSupply) external view returns (uint256 tokenAmount_); }
// 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: Unlicense pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint256); function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.20; import {IERC20Permit} from "./IERC20Permit.sol"; import {ERC20} from "../ERC20.sol"; import {ECDSA} from "../../../utils/cryptography/ECDSA.sol"; import {EIP712} from "../../../utils/cryptography/EIP712.sol"; import {Nonces} from "../../../utils/Nonces.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces { bytes32 private constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Permit deadline has expired. */ error ERC2612ExpiredSignature(uint256 deadline); /** * @dev Mismatched signature. */ error ERC2612InvalidSigner(address signer, address owner); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @inheritdoc IERC20Permit */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { if (block.timestamp > deadline) { revert ERC2612ExpiredSignature(deadline); } bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); if (signer != owner) { revert ERC2612InvalidSigner(signer, owner); } _approve(owner, spender, value); } /** * @inheritdoc IERC20Permit */ function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) { return super.nonces(owner); } /** * @inheritdoc IERC20Permit */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view virtual returns (bytes32) { return _domainSeparatorV4(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// 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 // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.25; import { IPonzioTheCat } from "src/interfaces/IPonzioTheCat.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWrappedPonzioTheCat is IERC20 { /// @notice Returns the underlying asset of the wrapped token. function asset() external view returns (IPonzioTheCat); /** * @notice Returns the amount of wrapped tokens that will be minted when wrapping the underlying assets given the * new total shares and total supply. * @param assets The amount of underlying assets to be wrapped. * @param newTotalShares The new total shares of the wrapped token. * @param newTotalSupply The new total supply of the wrapped token. * @return amount_ The amount of wrapped tokens that will be minted. */ function previewWrap(uint256 assets, uint256 newTotalShares, uint256 newTotalSupply) external view returns (uint256 amount_); /** * @notice Wraps the underlying assets into the wrapped token. * @param assets The amount of underlying assets to be wrapped. * @return amount_ The amount of wrapped tokens minted. */ function wrap(uint256 assets) external returns (uint256 amount_); /** * @notice Wraps the underlying assets into the wrapped token and mints them to the receiver. * @param assets The amount of underlying assets to be wrapped. * @param receiver The address to which the wrapped tokens are minted. * @return amount_ The amount of wrapped tokens minted. */ function wrap(uint256 assets, address receiver) external returns (uint256 amount_); /** * @notice Wraps the underlying shares into the wrapped token and mints them to the receiver. * @param shares The amount of underlying shares to be wrapped. * @param receiver The address to which the wrapped tokens are minted. * @return amount_ The amount of wrapped tokens minted. */ function wrapShares(uint256 shares, address receiver) external returns (uint256 amount_); /** * @notice Returns the amount of underlying assets that will be received when unwrapping the wrapped tokens. * @param amount The amount of wrapped tokens to be unwrapped. * @return assets_ The amount of underlying assets that will be received. */ function previewUnwrap(uint256 amount) external view returns (uint256 assets_); /** * @notice Returns the amount of underlying assets that will be received when unwrapping the wrapped tokens given * the new total shares and total supply. * @param amount The amount of wrapped tokens to be unwrapped. * @param newTotalShares The new total shares of the wrapped token. * @param newTotalSupply The new total supply of the wrapped token. * @return assets_ The amount of underlying assets that will be received. */ function previewUnwrap(uint256 amount, uint256 newTotalShares, uint256 newTotalSupply) external view returns (uint256 assets_); /** * @notice Unwraps the wrapped tokens into the underlying assets. * @param amount The amount of wrapped tokens to be unwrapped. * @return assets_ The amount of underlying assets received. */ function unwrap(uint256 amount) external returns (uint256 assets_); /** * @notice Unwraps the wrapped tokens into the underlying assets and sends them to the receiver. * @param amount The amount of wrapped tokens to be unwrapped. * @param receiver The address to which the underlying assets are sent. * @return assets_ The amount of underlying assets received. */ function unwrap(uint256 amount, address receiver) external returns (uint256 assets_); /** * @notice Returns the amount of wrapped tokens that will be minted when wrapping the underlying assets. * @param assets The amount of underlying assets to be wrapped. * @return amount_ The amount of wrapped tokens that will be minted. */ function previewWrap(uint256 assets) external view returns (uint256 amount_); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "./MessageHashUtils.sol"; import {ShortStrings, ShortString} from "../ShortStrings.sol"; import {IERC5267} from "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * @custom:oz-upgrades-unsafe-allow state-variable-immutable */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: By default this function reads _name which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Name() internal view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } /** * @dev The version parameter for the EIP712 domain. * * NOTE: By default this function reads _version which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Version() internal view returns (string memory) { return _version.toStringWithFallback(_versionFallback); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol) pragma solidity ^0.8.20; /** * @dev Provides tracking nonces for addresses. Nonces will only increment. */ abstract contract Nonces { /** * @dev The nonce used for an `account` is not the expected current nonce. */ error InvalidAccountNonce(address account, uint256 currentNonce); mapping(address account => uint256) private _nonces; /** * @dev Returns the next unused nonce for an address. */ function nonces(address owner) public view virtual returns (uint256) { return _nonces[owner]; } /** * @dev Consumes a nonce. * * Returns the current value and increments nonce. */ function _useNonce(address owner) internal virtual returns (uint256) { // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be // decremented or reset. This guarantees that the nonce never overflows. unchecked { // It is important to do x++ and not ++x here. return _nonces[owner]++; } } /** * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`. */ function _useCheckedNonce(address owner, uint256 nonce) internal virtual { uint256 current = _useNonce(owner); if (nonce != current) { revert InvalidAccountNonce(owner, current); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using * {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.20; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
{ "remappings": [ "@openzeppelin/=node_modules/@openzeppelin/" ], "optimizer": { "enabled": true, "runs": 999999 }, "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
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","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":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC2612ExpiredSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC2612InvalidSigner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"currentNonce","type":"uint256"}],"name":"InvalidAccountNonce","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"PONZIO_alreadyInitialized","type":"error"},{"inputs":[],"name":"PONZIO_feeCollectorZeroAddress","type":"error"},{"inputs":[],"name":"PONZIO_notInitialized","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","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":"account","type":"address"},{"indexed":true,"internalType":"bool","name":"value","type":"bool"}],"name":"BlacklistForUpdateSupplySet","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feesCollector","type":"address"}],"name":"FeesCollectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"MaxSharesReached","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldTotalSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldTotalShare","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalShare","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"}],"name":"TotalSupplyUpdated","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":"uniV2PoolPair","type":"address"}],"name":"UniV2PoolPairSet","type":"event"},{"inputs":[],"name":"DEBASE_EVERY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPLOYED_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEES_BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEES_STAKING","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HALVING_EVERY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_TOTAL_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NB_DEBASE_PER_HALVING","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SHARES_PRECISION_FACTOR","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":"computeNewState","outputs":[{"internalType":"uint256","name":"totalShares_","type":"uint256"},{"internalType":"uint256","name":"totalSupply_","type":"uint256"},{"internalType":"uint256","name":"fees_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"computeSupply","outputs":[{"internalType":"uint256","name":"totalSupply_","type":"uint256"},{"internalType":"uint256","name":"fees_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feesCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"feeCollector","type":"address"},{"internalType":"address","name":"uniV2PoolAddr","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxSharesReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"realBalanceOf","outputs":[{"internalType":"uint256","name":"balance_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addrToBlacklist","type":"address"},{"internalType":"bool","name":"value","type":"bool"}],"name":"setBlacklistForUpdateSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"feeCollector","type":"address"}],"name":"setFeesCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"uniV2PoolAddr","type":"address"}],"name":"setUniswapV2Pair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"sharesOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"newTotalShares","type":"uint256"},{"internalType":"uint256","name":"newTotalSupply","type":"uint256"}],"name":"sharesToToken","outputs":[{"internalType":"uint256","name":"tokenAmount_","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"sharesToToken","outputs":[{"internalType":"uint256","name":"tokenAmount_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"tokenToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"newTotalShares","type":"uint256"},{"internalType":"uint256","name":"newTotalSupply","type":"uint256"}],"name":"tokenToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","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":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"transferShares","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":"shares","type":"uint256"}],"name":"transferSharesFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2Pair","outputs":[{"internalType":"contract IUniswapV2Pair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateTotalSupply","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
610180604052600c805460ff60a01b19908116909155600d8054909116905534801561002a57600080fd5b50336040518060400160405280600e81526020016d141bdb9e9a5bc8151a194810d85d60921b81525060405180604001604052806006815260200165506f6e7a696f60d01b8152506012600a61008091906103de565b61008e906301406f406103f4565b6040805180820190915260018152603160f81b602082015283908190818560036100b883826104ac565b5060046100c582826104ac565b506100d591508390506005610221565b610120526100e4816006610221565b61014052815160208084019190912060e052815190820120610100524660a05261017160e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506101876103e8826103f4565b336000908152600860205260409020556101a36103e8826103f4565b6009555050506001600160a01b0381166101d857604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6101e181610254565b5042610160526101f36012600a6103de565b610201906301406f406103f4565b6001600160d81b0316600160d81b4264ffffffffff160217600e556105de565b600060208351101561023d57610236836102a6565b905061024e565b8161024884826104ac565b5060ff90505b92915050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080829050601f815111156102d1578260405163305a27a960e01b81526004016101cf919061056b565b80516102dc826105ba565b179392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561033557816000190482111561031b5761031b6102e4565b8085161561032857918102915b93841c93908002906102ff565b509250929050565b60008261034c5750600161024e565b816103595750600061024e565b816001811461036f576002811461037957610395565b600191505061024e565b60ff84111561038a5761038a6102e4565b50506001821b61024e565b5060208310610133831016604e8410600b84101617156103b8575081810a61024e565b6103c283836102fa565b80600019048211156103d6576103d66102e4565b029392505050565b60006103ed60ff84168361033d565b9392505050565b808202811582820484141761024e5761024e6102e4565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168061043557607f821691505b60208210810361045557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156104a7576000816000526020600020601f850160051c810160208610156104845750805b601f850160051c820191505b818110156104a357828155600101610490565b5050505b505050565b81516001600160401b038111156104c5576104c561040b565b6104d9816104d38454610421565b8461045b565b602080601f83116001811461050e57600084156104f65750858301515b600019600386901b1c1916600185901b1785556104a3565b600085815260208120601f198616915b8281101561053d5788860151825594840194600190910190840161051e565b508582101561055b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020808352835180602085015260005b818110156105995785810183015185820160400152820161057d565b506000604082860101526040601f19601f8301168501019250505092915050565b805160208083015191908110156104555760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051612b8861064a600039600081816104510152610cbe01526000611dbd01526000611d90015260006117ef015260006117c7015260006117220152600061174c015260006117760152612b886000f3fe608060405234801561001057600080fd5b50600436106102f45760003560e01c80637a60e06911610191578063baa83f69116100e3578063db6905ab11610097578063f2fde38b11610071578063f2fde38b14610679578063f5eb42dc1461068c578063fda9c947146106c257600080fd5b8063db6905ab14610607578063dd62ed3e1461062a578063ece531b01461067057600080fd5b8063d0dc5c65116100c8578063d0dc5c65146105d9578063d4245ebb146105e1578063d505accf146105f457600080fd5b8063baa83f69146105a3578063c53dc757146105c657600080fd5b806395d89b4111610145578063a29a60891161011f578063a29a608914610575578063a9059cbb14610588578063b23b36ad1461059b57600080fd5b806395d89b411461053c57806399a03c70146105445780639cf160f61461055757600080fd5b806384b0196e1161017657806384b0196e146104f05780638da5cb5b1461050b5780638fcb4e5b1461052957600080fd5b80637a60e069146104c05780637ecebe00146104dd57600080fd5b80633a98ef391161024a57806365017796116101fe57806370a08231116101d857806370a082311461049957806370fc982d146104ac578063715018a6146104b857600080fd5b8063650177961461044c5780636cf81ec6146104735780636d7804591461048657600080fd5b806349bd5a5e1161022f57806349bd5a5e146103f15780634b457d98146104305780635e703fec1461043957600080fd5b80633a98ef39146103d6578063485cc955146103de57600080fd5b8063280cc3d2116102ac578063361bb0c111610286578063361bb0c1146103a65780633644e515146103b9578063373071f2146103c157600080fd5b8063280cc3d2146103865780632ff2e9dc1461038f578063313ce5671461039757600080fd5b806318160ddd116102dd57806318160ddd1461033a5780631db6e8501461036957806323b872dd1461037357600080fd5b806306fdde03146102f9578063095ea7b314610317575b600080fd5b6103016106cb565b60405161030e919061260a565b60405180910390f35b61032a610325366004612646565b61075d565b604051901515815260200161030e565b600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff165b60405190815260200161030e565b61035b6205469081565b61032a610381366004612670565b610777565b61035b61080a81565b61035b61079d565b6040516012815260200161030e565b61035b6103b43660046126ac565b6107ba565b61035b6107e9565b6103d46103cf3660046126c5565b6107f8565b005b60095461035b565b6103d46103ec3660046126e0565b610918565b600d5473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161030e565b61035b61053981565b61035b610447366004612713565b610b30565b61035b7f000000000000000000000000000000000000000000000000000000000000000081565b61035b6104813660046126ac565b610b45565b61032a610494366004612670565b610b74565b61035b6104a73660046126c5565b610bc3565b61035b64e8d4a5100081565b6103d4610c1a565b6104c8610c2e565b6040805192835260208301919091520161030e565b61035b6104eb3660046126c5565b610e47565b6104f8610e52565b60405161030e979695949392919061273f565b600b5473ffffffffffffffffffffffffffffffffffffffff1661040b565b61032a610537366004612646565b610eb4565b610301610eca565b61035b6105523660046126c5565b610ed9565b600c5473ffffffffffffffffffffffffffffffffffffffff1661040b565b6103d46105833660046126c5565b610f1d565b61032a610596366004612646565b610f94565b61035b610fa2565b6105ab610fb1565b6040805193845260208401929092529082015260600161030e565b61035b6105d4366004612713565b611056565b6103d4611063565b6103d46105ef366004612801565b6112e4565b6103d461060236600461283d565b61136b565b600c5474010000000000000000000000000000000000000000900460ff1661032a565b61035b6106383660046126e0565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b61035b61271081565b6103d46106873660046126c5565b61151d565b61035b61069a3660046126c5565b73ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604090205490565b61035b6103e881565b6060600380546106da906128b0565b80601f0160208091040260200160405190810160405280929190818152602001828054610706906128b0565b80156107535780601f1061072857610100808354040283529160200191610753565b820191906000526020600020905b81548152906001019060200180831161073657829003601f168201915b5050505050905090565b60003361076b818585611581565b60019150505b92915050565b60003361078585828561158e565b61079085858561165d565b60019150505b9392505050565b6107a96012600a612a52565b6107b7906301406f40612a61565b81565b6000610771826009546105d4600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b60006107f3611708565b905090565b610800611840565b600d5474010000000000000000000000000000000000000000900460ff16610854576040517faa324d7c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166108a1576040517f874252b500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108a9611063565b600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f2e5c9b2d1f2851a0e14220e58e1e816d1320fc05d2c89a5657bedc5a9943c20d90600090a250565b610920611840565b600d5474010000000000000000000000000000000000000000900460ff1615610975576040517f8443444a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166109c2576040517f874252b500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffff000000000000000000000000000000000000000000909116811774010000000000000000000000000000000000000000179091556040517f73f069d9129374dc8becc030b822edfd551de07458e25992e89e7bf50cd4a06390600090a273ffffffffffffffffffffffffffffffffffffffff81166000818152600a602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915590519092917f4a8bc871bc382f8f05aa4ee5015bd9d5eeafc8334ba96536b463dd2657a64f1591a3600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040517f2e5c9b2d1f2851a0e14220e58e1e816d1320fc05d2c89a5657bedc5a9943c20d90600090a25050565b6000610b3d848385611893565b949350505050565b600061077182600954610447600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b600080610b808361198e565b905080158015610b905750600083115b15610ba357610ba0600182612a78565b90505b610bae85338361158e565b610bba858585846119c6565b95945050505050565b600e5460095473ffffffffffffffffffffffffffffffffffffffff83166000908152600860205260408120549092610771927affffffffffffffffffffffffffffffffffffffffffffffffffffff90911690611893565b610c22611840565b610c2c6000611d07565b565b600e54600c5460009182917affffffffffffffffffffffffffffffffffffffffffffffffffffff9091169074010000000000000000000000000000000000000000900460ff1615610c825792600092509050565b600e547b01000000000000000000000000000000000000000000000000000000900464ffffffffff1664e8d4a510008214610dbd576000610ce37f000000000000000000000000000000000000000000000000000000000000000042612a8b565b90506000610cf46205469083612acd565b610cff906002612ae1565b610d0b6012600a612a52565b610d19906301406f40612a61565b610d239190612acd565b90506002610d3661080a62054690612acd565b61080a610d466205469086612aed565b610d509190612acd565b610d5a9084612a61565b610d649190612acd565b610d6e9190612acd565b610d789082612a8b565b955064e8d4a51000861015610d905764e8d4a5100095505b612710610539610da08887612a8b565b610daa9190612a61565b610db49190612acd565b94505050610e41565b64e8d4a51000935062054690610dd38242612a8b565b1015610e205761271062054690610dea8342612a8b565b610dfb61053964e8d4a51000612a61565b610e059190612a61565b610e0f9190612acd565b610e199190612acd565b9250610e41565b612710610e3461053964e8d4a51000612a61565b610e3e9190612acd565b92505b50509091565b600061077182611d7e565b600060608060008060006060610e66611d89565b610e6e611db6565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b6000610796338484610ec586610b45565b6119c6565b6060600480546106da906128b0565b6000806000610ee6610fb1565b5073ffffffffffffffffffffffffffffffffffffffff86166000908152600860205260409020549193509150610b3d908383610b30565b610f25611840565b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f73f069d9129374dc8becc030b822edfd551de07458e25992e89e7bf50cd4a06390600090a250565b60003361076b81858561165d565b6107b761080a62054690612acd565b6000806000806009549050610fc4610c2e565b90935091506000838310610fe6575080610fdf600285612acd565b9250610fff565b610ffc83610ff48187612a8b565b849190611893565b90505b600061100b8383611de3565b965090508061104e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff955061104b6110448488612a8b565b8787610b30565b93505b505050909192565b6000610b3d848484611893565b600e5464ffffffffff4281167b01000000000000000000000000000000000000000000000000000000909204160361109757565b6000806110a2610c2e565b600c54919350915073ffffffffffffffffffffffffffffffffffffffff1681158015906110e4575073ffffffffffffffffffffffffffffffffffffffff811615155b156112df57600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff1661111284611e0c565b7affffffffffffffffffffffffffffffffffffffffffffffffffffff167b010000000000000000000000000000000000000000000000000000004264ffffffffff160217600e556009548484106111725761116d8382611e71565b611191565b6111918361118c86611184818a612a8b565b859190611893565b611e71565b6009546040805184815260208101889052808201849052606081019290925260808201869052517f9e58b170e0350f4db79237b74fbf8c29c7d19c7c09b71d0f0f8e9316334acaed9181900360a00190a173ffffffffffffffffffffffffffffffffffffffff83163b1561125a578273ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561124757600080fd5b505af1925050508015611258575060015b505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112c457600080fd5b505af11580156112d8573d6000803e3d6000fd5b5050505050505b505050565b6112ec611840565b73ffffffffffffffffffffffffffffffffffffffff82166000818152600a602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917f4a8bc871bc382f8f05aa4ee5015bd9d5eeafc8334ba96536b463dd2657a64f1591a35050565b834211156113ad576040517f62791302000000000000000000000000000000000000000000000000000000008152600481018590526024015b60405180910390fd5b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886114078c73ffffffffffffffffffffffffffffffffffffffff16600090815260076020526040902080546001810190915590565b60408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061146f82611f43565b9050600061147f82878787611f8b565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611506576040517f4b800e4600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80831660048301528b1660248201526044016113a4565b6115118a8a8a611581565b50505050505050505050565b611525611840565b73ffffffffffffffffffffffffffffffffffffffff8116611575576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b61157e81611d07565b50565b6112df8383836001611fb9565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146116575781811015611648576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101829052604481018390526064016113a4565b61165784848484036000611fb9565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166116ad576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff82166116fd576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b6112df83838361201f565b60003073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614801561176e57507f000000000000000000000000000000000000000000000000000000000000000046145b1561179857507f000000000000000000000000000000000000000000000000000000000000000090565b6107f3604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b600b5473ffffffffffffffffffffffffffffffffffffffff163314610c2c576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016113a4565b6000838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870982811083820303915050806000036118e8578382816118de576118de612a9e565b0492505050610796565b808411611921576040517f227bc15300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60006107716119b9600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b6009548491906001612033565b600073ffffffffffffffffffffffffffffffffffffffff8516611a2d576040517f96c6fd1e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff8416611a92576040517fec442f0500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260086020526040902054831115611b475773ffffffffffffffffffffffffffffffffffffffff85166000908152600860205260409020548590611af090610b45565b6040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604481018390526064016113a4565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600a602052604090205460ff16158015611ba3575073ffffffffffffffffffffffffffffffffffffffff84166000908152600a602052604090205460ff16155b8015611bbf5750336000908152600a602052604090205460ff16155b15611c1f573073ffffffffffffffffffffffffffffffffffffffff1663d0dc5c656040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611c0c57600080fd5b505af1925050508015611c1d575060015b505b73ffffffffffffffffffffffffffffffffffffffff851660009081526008602052604081208054859290611c54908490612a8b565b909155505073ffffffffffffffffffffffffffffffffffffffff841660009081526008602052604081208054859290611c8e908490612a78565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611cf491815260200190565b60405180910390a3506001949350505050565b600b805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061077182612082565b60606107f37f000000000000000000000000000000000000000000000000000000000000000060056120ad565b60606107f37f000000000000000000000000000000000000000000000000000000000000000060066120ad565b60008083830184811015611dfe576000809250925050611e05565b6001925090505b9250929050565b60007affffffffffffffffffffffffffffffffffffffffffffffffffffff821115611e6d576040517f6dfcc65000000000000000000000000000000000000000000000000000000000815260d86004820152602481018390526044016113a4565b5090565b6009546000611e808284611de3565b50905080611f3957611ebb84611eb6847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff612a8b565b612158565b600c80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040517f628240a53f7ebe5375e91882d66546bf9e49d01336f63e6afcc71ff6b8cdfa2090611f2c9042815260200190565b60405180910390a1611657565b6116578484612158565b6000610771611f50611708565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b600080600080611f9d888888886121af565b925092509250611fad82826122a9565b50909695505050505050565b3073ffffffffffffffffffffffffffffffffffffffff1663d0dc5c656040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561200157600080fd5b505af1925050508015612012575060015b50611657848484846123b1565b611657838361202d846107ba565b846119c6565b600080612041868686611893565b905061204c836124f9565b801561206857506000848061206357612063612a9e565b868809115b15610bba57612078600182612a78565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260076020526040812054610771565b606060ff83146120c7576120c083612526565b9050610771565b8180546120d3906128b0565b80601f01602080910402602001604051908101604052809291908181526020018280546120ff906128b0565b801561214c5780601f106121215761010080835404028352916020019161214c565b820191906000526020600020905b81548152906001019060200180831161212f57829003601f168201915b50505050509050610771565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600860205260408120805483929061218d908490612a78565b9250508190555080600960008282546121a69190612a78565b90915550505050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156121ea575060009150600390508261229f565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa15801561223e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166122955750600092506001915082905061229f565b9250600091508190505b9450945094915050565b60008260038111156122bd576122bd612b01565b036122c6575050565b60018260038111156122da576122da612b01565b03612311576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600282600381111561232557612325612b01565b0361235f576040517ffce698f7000000000000000000000000000000000000000000000000000000008152600481018290526024016113a4565b600382600381111561237357612373612b01565b036123ad576040517fd78bce0c000000000000000000000000000000000000000000000000000000008152600481018290526024016113a4565b5050565b73ffffffffffffffffffffffffffffffffffffffff8416612401576040517fe602df05000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff8316612451576040517f94280d62000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526001602090815260408083209387168352929052208290558015611657578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516124eb91815260200190565b60405180910390a350505050565b6000600282600381111561250f5761250f612b01565b6125199190612b30565b60ff166001149050919050565b6060600061253383612565565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600060ff8216601f811115610771576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815180845260005b818110156125cc576020818501810151868301820152016125b0565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061079660208301846125a6565b803573ffffffffffffffffffffffffffffffffffffffff8116811461264157600080fd5b919050565b6000806040838503121561265957600080fd5b6126628361261d565b946020939093013593505050565b60008060006060848603121561268557600080fd5b61268e8461261d565b925061269c6020850161261d565b9150604084013590509250925092565b6000602082840312156126be57600080fd5b5035919050565b6000602082840312156126d757600080fd5b6107968261261d565b600080604083850312156126f357600080fd5b6126fc8361261d565b915061270a6020840161261d565b90509250929050565b60008060006060848603121561272857600080fd5b505081359360208301359350604090920135919050565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e0602084015261277c60e084018a6125a6565b838103604085015261278e818a6125a6565b6060850189905273ffffffffffffffffffffffffffffffffffffffff8816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b818110156127ef578351835292840192918401916001016127d3565b50909c9b505050505050505050505050565b6000806040838503121561281457600080fd5b61281d8361261d565b91506020830135801515811461283257600080fd5b809150509250929050565b600080600080600080600060e0888a03121561285857600080fd5b6128618861261d565b965061286f6020890161261d565b95506040880135945060608801359350608088013560ff8116811461289357600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600181811c908216806128c457607f821691505b6020821081036128fd577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600181815b8085111561298b57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561297157612971612903565b8085161561297e57918102915b93841c9390800290612937565b509250929050565b6000826129a257506001610771565b816129af57506000610771565b81600181146129c557600281146129cf576129eb565b6001915050610771565b60ff8411156129e0576129e0612903565b50506001821b610771565b5060208310610133831016604e8410600b8410161715612a0e575081810a610771565b612a188383612932565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612a4a57612a4a612903565b029392505050565b600061079660ff841683612993565b808202811582820484141761077157610771612903565b8082018082111561077157610771612903565b8181038181111561077157610771612903565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082612adc57612adc612a9e565b500490565b60006107968383612993565b600082612afc57612afc612a9e565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600060ff831680612b4357612b43612a9e565b8060ff8416069150509291505056fea26469706673582212203a135a40b83fcb64cda657e8d6df5e37583789a108d820a8ea4f069fd5c11b1b64736f6c63430008190033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102f45760003560e01c80637a60e06911610191578063baa83f69116100e3578063db6905ab11610097578063f2fde38b11610071578063f2fde38b14610679578063f5eb42dc1461068c578063fda9c947146106c257600080fd5b8063db6905ab14610607578063dd62ed3e1461062a578063ece531b01461067057600080fd5b8063d0dc5c65116100c8578063d0dc5c65146105d9578063d4245ebb146105e1578063d505accf146105f457600080fd5b8063baa83f69146105a3578063c53dc757146105c657600080fd5b806395d89b4111610145578063a29a60891161011f578063a29a608914610575578063a9059cbb14610588578063b23b36ad1461059b57600080fd5b806395d89b411461053c57806399a03c70146105445780639cf160f61461055757600080fd5b806384b0196e1161017657806384b0196e146104f05780638da5cb5b1461050b5780638fcb4e5b1461052957600080fd5b80637a60e069146104c05780637ecebe00146104dd57600080fd5b80633a98ef391161024a57806365017796116101fe57806370a08231116101d857806370a082311461049957806370fc982d146104ac578063715018a6146104b857600080fd5b8063650177961461044c5780636cf81ec6146104735780636d7804591461048657600080fd5b806349bd5a5e1161022f57806349bd5a5e146103f15780634b457d98146104305780635e703fec1461043957600080fd5b80633a98ef39146103d6578063485cc955146103de57600080fd5b8063280cc3d2116102ac578063361bb0c111610286578063361bb0c1146103a65780633644e515146103b9578063373071f2146103c157600080fd5b8063280cc3d2146103865780632ff2e9dc1461038f578063313ce5671461039757600080fd5b806318160ddd116102dd57806318160ddd1461033a5780631db6e8501461036957806323b872dd1461037357600080fd5b806306fdde03146102f9578063095ea7b314610317575b600080fd5b6103016106cb565b60405161030e919061260a565b60405180910390f35b61032a610325366004612646565b61075d565b604051901515815260200161030e565b600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff165b60405190815260200161030e565b61035b6205469081565b61032a610381366004612670565b610777565b61035b61080a81565b61035b61079d565b6040516012815260200161030e565b61035b6103b43660046126ac565b6107ba565b61035b6107e9565b6103d46103cf3660046126c5565b6107f8565b005b60095461035b565b6103d46103ec3660046126e0565b610918565b600d5473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161030e565b61035b61053981565b61035b610447366004612713565b610b30565b61035b7f0000000000000000000000000000000000000000000000000000000066702b9f81565b61035b6104813660046126ac565b610b45565b61032a610494366004612670565b610b74565b61035b6104a73660046126c5565b610bc3565b61035b64e8d4a5100081565b6103d4610c1a565b6104c8610c2e565b6040805192835260208301919091520161030e565b61035b6104eb3660046126c5565b610e47565b6104f8610e52565b60405161030e979695949392919061273f565b600b5473ffffffffffffffffffffffffffffffffffffffff1661040b565b61032a610537366004612646565b610eb4565b610301610eca565b61035b6105523660046126c5565b610ed9565b600c5473ffffffffffffffffffffffffffffffffffffffff1661040b565b6103d46105833660046126c5565b610f1d565b61032a610596366004612646565b610f94565b61035b610fa2565b6105ab610fb1565b6040805193845260208401929092529082015260600161030e565b61035b6105d4366004612713565b611056565b6103d4611063565b6103d46105ef366004612801565b6112e4565b6103d461060236600461283d565b61136b565b600c5474010000000000000000000000000000000000000000900460ff1661032a565b61035b6106383660046126e0565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b61035b61271081565b6103d46106873660046126c5565b61151d565b61035b61069a3660046126c5565b73ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604090205490565b61035b6103e881565b6060600380546106da906128b0565b80601f0160208091040260200160405190810160405280929190818152602001828054610706906128b0565b80156107535780601f1061072857610100808354040283529160200191610753565b820191906000526020600020905b81548152906001019060200180831161073657829003601f168201915b5050505050905090565b60003361076b818585611581565b60019150505b92915050565b60003361078585828561158e565b61079085858561165d565b60019150505b9392505050565b6107a96012600a612a52565b6107b7906301406f40612a61565b81565b6000610771826009546105d4600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b60006107f3611708565b905090565b610800611840565b600d5474010000000000000000000000000000000000000000900460ff16610854576040517faa324d7c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166108a1576040517f874252b500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108a9611063565b600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f2e5c9b2d1f2851a0e14220e58e1e816d1320fc05d2c89a5657bedc5a9943c20d90600090a250565b610920611840565b600d5474010000000000000000000000000000000000000000900460ff1615610975576040517f8443444a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166109c2576040517f874252b500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffff000000000000000000000000000000000000000000909116811774010000000000000000000000000000000000000000179091556040517f73f069d9129374dc8becc030b822edfd551de07458e25992e89e7bf50cd4a06390600090a273ffffffffffffffffffffffffffffffffffffffff81166000818152600a602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915590519092917f4a8bc871bc382f8f05aa4ee5015bd9d5eeafc8334ba96536b463dd2657a64f1591a3600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040517f2e5c9b2d1f2851a0e14220e58e1e816d1320fc05d2c89a5657bedc5a9943c20d90600090a25050565b6000610b3d848385611893565b949350505050565b600061077182600954610447600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b600080610b808361198e565b905080158015610b905750600083115b15610ba357610ba0600182612a78565b90505b610bae85338361158e565b610bba858585846119c6565b95945050505050565b600e5460095473ffffffffffffffffffffffffffffffffffffffff83166000908152600860205260408120549092610771927affffffffffffffffffffffffffffffffffffffffffffffffffffff90911690611893565b610c22611840565b610c2c6000611d07565b565b600e54600c5460009182917affffffffffffffffffffffffffffffffffffffffffffffffffffff9091169074010000000000000000000000000000000000000000900460ff1615610c825792600092509050565b600e547b01000000000000000000000000000000000000000000000000000000900464ffffffffff1664e8d4a510008214610dbd576000610ce37f0000000000000000000000000000000000000000000000000000000066702b9f42612a8b565b90506000610cf46205469083612acd565b610cff906002612ae1565b610d0b6012600a612a52565b610d19906301406f40612a61565b610d239190612acd565b90506002610d3661080a62054690612acd565b61080a610d466205469086612aed565b610d509190612acd565b610d5a9084612a61565b610d649190612acd565b610d6e9190612acd565b610d789082612a8b565b955064e8d4a51000861015610d905764e8d4a5100095505b612710610539610da08887612a8b565b610daa9190612a61565b610db49190612acd565b94505050610e41565b64e8d4a51000935062054690610dd38242612a8b565b1015610e205761271062054690610dea8342612a8b565b610dfb61053964e8d4a51000612a61565b610e059190612a61565b610e0f9190612acd565b610e199190612acd565b9250610e41565b612710610e3461053964e8d4a51000612a61565b610e3e9190612acd565b92505b50509091565b600061077182611d7e565b600060608060008060006060610e66611d89565b610e6e611db6565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b6000610796338484610ec586610b45565b6119c6565b6060600480546106da906128b0565b6000806000610ee6610fb1565b5073ffffffffffffffffffffffffffffffffffffffff86166000908152600860205260409020549193509150610b3d908383610b30565b610f25611840565b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f73f069d9129374dc8becc030b822edfd551de07458e25992e89e7bf50cd4a06390600090a250565b60003361076b81858561165d565b6107b761080a62054690612acd565b6000806000806009549050610fc4610c2e565b90935091506000838310610fe6575080610fdf600285612acd565b9250610fff565b610ffc83610ff48187612a8b565b849190611893565b90505b600061100b8383611de3565b965090508061104e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff955061104b6110448488612a8b565b8787610b30565b93505b505050909192565b6000610b3d848484611893565b600e5464ffffffffff4281167b01000000000000000000000000000000000000000000000000000000909204160361109757565b6000806110a2610c2e565b600c54919350915073ffffffffffffffffffffffffffffffffffffffff1681158015906110e4575073ffffffffffffffffffffffffffffffffffffffff811615155b156112df57600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff1661111284611e0c565b7affffffffffffffffffffffffffffffffffffffffffffffffffffff167b010000000000000000000000000000000000000000000000000000004264ffffffffff160217600e556009548484106111725761116d8382611e71565b611191565b6111918361118c86611184818a612a8b565b859190611893565b611e71565b6009546040805184815260208101889052808201849052606081019290925260808201869052517f9e58b170e0350f4db79237b74fbf8c29c7d19c7c09b71d0f0f8e9316334acaed9181900360a00190a173ffffffffffffffffffffffffffffffffffffffff83163b1561125a578273ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561124757600080fd5b505af1925050508015611258575060015b505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112c457600080fd5b505af11580156112d8573d6000803e3d6000fd5b5050505050505b505050565b6112ec611840565b73ffffffffffffffffffffffffffffffffffffffff82166000818152600a602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917f4a8bc871bc382f8f05aa4ee5015bd9d5eeafc8334ba96536b463dd2657a64f1591a35050565b834211156113ad576040517f62791302000000000000000000000000000000000000000000000000000000008152600481018590526024015b60405180910390fd5b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886114078c73ffffffffffffffffffffffffffffffffffffffff16600090815260076020526040902080546001810190915590565b60408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061146f82611f43565b9050600061147f82878787611f8b565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611506576040517f4b800e4600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80831660048301528b1660248201526044016113a4565b6115118a8a8a611581565b50505050505050505050565b611525611840565b73ffffffffffffffffffffffffffffffffffffffff8116611575576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b61157e81611d07565b50565b6112df8383836001611fb9565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146116575781811015611648576040517ffb8f41b200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101829052604481018390526064016113a4565b61165784848484036000611fb9565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166116ad576040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff82166116fd576040517fec442f05000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b6112df83838361201f565b60003073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000873259322be8e50d80a4b868d186cc5ab148543a1614801561176e57507f000000000000000000000000000000000000000000000000000000000000000146145b1561179857507f056968328b33e9747ca52c4d5ade6c62780d2f304a44ee137a4e053f9c60260990565b6107f3604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f6a59ea05b58ab2692f04374c421e73c97ad5093ed5eca10589182dcfb2331e70918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b600b5473ffffffffffffffffffffffffffffffffffffffff163314610c2c576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016113a4565b6000838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870982811083820303915050806000036118e8578382816118de576118de612a9e565b0492505050610796565b808411611921576040517f227bc15300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60006107716119b9600e547affffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b6009548491906001612033565b600073ffffffffffffffffffffffffffffffffffffffff8516611a2d576040517f96c6fd1e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff8416611a92576040517fec442f0500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260086020526040902054831115611b475773ffffffffffffffffffffffffffffffffffffffff85166000908152600860205260409020548590611af090610b45565b6040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604481018390526064016113a4565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600a602052604090205460ff16158015611ba3575073ffffffffffffffffffffffffffffffffffffffff84166000908152600a602052604090205460ff16155b8015611bbf5750336000908152600a602052604090205460ff16155b15611c1f573073ffffffffffffffffffffffffffffffffffffffff1663d0dc5c656040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611c0c57600080fd5b505af1925050508015611c1d575060015b505b73ffffffffffffffffffffffffffffffffffffffff851660009081526008602052604081208054859290611c54908490612a8b565b909155505073ffffffffffffffffffffffffffffffffffffffff841660009081526008602052604081208054859290611c8e908490612a78565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611cf491815260200190565b60405180910390a3506001949350505050565b600b805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061077182612082565b60606107f37f506f6e7a696f205468652043617400000000000000000000000000000000000e60056120ad565b60606107f37f310000000000000000000000000000000000000000000000000000000000000160066120ad565b60008083830184811015611dfe576000809250925050611e05565b6001925090505b9250929050565b60007affffffffffffffffffffffffffffffffffffffffffffffffffffff821115611e6d576040517f6dfcc65000000000000000000000000000000000000000000000000000000000815260d86004820152602481018390526044016113a4565b5090565b6009546000611e808284611de3565b50905080611f3957611ebb84611eb6847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff612a8b565b612158565b600c80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040517f628240a53f7ebe5375e91882d66546bf9e49d01336f63e6afcc71ff6b8cdfa2090611f2c9042815260200190565b60405180910390a1611657565b6116578484612158565b6000610771611f50611708565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b600080600080611f9d888888886121af565b925092509250611fad82826122a9565b50909695505050505050565b3073ffffffffffffffffffffffffffffffffffffffff1663d0dc5c656040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561200157600080fd5b505af1925050508015612012575060015b50611657848484846123b1565b611657838361202d846107ba565b846119c6565b600080612041868686611893565b905061204c836124f9565b801561206857506000848061206357612063612a9e565b868809115b15610bba57612078600182612a78565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260076020526040812054610771565b606060ff83146120c7576120c083612526565b9050610771565b8180546120d3906128b0565b80601f01602080910402602001604051908101604052809291908181526020018280546120ff906128b0565b801561214c5780601f106121215761010080835404028352916020019161214c565b820191906000526020600020905b81548152906001019060200180831161212f57829003601f168201915b50505050509050610771565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600860205260408120805483929061218d908490612a78565b9250508190555080600960008282546121a69190612a78565b90915550505050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156121ea575060009150600390508261229f565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa15801561223e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166122955750600092506001915082905061229f565b9250600091508190505b9450945094915050565b60008260038111156122bd576122bd612b01565b036122c6575050565b60018260038111156122da576122da612b01565b03612311576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600282600381111561232557612325612b01565b0361235f576040517ffce698f7000000000000000000000000000000000000000000000000000000008152600481018290526024016113a4565b600382600381111561237357612373612b01565b036123ad576040517fd78bce0c000000000000000000000000000000000000000000000000000000008152600481018290526024016113a4565b5050565b73ffffffffffffffffffffffffffffffffffffffff8416612401576040517fe602df05000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff8316612451576040517f94280d62000000000000000000000000000000000000000000000000000000008152600060048201526024016113a4565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526001602090815260408083209387168352929052208290558015611657578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516124eb91815260200190565b60405180910390a350505050565b6000600282600381111561250f5761250f612b01565b6125199190612b30565b60ff166001149050919050565b6060600061253383612565565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600060ff8216601f811115610771576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000815180845260005b818110156125cc576020818501810151868301820152016125b0565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061079660208301846125a6565b803573ffffffffffffffffffffffffffffffffffffffff8116811461264157600080fd5b919050565b6000806040838503121561265957600080fd5b6126628361261d565b946020939093013593505050565b60008060006060848603121561268557600080fd5b61268e8461261d565b925061269c6020850161261d565b9150604084013590509250925092565b6000602082840312156126be57600080fd5b5035919050565b6000602082840312156126d757600080fd5b6107968261261d565b600080604083850312156126f357600080fd5b6126fc8361261d565b915061270a6020840161261d565b90509250929050565b60008060006060848603121561272857600080fd5b505081359360208301359350604090920135919050565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e0602084015261277c60e084018a6125a6565b838103604085015261278e818a6125a6565b6060850189905273ffffffffffffffffffffffffffffffffffffffff8816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b818110156127ef578351835292840192918401916001016127d3565b50909c9b505050505050505050505050565b6000806040838503121561281457600080fd5b61281d8361261d565b91506020830135801515811461283257600080fd5b809150509250929050565b600080600080600080600060e0888a03121561285857600080fd5b6128618861261d565b965061286f6020890161261d565b95506040880135945060608801359350608088013560ff8116811461289357600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600181811c908216806128c457607f821691505b6020821081036128fd577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600181815b8085111561298b57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561297157612971612903565b8085161561297e57918102915b93841c9390800290612937565b509250929050565b6000826129a257506001610771565b816129af57506000610771565b81600181146129c557600281146129cf576129eb565b6001915050610771565b60ff8411156129e0576129e0612903565b50506001821b610771565b5060208310610133831016604e8410600b8410161715612a0e575081810a610771565b612a188383612932565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612a4a57612a4a612903565b029392505050565b600061079660ff841683612993565b808202811582820484141761077157610771612903565b8082018082111561077157610771612903565b8181038181111561077157610771612903565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082612adc57612adc612a9e565b500490565b60006107968383612993565b600082612afc57612afc612a9e565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600060ff831680612b4357612b43612a9e565b8060ff8416069150509291505056fea26469706673582212203a135a40b83fcb64cda657e8d6df5e37583789a108d820a8ea4f069fd5c11b1b64736f6c63430008190033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.