BscScan - Sponsored slots available. Book your slot here!
BEP-20
Source Code
Overview
Max Total Supply
200,000,000ERC20 ***
Holders
6,610
Market
Price
$0.00 @ 0.000000 BNB
Onchain Market Cap
-
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
87,268.255133588276995337 ERC20 ***Value
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x32DD32e5...9377Ff941 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
SSD
Compiler Version
v0.8.30+commit.73712a01
Optimization Enabled:
Yes with 200 runs
Other Settings:
prague EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import "./marketCap.sol";
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(
address owner,
address spender
) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
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);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string public _name;
string public _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_, uint tokenTotal_) {
_name = name_;
_symbol = symbol_;
_mint(msg.sender, tokenTotal_);
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override 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 value {ERC20} uses, unless this function is
* 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 override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(
address account
) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(
address owner,
address spender
) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` 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 amount
) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
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:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
uint256 currentAllowance = _allowances[sender][_msgSender()];
if (currentAllowance != type(uint256).max) {
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
}
_transfer(sender, recipient, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(
address spender,
uint256 addedValue
) public virtual returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender] + addedValue
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* 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.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` 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.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
// modifier onlyOwner() {
// require(owner() == _msgSender(), "Ownable: caller is not the owner");
// _;
// }
modifier onlyOwner() {
_onlyOwner();
_;
}
function _onlyOwner() internal {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Pair {
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 sync() external;
}
interface IUniswapV2Factory {
function createPair(
address tokenA,
address tokenB
) external returns (address pair);
}
interface IUniswapV2Router02 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract TokenReceiver {
constructor(address mos, address usdt) {
IERC20(mos).approve(msg.sender, type(uint256).max);
IERC20(usdt).approve(msg.sender, type(uint256).max);
}
}
contract SSD is ERC20, Ownable {
function safeTransferFrom(
address token,
address from,
address to,
uint value
) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0x23b872dd, from, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: TRANSFER_FROM_FAILED"
);
}
function safeApprove(address token, address to, uint value) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0x095ea7b3, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: APPROVE_FAILED"
);
}
IUniswapV2Router02 public uniswapV2Router;
mapping(address => bool) public ammPairs;
IUniswapV2Pair public uniswapV2Pair;
address public deadAddress = address(0xDead);
address public router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;
address public usdt = 0x55d398326f99059fF775485246999027B3197955;
address public mos = 0xc9C8050639c4cC0DF159E0e47020d6e392191407;
address public mosPair = 0xB51f9508B88F0868aE14E74C5D7d1F34E2f419c1;
address public treasury;
address public tokenReceiver;
address public marketCap;
bool public swapping;
uint256 public swapTokensAtAmount;
mapping(address => bool) public whiteList;
bool public isCurrencyToken0;
bool public tradingEnabled;
constructor() ERC20("SSDTOKEN", "SSD", 200000000e18) {
uniswapV2Router = IUniswapV2Router02(router);
swapTokensAtAmount = 1e18;
address pairAddress = IUniswapV2Factory(uniswapV2Router.factory())
.createPair(address(this), mos);
uniswapV2Pair = IUniswapV2Pair(pairAddress);
isCurrencyToken0 = uniswapV2Pair.token0() == mos;
ammPairs[pairAddress] = true;
_approve(address(this), router, type(uint256).max);
safeApprove(mos, router, type(uint256).max);
deadAddress = address(0xDead);
IERC20(usdt).approve(router, type(uint256).max);
tokenReceiver = address(new TokenReceiver(mos, usdt));
whiteList[owner()] = true;
}
function setMarketCap(address _marketCap) public onlyOwner {
marketCap = _marketCap;
treasury = MARKETCAP(marketCap).treasury();
}
function setWhiteList(address _addr, bool _enabled) external onlyOwner {
whiteList[_addr] = _enabled;
}
function setTradingEnabled(bool _tradingEnabled) external onlyOwner {
tradingEnabled = _tradingEnabled;
}
function _isAddLp() internal view returns (bool isAdd) {
(uint112 _reserve0, uint112 _reserve1, ) = uniswapV2Pair.getReserves();
uint currencyBalance = IERC20(mos).balanceOf(address(uniswapV2Pair));
if (isCurrencyToken0) {
isAdd = currencyBalance > _reserve0;
} else {
isAdd = currencyBalance > _reserve1;
}
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal override {
if (recipient == marketCap || sender == marketCap) {
super._transfer(sender, recipient, amount);
return;
}
if (!tradingEnabled) {
if (whiteList[sender]) {
super._transfer(sender, recipient, amount);
return;
}
require(false, "trading Error");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
bool isAdd = !swapping && ammPairs[recipient] && _isAddLp();
if (canSwap && !isAdd && !swapping && !ammPairs[sender]) {
swapping = true;
swapAndLiquify(contractTokenBalance);
swapping = false;
}
if (!swapping && ammPairs[recipient] && !isAdd) {
uint totalFee = (amount * 3) / 100;
amount -= totalFee;
super._transfer(sender, address(this), totalFee);
}
super._transfer(sender, recipient, amount);
}
function swapAndLiquify(uint256 tokens) private {
uint value = tokens / 3;
swapTokensForEth(value, mos, treasury);
uint toSubValue = (tokens - value);
uint256 half = toSubValue / 2;
uint256 otherHalf = toSubValue - half;
swapTokensForEth(half, mos, tokenReceiver);
swapTokensForEth(otherHalf / 2, usdt, tokenReceiver);
uint mosBalance = IERC20(mos).balanceOf(address(this));
uint usdtBalance = IERC20(usdt).balanceOf(address(this));
addLiquidity(mos, usdt, mosBalance / 2, usdtBalance);
addLiquidity(address(this), mos, otherHalf / 2, mosBalance / 2);
usdtBalance = IERC20(usdt).balanceOf(address(this));
if (usdtBalance > 0) {
IERC20(usdt).transfer(deadAddress, usdtBalance);
}
mosBalance = IERC20(mos).balanceOf(address(this));
if (mosBalance > 0) {
IERC20(mos).transfer(deadAddress, mosBalance);
}
}
function swapTokensForEth(
uint256 tokenAmount,
address tokenType,
address _tokenReceiver
) private {
if (tokenType == mos) {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = address(mos);
uniswapV2Router
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
_tokenReceiver,
block.timestamp + 100
);
if (_tokenReceiver == treasury) {
return;
}
safeTransferFrom(
address(mos),
_tokenReceiver,
address(this),
IERC20(mos).balanceOf(tokenReceiver)
);
} else if (tokenType == usdt) {
address[] memory path = new address[](3);
path[0] = address(this);
path[1] = mos;
path[2] = usdt;
uniswapV2Router
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
_tokenReceiver,
block.timestamp + 100
);
safeTransferFrom(
address(usdt),
_tokenReceiver,
address(this),
IERC20(usdt).balanceOf(_tokenReceiver)
);
}
}
function addLiquidity(
address tokenA,
address tokenB,
uint256 tokenAmount,
uint256 ethAmount
) private {
uniswapV2Router.addLiquidity(
tokenA,
tokenB,
tokenAmount,
ethAmount,
0,
0,
deadAddress,
block.timestamp + 10
);
}
}pragma solidity ^0.8.30;
import {IROUTE} from "./interface/IROUTE.sol";
import {ITOKEN} from "./interface/IToken.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
contract TREASURY {
address public owner = address(0xDead);
constructor(address _marketCap, address _mos, address _ssd) {
ITOKEN(_mos).approve(_marketCap, type(uint256).max);
ITOKEN(_ssd).approve(_marketCap, type(uint256).max);
}
}
contract MARKETCAP {
using Math for uint256;
address public owner;
address public ssd;
address constant mos = 0xc9C8050639c4cC0DF159E0e47020d6e392191407;
address constant mosPair = 0xB51f9508B88F0868aE14E74C5D7d1F34E2f419c1;
address public ssdPair;
address public deadAddress = address(0xDead);
uint public marketPrice;
uint public tradeTime;
uint public buySsdTotalAmount;
uint public sellSsdTotalAmount;
uint public sellSsdToCount;
uint public buySsdToCount;
uint public addSSDLPTotalAmount;
uint public periodTime = 3 days;
address public treasury;
bool private _locked;
mapping(address => bool) private tradeAddress;
IROUTE constant route = IROUTE(0x10ED43C718714eb63d5aA57B78B54704E256024E);
constructor(address _ssd) {
owner = msg.sender;
ssd = _ssd;
ITOKEN(ssd).approve(address(route), type(uint).max);
treasury = address(new TREASURY(address(this), mos, ssd));
ITOKEN(mos).approve(address(route), type(uint).max);
ssdPair = ITOKEN(ssd).uniswapV2Pair();
}
function isTrade() external view returns (bool) {
address[] memory path = new address[](2);
path[0] = ssd;
path[1] = mos;
uint _now = block.timestamp;
uint priceM = getPrice(mos);
uint priceS = getPrice(ssd);
uint currentPrice = (priceS * priceM) / 1e18;
if (tradeTime == 0) {
return false;
}
if (_now - tradeTime >= periodTime) {
return true;
}
uint price = marketPrice + (marketPrice * 5) / 100;
if (currentPrice >= price) {
return true;
}
price = marketPrice - (marketPrice * 5) / 100;
if (currentPrice <= price) {
return true;
}
return false;
}
function trade() external nonReentrant returns (bool) {
require(tradeAddress[msg.sender], "only address");
uint _now = block.timestamp;
uint priceM = getPrice(mos);
uint priceS = getPrice(ssd);
uint currentPrice = (priceS * priceM) / 1e18;
uint temp;
if (tradeTime == 0) {
tradeTime = _now;
marketPrice = currentPrice;
return true;
} else if (_now - tradeTime >= periodTime) {
tradeTime = _now;
marketPrice = currentPrice;
return true;
}
uint price = marketPrice + (marketPrice * 5) / 100;
if (currentPrice >= price) {
uint targetPrice = marketPrice + (marketPrice * 3) / 100;
uint mintAmount = computerSsd(targetPrice);
if (mintAmount == 0) {
return false;
}
uint toSSDLp = (mintAmount * 125) / 1000;
address[] memory path = new address[](2);
path[0] = ssd;
path[1] = mos;
swap(path, toSSDLp);
uint amount = ITOKEN(mos).balanceOf(address(this));
uint liquidity = liquify(ssd, mos, toSSDLp, amount);
addSSDLPTotalAmount += liquidity;
sellSsdTotalAmount += mintAmount;
sellSsdToCount++;
temp = mintAmount - toSSDLp - toSSDLp;
swap(path, temp);
temp = ITOKEN(mos).balanceOf(address(this));
ITOKEN(mos).transfer(treasury, temp);
return true;
}
price = marketPrice - (marketPrice * 5) / 100;
if (currentPrice <= price) {
uint targetPrice = (marketPrice * 97) / 100;
uint amount = computerSsd(targetPrice);
return true;
}
return false;
}
function getPrice(address token) private view returns (uint) {
require(token == mos || token == ssd, "Invalid token");
if (token == mos) {
address token0 = ITOKEN(mosPair).token0();
(uint112 reserve0, uint112 reserve1, ) = ITOKEN(mosPair)
.getReserves();
if (token0 == mos) {
return (uint(reserve1) * 1e18) / uint(reserve0);
} else {
return (uint(reserve0) * 1e18) / uint(reserve1);
}
} else if (token == ssd) {
address token0 = ITOKEN(ssdPair).token0();
(uint112 reserve0, uint112 reserve1, ) = ITOKEN(ssdPair)
.getReserves();
if (token0 == ssd) {
return (uint(reserve1) * 1e18) / uint(reserve0);
} else {
return (uint(reserve0) * 1e18) / uint(reserve1);
}
}
}
function computerSsd(uint _targetPrice) private returns (uint) {
uint res0;
uint res1;
uint targetPrice = _targetPrice;
uint Pm = getPrice(mos);
(res0, res1, ) = ITOKEN(ssdPair).getReserves();
address token0 = ITOKEN(ssdPair).token0();
if (token0 == ssd) {
uint temp = res0;
res0 = res1;
res1 = temp;
}
uint value = ((res0 * res1 * 1000000) / ((_targetPrice * 1000000) / Pm))
.sqrt();
if (value >= res1) {
value = value - res1;
uint temp = value;
value = (temp * 106666666666667) / 1e14;
uint halfValue = value / 2;
uint balance = ITOKEN(ssd).balanceOf(treasury);
if (balance >= halfValue) {
address[] memory path = new address[](2);
path[0] = ssd;
path[1] = mos;
ITOKEN(ssd).transferFrom(treasury, address(this), halfValue);
swap(path, halfValue);
return value / 2;
}
value = (temp * 11428571428571) / 1e13;
return value;
} else {
address[] memory path = new address[](2);
path[0] = mos;
path[1] = ssd;
value = (res0 * res1) / value;
value = value - res0;
uint balance = ITOKEN(mos).balanceOf(treasury);
if (balance <= 0) {
return 0;
}
balance = balance >= value ? value : balance;
ITOKEN(mos).transferFrom(treasury, address(this), balance);
uint temp = ITOKEN(ssd).balanceOf(address(this));
buySsdTotalAmount += balance;
buySsdToCount++;
swap(path, balance);
uint temp1 = ITOKEN(ssd).balanceOf(address(this));
temp = temp1 - temp;
ITOKEN(ssd).transfer(treasury, temp);
return 0;
}
}
function swap(address[] memory path, uint tokenAmount) private {
route.swapExactTokensForTokensSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp + 10
);
}
function liquify(
address tokenA,
address tokenB,
uint amountA,
uint amountB
) private returns (uint liquidity) {
(, , uint liquidity) = route.addLiquidity(
tokenA,
tokenB,
amountA,
amountB,
0,
0,
deadAddress,
block.timestamp
);
return liquidity;
}
function setTime(uint _time) external onlyOwner {
periodTime = _time;
}
function setTradeAddress(address _addr) public {
require(msg.sender == owner, "only owner");
tradeAddress[_addr] = true;
}
modifier onlyOwner() {
require(msg.sender == owner, "only owner");
_;
}
modifier nonReentrant() {
require(!_locked, "ReentrancyGuard: reentrant call");
_locked = true;
_;
_locked = false;
}
function transferOwnership(address _newOwner) external onlyOwner {
owner = _newOwner;
}
}pragma solidity >=0.8.30;
interface IROUTE {
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function getAmountsOut(
uint amountIn,
address[] memory path
) external view returns (uint[] memory amounts);
function quote(
uint amountA,
uint reserveA,
uint reserveB
) external pure returns (uint amountB);
}pragma solidity ^0.8.30;
interface ITOKEN {
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function uniswapV2Pair() external view returns (address);
function mosPair() external view returns (address);
function getReserves()
external
view
returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function token0() external view returns (address);
function token1() external view returns (address);
function marketCapMint(uint256 amount) external;
function setMarketCapEnabled(bool _marketCapEnabled) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Return the 512-bit addition of two uint256.
*
* The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.
*/
function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
assembly ("memory-safe") {
low := add(a, b)
high := lt(low, a)
}
}
/**
* @dev Return the 512-bit multiplication of two uint256.
*
* The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.
*/
function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
// 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use
// the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = high * 2²⁵⁶ + low.
assembly ("memory-safe") {
let mm := mulmod(a, b, not(0))
low := mul(a, b)
high := sub(sub(mm, low), lt(mm, low))
}
}
/**
* @dev Returns the addition of two unsigned integers, with a success flag (no overflow).
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
success = c >= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a - b;
success = c <= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a * b;
assembly ("memory-safe") {
// Only true when the multiplication doesn't overflow
// (c / a == b) || (a == 0)
success := or(eq(div(c, a), b), iszero(a))
}
// equivalent to: success ? c : 0
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the division of two unsigned integers, with a success flag (no division by zero).
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `DIV` opcode returns zero when the denominator is 0.
result := div(a, b)
}
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `MOD` opcode returns zero when the denominator is 0.
result := mod(a, b)
}
}
}
/**
* @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryAdd(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.
*/
function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {
(, uint256 result) = trySub(a, b);
return result;
}
/**
* @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryMul(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute
* one branch when needed, making this function more expensive.
*/
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
// branchless ternary works because:
// b ^ (a ^ b) == a
// b ^ 0 == b
return b ^ ((a ^ b) * SafeCast.toUint(condition));
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a > b, a, b);
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(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.
Panic.panic(Panic.DIVISION_BY_ZERO);
}
// The following calculation ensures accurate ceiling division without overflow.
// Since a is non-zero, (a - 1) / b will not overflow.
// The largest possible result occurs when (a - 1) / b is type(uint256).max,
// but the largest value we can obtain is type(uint256).max - 1, which happens
// when a = type(uint256).max and b = 1.
unchecked {
return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
}
}
/**
* @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
*
* 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 {
(uint256 high, uint256 low) = mul512(x, y);
// Handle non-overflow cases, 256 by 256 division.
if (high == 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 low / denominator;
}
// Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
if (denominator <= high) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [high low].
uint256 remainder;
assembly ("memory-safe") {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
high := sub(high, gt(remainder, low))
low := sub(low, 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 ("memory-safe") {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [high low] by twos.
low := div(low, twos)
// Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from high into low.
low |= high * twos;
// Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
// that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv ≡ 1 mod 2⁴.
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⁸
inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
inverse *= 2 - denominator * inverse; // inverse mod 2³²
inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶
// 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²⁵⁶. Since the preconditions guarantee that the outcome is
// less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high
// is no longer required.
result = low * inverse;
return result;
}
}
/**
* @dev 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) {
return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
}
/**
* @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.
*/
function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {
unchecked {
(uint256 high, uint256 low) = mul512(x, y);
if (high >= 1 << n) {
Panic.panic(Panic.UNDER_OVERFLOW);
}
return (high << (256 - n)) | (low >> n);
}
}
/**
* @dev Calculates x * y >> n with full precision, following the selected rounding direction.
*/
function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {
return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);
}
/**
* @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
*
* If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
* If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
*
* If the input value is not inversible, 0 is returned.
*
* NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
* inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
*/
function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
unchecked {
if (n == 0) return 0;
// The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
// Used to compute integers x and y such that: ax + ny = gcd(a, n).
// When the gcd is 1, then the inverse of a modulo n exists and it's x.
// ax + ny = 1
// ax = 1 + (-y)n
// ax ≡ 1 (mod n) # x is the inverse of a modulo n
// If the remainder is 0 the gcd is n right away.
uint256 remainder = a % n;
uint256 gcd = n;
// Therefore the initial coefficients are:
// ax + ny = gcd(a, n) = n
// 0a + 1n = n
int256 x = 0;
int256 y = 1;
while (remainder != 0) {
uint256 quotient = gcd / remainder;
(gcd, remainder) = (
// The old remainder is the next gcd to try.
remainder,
// Compute the next remainder.
// Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
// where gcd is at most n (capped to type(uint256).max)
gcd - remainder * quotient
);
(x, y) = (
// Increment the coefficient of a.
y,
// Decrement the coefficient of n.
// Can overflow, but the result is casted to uint256 so that the
// next value of y is "wrapped around" to a value between 0 and n - 1.
x - y * int256(quotient)
);
}
if (gcd != 1) return 0; // No inverse exists.
return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
}
}
/**
* @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
*
* From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
* prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
* `a**(p-2)` is the modular multiplicative inverse of a in Fp.
*
* NOTE: this function does NOT check that `p` is a prime greater than `2`.
*/
function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
unchecked {
return Math.modExp(a, p - 2, p);
}
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
*
* Requirements:
* - modulus can't be zero
* - underlying staticcall to precompile must succeed
*
* IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
* sure the chain you're using it on supports the precompiled contract for modular exponentiation
* at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
* the underlying function will succeed given the lack of a revert, but the result may be incorrectly
* interpreted as 0.
*/
function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
(bool success, uint256 result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
* It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
* to operate modulo 0 or if the underlying precompile reverted.
*
* IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
* you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
* https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
* of a revert, but the result may be incorrectly interpreted as 0.
*/
function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
if (m == 0) return (false, 0);
assembly ("memory-safe") {
let ptr := mload(0x40)
// | Offset | Content | Content (Hex) |
// |-----------|------------|--------------------------------------------------------------------|
// | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x60:0x7f | value of b | 0x<.............................................................b> |
// | 0x80:0x9f | value of e | 0x<.............................................................e> |
// | 0xa0:0xbf | value of m | 0x<.............................................................m> |
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), b)
mstore(add(ptr, 0x80), e)
mstore(add(ptr, 0xa0), m)
// Given the result < m, it's guaranteed to fit in 32 bytes,
// so we can use the memory scratch space located at offset 0.
success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
result := mload(0x00)
}
}
/**
* @dev Variant of {modExp} that supports inputs of arbitrary length.
*/
function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
(bool success, bytes memory result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Variant of {tryModExp} that supports inputs of arbitrary length.
*/
function tryModExp(
bytes memory b,
bytes memory e,
bytes memory m
) internal view returns (bool success, bytes memory result) {
if (_zeroBytes(m)) return (false, new bytes(0));
uint256 mLen = m.length;
// Encode call args in result and move the free memory pointer
result = abi.encodePacked(b.length, e.length, mLen, b, e, m);
assembly ("memory-safe") {
let dataPtr := add(result, 0x20)
// Write result on top of args to avoid allocating extra memory.
success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
// Overwrite the length.
// result.length > returndatasize() is guaranteed because returndatasize() == m.length
mstore(result, mLen)
// Set the memory pointer after the returned data.
mstore(0x40, add(dataPtr, mLen))
}
}
/**
* @dev Returns whether the provided byte array is zero.
*/
function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
for (uint256 i = 0; i < byteArray.length; ++i) {
if (byteArray[i] != 0) {
return false;
}
}
return true;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* This method is based on Newton's method for computing square roots; the algorithm is restricted to only
* using integer operations.
*/
function sqrt(uint256 a) internal pure returns (uint256) {
unchecked {
// Take care of easy edge cases when a == 0 or a == 1
if (a <= 1) {
return a;
}
// In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
// sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
// the current value as `ε_n = | x_n - sqrt(a) |`.
//
// For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
// of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
// bigger than any uint256.
//
// By noticing that
// `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
// we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
// to the msb function.
uint256 aa = a;
uint256 xn = 1;
if (aa >= (1 << 128)) {
aa >>= 128;
xn <<= 64;
}
if (aa >= (1 << 64)) {
aa >>= 64;
xn <<= 32;
}
if (aa >= (1 << 32)) {
aa >>= 32;
xn <<= 16;
}
if (aa >= (1 << 16)) {
aa >>= 16;
xn <<= 8;
}
if (aa >= (1 << 8)) {
aa >>= 8;
xn <<= 4;
}
if (aa >= (1 << 4)) {
aa >>= 4;
xn <<= 2;
}
if (aa >= (1 << 2)) {
xn <<= 1;
}
// We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
//
// We can refine our estimation by noticing that the middle of that interval minimizes the error.
// If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
// This is going to be our x_0 (and ε_0)
xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)
// From here, Newton's method give us:
// x_{n+1} = (x_n + a / x_n) / 2
//
// One should note that:
// x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
// = ((x_n² + a) / (2 * x_n))² - a
// = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
// = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
// = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
// = (x_n² - a)² / (2 * x_n)²
// = ((x_n² - a) / (2 * x_n))²
// ≥ 0
// Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
//
// This gives us the proof of quadratic convergence of the sequence:
// ε_{n+1} = | x_{n+1} - sqrt(a) |
// = | (x_n + a / x_n) / 2 - sqrt(a) |
// = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
// = | (x_n - sqrt(a))² / (2 * x_n) |
// = | ε_n² / (2 * x_n) |
// = ε_n² / | (2 * x_n) |
//
// For the first iteration, we have a special case where x_0 is known:
// ε_1 = ε_0² / | (2 * x_0) |
// ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
// ≤ 2**(2*e-4) / (3 * 2**(e-1))
// ≤ 2**(e-3) / 3
// ≤ 2**(e-3-log2(3))
// ≤ 2**(e-4.5)
//
// For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
// ε_{n+1} = ε_n² / | (2 * x_n) |
// ≤ (2**(e-k))² / (2 * 2**(e-1))
// ≤ 2**(2*e-2*k) / 2**e
// ≤ 2**(e-2*k)
xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above
xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5
xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9
xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18
xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36
xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72
// Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
// ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
// sqrt(a) or sqrt(a) + 1.
return xn - SafeCast.toUint(xn > a / xn);
}
}
/**
* @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// If upper 8 bits of 16-bit half set, add 8 to result
r |= SafeCast.toUint((x >> r) > 0xff) << 3;
// If upper 4 bits of 8-bit half set, add 4 to result
r |= SafeCast.toUint((x >> r) > 0xf) << 2;
// Shifts value right by the current result and use it as an index into this lookup table:
//
// | x (4 bits) | index | table[index] = MSB position |
// |------------|---------|-----------------------------|
// | 0000 | 0 | table[0] = 0 |
// | 0001 | 1 | table[1] = 0 |
// | 0010 | 2 | table[2] = 1 |
// | 0011 | 3 | table[3] = 1 |
// | 0100 | 4 | table[4] = 2 |
// | 0101 | 5 | table[5] = 2 |
// | 0110 | 6 | table[6] = 2 |
// | 0111 | 7 | table[7] = 2 |
// | 1000 | 8 | table[8] = 3 |
// | 1001 | 9 | table[9] = 3 |
// | 1010 | 10 | table[10] = 3 |
// | 1011 | 11 | table[11] = 3 |
// | 1100 | 12 | table[12] = 3 |
// | 1101 | 13 | table[13] = 3 |
// | 1110 | 14 | table[14] = 3 |
// | 1111 | 15 | table[15] = 3 |
//
// The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.
assembly ("memory-safe") {
r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))
}
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
}
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
}
}
/**
* @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 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8
return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
}
}
/**
* @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;
}
/**
* @dev Counts the number of leading zero bits in a uint256.
*/
function clz(uint256 x) internal pure returns (uint256) {
return ternary(x == 0, 256, 255 - log2(x));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
pragma solidity ^0.8.20;
/**
* @dev Helper library for emitting standardized panic codes.
*
* ```solidity
* contract Example {
* using Panic for uint256;
*
* // Use any of the declared internal constants
* function foo() { Panic.GENERIC.panic(); }
*
* // Alternatively
* function foo() { Panic.panic(Panic.GENERIC); }
* }
* ```
*
* Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
*
* _Available since v5.1._
*/
// slither-disable-next-line unused-state
library Panic {
/// @dev generic / unspecified error
uint256 internal constant GENERIC = 0x00;
/// @dev used by the assert() builtin
uint256 internal constant ASSERT = 0x01;
/// @dev arithmetic underflow or overflow
uint256 internal constant UNDER_OVERFLOW = 0x11;
/// @dev division or modulo by zero
uint256 internal constant DIVISION_BY_ZERO = 0x12;
/// @dev enum conversion error
uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
/// @dev invalid encoding in storage
uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
/// @dev empty array pop
uint256 internal constant EMPTY_ARRAY_POP = 0x31;
/// @dev array out of bounds access
uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
/// @dev resource error (too large allocation or too large array)
uint256 internal constant RESOURCE_ERROR = 0x41;
/// @dev calling invalid internal function
uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;
/// @dev Reverts with a panic code. Recommended to use with
/// the internal constants with predefined codes.
function panic(uint256 code) internal pure {
assembly ("memory-safe") {
mstore(0x00, 0x4e487b71)
mstore(0x20, code)
revert(0x1c, 0x24)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.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/bool 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);
}
/**
* @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
*/
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/openzeppelin-contracts/lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "prague",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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"},{"inputs":[],"name":"_name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"","type":"address"}],"name":"ammPairs","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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":"deadAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isCurrencyToken0","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketCap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mos","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mosPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_marketCap","type":"address"}],"name":"setMarketCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_tradingEnabled","type":"bool"}],"name":"setTradingEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapTokensAtAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapping","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","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":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Pair","outputs":[{"internalType":"contract IUniswapV2Pair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whiteList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
0x6080604052600980546001600160a01b031990811661dead17909155600a805482167310ed43c718714eb63d5aa57b78b54704e256024e179055600b805482167355d398326f99059ff775485246999027b3197955179055600c8054821673c9c8050639c4cc0df159e0e47020d6e392191407179055600d805490911673b51f9508b88f0868ae14e74c5d7d1f34e2f419c117905534801561009f575f5ffd5b506040518060400160405280600881526020016729a9a22a27a5a2a760c11b8152506040518060400160405280600381526020016214d4d160ea1b8152506aa56fa5b99019a5c800000082600390816100f89190610840565b5060046101058382610840565b50610110338261042f565b50505061012961012461051060201b60201c565b610514565b600a54600680546001600160a01b0319166001600160a01b039092169182179055670de0b6b3a76400006011556040805163c45a015560e01b815290515f929163c45a01559160048281019260209291908290030181865afa158015610191573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101b591906108fa565b600c546040516364e329cb60e11b81523060048201526001600160a01b03918216602482015291169063c9c65396906044016020604051808303815f875af1158015610203573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061022791906108fa565b600880546001600160a01b0319166001600160a01b03838116918217909255600c5460408051630dfe168160e01b815290519495509216929091630dfe16819160048083019260209291908290030181865afa158015610289573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ad91906108fa565b601380546001600160a01b039283169390931460ff199384161790558281165f9081526007602052604090208054909216600117909155600a546102f5913091165f19610565565b600c54600a54610313916001600160a01b0390811691165f19610688565b600980546001600160a01b03191661dead179055600b54600a5460405163095ea7b360e01b81526001600160a01b0391821660048201525f19602482015291169063095ea7b3906044016020604051808303815f875af1158015610379573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061039d9190610927565b50600c54600b546040516001600160a01b0392831692909116906103c0906107a3565b6001600160a01b03928316815291166020820152604001604051809103905ff0801580156103f0573d5f5f3e3d5ffd5b50600f80546001600160a01b0319166001600160a01b03928316179055600554165f908152601260205260409020805460ff1916600117905550610981565b6001600160a01b03821661048a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064015b60405180910390fd5b8060025f82825461049b9190610946565b90915550506001600160a01b0382165f90815260208190526040812080548392906104c7908490610946565b90915550506040518181526001600160a01b038316905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b0383166105c75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610481565b6001600160a01b0382166106285760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610481565b6001600160a01b038381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b17905291515f928392908716916106e3919061096b565b5f604051808303815f865af19150503d805f811461071c576040519150601f19603f3d011682016040523d82523d5f602084013e610721565b606091505b509150915081801561074b57508051158061074b57508080602001905181019061074b9190610927565b6107975760405162461bcd60e51b815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c454400006044820152606401610481565b5050505050565b505050565b6101cf806125e983390190565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806107d857607f821691505b6020821081036107f657634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561079e57805f5260205f20601f840160051c810160208510156108215750805b601f840160051c820191505b81811015610797575f815560010161082d565b81516001600160401b03811115610859576108596107b0565b61086d8161086784546107c4565b846107fc565b6020601f82116001811461089f575f83156108885750848201515b5f19600385901b1c1916600184901b178455610797565b5f84815260208120601f198516915b828110156108ce57878501518255602094850194600190920191016108ae565b50848210156108eb57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f6020828403121561090a575f5ffd5b81516001600160a01b0381168114610920575f5ffd5b9392505050565b5f60208284031215610937575f5ffd5b81518015158114610920575f5ffd5b8082018082111561096557634e487b7160e01b5f52601160045260245ffd5b92915050565b5f82518060208501845e5f920191825250919050565b611c5b8061098e5f395ff3fe608060405234801561000f575f5ffd5b5060043610610208575f3560e01c806370a082311161011f578063aa59ac7f116100a9578063dd62ed3e11610079578063dd62ed3e14610471578063e140e428146104a9578063e2f45605146104bc578063f2fde38b146104c5578063f887ea40146104d8575f5ffd5b8063aa59ac7f1461043b578063b09f12661461044e578063c2e5ec0414610456578063d28d885214610469575f5ffd5b806395d89b41116100ef57806395d89b41146103d8578063a3e295bc146103e0578063a457c2d7146103f3578063a72905a214610406578063a9059cbb14610428575f5ffd5b806370a0823114610382578063715018a6146103aa5780638d14e127146103b45780638da5cb5b146103c7575f5ffd5b806327c8f835116101a0578063372c12b111610170578063372c12b114610315578063395093511461033757806349bd5a5e1461034a5780634ada218b1461035d57806361d027b31461036f575f5ffd5b806327c8f835146102cd5780632c135b93146102e05780632f48ab7d146102f3578063313ce56714610306575f5ffd5b80631694505e116101db5780631694505e146102815780631732cded1461029457806318160ddd146102a857806323b872dd146102ba575f5ffd5b8063038eeaa41461020c57806306fdde031461022e578063095ea7b3146102435780631528dd7714610256575b5f5ffd5b6013546102199060ff1681565b60405190151581526020015b60405180910390f35b6102366104eb565b60405161022591906118a6565b6102196102513660046118ef565b61057b565b600c54610269906001600160a01b031681565b6040516001600160a01b039091168152602001610225565b600654610269906001600160a01b031681565b60105461021990600160a01b900460ff1681565b6002545b604051908152602001610225565b6102196102c8366004611919565b610591565b600954610269906001600160a01b031681565b601054610269906001600160a01b031681565b600b54610269906001600160a01b031681565b60405160128152602001610225565b610219610323366004611957565b60126020525f908152604090205460ff1681565b6102196103453660046118ef565b610645565b600854610269906001600160a01b031681565b60135461021990610100900460ff1681565b600e54610269906001600160a01b031681565b6102ac610390366004611957565b6001600160a01b03165f9081526020819052604090205490565b6103b2610680565b005b6103b26103c2366004611986565b610693565b6005546001600160a01b0316610269565b6102366106c5565b600f54610269906001600160a01b031681565b6102196104013660046118ef565b6106d4565b610219610414366004611957565b60076020525f908152604090205460ff1681565b6102196104363660046118ef565b61076c565b6103b2610449366004611957565b610778565b61023661081e565b6103b26104643660046119bd565b6108aa565b6102366108cc565b6102ac61047f3660046119d8565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b600d54610269906001600160a01b031681565b6102ac60115481565b6103b26104d3366004611957565b6108d9565b600a54610269906001600160a01b031681565b6060600380546104fa90611a04565b80601f016020809104026020016040519081016040528092919081815260200182805461052690611a04565b80156105715780601f1061054857610100808354040283529160200191610571565b820191905f5260205f20905b81548152906001019060200180831161055457829003601f168201915b5050505050905090565b5f610587338484610952565b5060015b92915050565b6001600160a01b0383165f9081526001602090815260408083203384529091528120545f19811461062f57828110156106225760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61062f8533858403610952565b61063a858585610a75565b506001949350505050565b335f8181526001602090815260408083206001600160a01b0387168452909152812054909161058791859061067b908690611a50565b610952565b610688610c7a565b6106915f610cd4565b565b61069b610c7a565b6001600160a01b03919091165f908152601260205260409020805460ff1916911515919091179055565b6060600480546104fa90611a04565b335f9081526001602090815260408083206001600160a01b0386168452909152812054828110156107555760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610619565b6107623385858403610952565b5060019392505050565b5f610587338484610a75565b610780610c7a565b601080546001600160a01b0319166001600160a01b038316908117909155604080516361d027b360e01b815290516361d027b3916004808201926020929091908290030181865afa1580156107d7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107fb9190611a63565b600e80546001600160a01b0319166001600160a01b039290921691909117905550565b6004805461082b90611a04565b80601f016020809104026020016040519081016040528092919081815260200182805461085790611a04565b80156108a25780601f10610879576101008083540402835291602001916108a2565b820191905f5260205f20905b81548152906001019060200180831161088557829003601f168201915b505050505081565b6108b2610c7a565b601380549115156101000261ff0019909216919091179055565b6003805461082b90611a04565b6108e1610c7a565b6001600160a01b0381166109465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610619565b61094f81610cd4565b50565b6001600160a01b0383166109b45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610619565b6001600160a01b038216610a155760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610619565b6001600160a01b038381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6010546001600160a01b0383811691161480610a9e57506010546001600160a01b038481169116145b15610ab357610aae838383610d25565b505050565b601354610100900460ff16610b25576001600160a01b0383165f9081526012602052604090205460ff1615610aed57610aae838383610d25565b60405162461bcd60e51b815260206004820152600d60248201526c3a3930b234b7339022b93937b960991b6044820152606401610619565b305f9081526020819052604081205460115460105491929083101591600160a01b900460ff16158015610b6f57506001600160a01b0385165f9081526007602052604090205460ff165b8015610b7e5750610b7e610ef3565b9050818015610b8b575080155b8015610ba15750601054600160a01b900460ff16155b8015610bc557506001600160a01b0386165f9081526007602052604090205460ff16155b15610bf4576010805460ff60a01b1916600160a01b179055610be683611017565b6010805460ff60a01b191690555b601054600160a01b900460ff16158015610c2557506001600160a01b0385165f9081526007602052604090205460ff165b8015610c2f575080155b15610c67575f6064610c42866003611a7e565b610c4c9190611a95565b9050610c588186611ab4565b9450610c65873083610d25565b505b610c72868686610d25565b505050505050565b6005546001600160a01b031633146106915760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610619565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b038316610d895760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610619565b6001600160a01b038216610deb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610619565b6001600160a01b0383165f9081526020819052604090205481811015610e625760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610619565b6001600160a01b038085165f90815260208190526040808220858503905591851681529081208054849290610e98908490611a50565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ee491815260200190565b60405180910390a35b50505050565b5f5f5f60085f9054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610f46573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f6a9190611ae2565b50600c546008546040516370a0823160e01b81526001600160a01b0391821660048201529395509193505f929116906370a0823190602401602060405180830381865afa158015610fbd573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fe19190611b2e565b60135490915060ff161561100257826001600160701b031681119350611011565b816001600160701b0316811193505b50505090565b5f611023600383611a95565b600c54600e549192506110449183916001600160a01b0390811691166113bf565b5f61104f8284611ab4565b90505f61105d600283611a95565b90505f61106a8284611ab4565b600c54600f5491925061108b9184916001600160a01b0390811691166113bf565b6110b1611099600283611a95565b600b54600f546001600160a01b0391821691166113bf565b600c546040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa1580156110f7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061111b9190611b2e565b600b546040516370a0823160e01b81523060048201529192505f916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611166573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061118a9190611b2e565b600c54600b549192506111b5916001600160a01b0391821691166111af600286611a95565b846116b6565b600c546111e29030906001600160a01b03166111d2600287611a95565b6111dd600287611a95565b6116b6565b600b546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611228573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061124c9190611b2e565b905080156112cc57600b5460095460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb906044016020604051808303815f875af11580156112a6573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112ca9190611b45565b505b600c546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611312573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113369190611b2e565b915081156113b657600c5460095460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810185905291169063a9059cbb906044016020604051808303815f875af1158015611390573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113b49190611b45565b505b50505050505050565b600c546001600160a01b0390811690831603611552576040805160028082526060820183525f9260208301908036833701905050905030815f8151811061140857611408611b60565b6001600160a01b039283166020918202929092010152600c5482519116908290600190811061143957611439611b60565b6001600160a01b03928316602091820292909201015260065416635c11d795855f8486611467426064611a50565b6040518663ffffffff1660e01b8152600401611487959493929190611b74565b5f604051808303815f87803b15801561149e575f5ffd5b505af11580156114b0573d5f5f3e3d5ffd5b5050600e546001600160a01b039081169085160391506114d290505750505050565b600c54600f546040516370a0823160e01b81526001600160a01b039182166004820152610eed9291909116908490309083906370a08231906024015b602060405180830381865afa158015611529573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061154d9190611b2e565b611783565b600b546001600160a01b0390811690831603610aae57604080516003808252608082019092525f916020820160608036833701905050905030815f8151811061159d5761159d611b60565b6001600160a01b039283166020918202929092010152600c548251911690829060019081106115ce576115ce611b60565b6001600160a01b039283166020918202929092010152600b548251911690829060029081106115ff576115ff611b60565b6001600160a01b03928316602091820292909201015260065416635c11d795855f848661162d426064611a50565b6040518663ffffffff1660e01b815260040161164d959493929190611b74565b5f604051808303815f87803b158015611664575f5ffd5b505af1158015611676573d5f5f3e3d5ffd5b5050600b546040516370a0823160e01b81526001600160a01b038681166004830152610eed945090911691508490309083906370a082319060240161150e565b6006546009546001600160a01b039182169163e8e337009187918791879187915f918291166116e642600a611a50565b60405160e08a901b6001600160e01b03191681526001600160a01b039889166004820152968816602488015260448701959095526064860193909352608485019190915260a484015290921660c482015260e4810191909152610104016060604051808303815f875af115801561175f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113b69190611be4565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291515f928392908816916117e69190611c0f565b5f604051808303815f865af19150503d805f811461181f576040519150601f19603f3d011682016040523d82523d5f602084013e611824565b606091505b509150915081801561184e57508051158061184e57508080602001905181019061184e9190611b45565b610c725760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610619565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b038116811461094f575f5ffd5b5f5f60408385031215611900575f5ffd5b823561190b816118db565b946020939093013593505050565b5f5f5f6060848603121561192b575f5ffd5b8335611936816118db565b92506020840135611946816118db565b929592945050506040919091013590565b5f60208284031215611967575f5ffd5b8135611972816118db565b9392505050565b801515811461094f575f5ffd5b5f5f60408385031215611997575f5ffd5b82356119a2816118db565b915060208301356119b281611979565b809150509250929050565b5f602082840312156119cd575f5ffd5b813561197281611979565b5f5f604083850312156119e9575f5ffd5b82356119f4816118db565b915060208301356119b2816118db565b600181811c90821680611a1857607f821691505b602082108103611a3657634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561058b5761058b611a3c565b5f60208284031215611a73575f5ffd5b8151611972816118db565b808202811582820484141761058b5761058b611a3c565b5f82611aaf57634e487b7160e01b5f52601260045260245ffd5b500490565b8181038181111561058b5761058b611a3c565b80516001600160701b0381168114611add575f5ffd5b919050565b5f5f5f60608486031215611af4575f5ffd5b611afd84611ac7565b9250611b0b60208501611ac7565b9150604084015163ffffffff81168114611b23575f5ffd5b809150509250925092565b5f60208284031215611b3e575f5ffd5b5051919050565b5f60208284031215611b55575f5ffd5b815161197281611979565b634e487b7160e01b5f52603260045260245ffd5b5f60a0820187835286602084015260a0604084015280865180835260c0850191506020880192505f5b81811015611bc45783516001600160a01b0316835260209384019390920191600101611b9d565b50506001600160a01b039590951660608401525050608001529392505050565b5f5f5f60608486031215611bf6575f5ffd5b5050815160208301516040909301519094929350919050565b5f82518060208501845e5f92019182525091905056fea2646970667358221220e81c4941575b10a422bd8abb9c61c043b85fc4e4ca42776fbd588a9fafc7ad0f64736f6c634300081e0033608060405234801561000f575f5ffd5b506040516101cf3803806101cf83398101604081905261002e9161012e565b60405163095ea7b360e01b81523360048201525f1960248201526001600160a01b0383169063095ea7b3906044016020604051808303815f875af1158015610078573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061009c919061015f565b5060405163095ea7b360e01b81523360048201525f1960248201526001600160a01b0382169063095ea7b3906044016020604051808303815f875af11580156100e7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061010b919061015f565b505050610185565b80516001600160a01b0381168114610129575f5ffd5b919050565b5f5f6040838503121561013f575f5ffd5b61014883610113565b915061015660208401610113565b90509250929050565b5f6020828403121561016f575f5ffd5b8151801515811461017e575f5ffd5b9392505050565b603e806101915f395ff3fe60806040525f5ffdfea2646970667358221220f76bf623e034da7164d7de29000710c6cdf498728207298af8a9837d145fcfb164736f6c634300081e0033
Deployed Bytecode
0x608060405234801561000f575f5ffd5b5060043610610208575f3560e01c806370a082311161011f578063aa59ac7f116100a9578063dd62ed3e11610079578063dd62ed3e14610471578063e140e428146104a9578063e2f45605146104bc578063f2fde38b146104c5578063f887ea40146104d8575f5ffd5b8063aa59ac7f1461043b578063b09f12661461044e578063c2e5ec0414610456578063d28d885214610469575f5ffd5b806395d89b41116100ef57806395d89b41146103d8578063a3e295bc146103e0578063a457c2d7146103f3578063a72905a214610406578063a9059cbb14610428575f5ffd5b806370a0823114610382578063715018a6146103aa5780638d14e127146103b45780638da5cb5b146103c7575f5ffd5b806327c8f835116101a0578063372c12b111610170578063372c12b114610315578063395093511461033757806349bd5a5e1461034a5780634ada218b1461035d57806361d027b31461036f575f5ffd5b806327c8f835146102cd5780632c135b93146102e05780632f48ab7d146102f3578063313ce56714610306575f5ffd5b80631694505e116101db5780631694505e146102815780631732cded1461029457806318160ddd146102a857806323b872dd146102ba575f5ffd5b8063038eeaa41461020c57806306fdde031461022e578063095ea7b3146102435780631528dd7714610256575b5f5ffd5b6013546102199060ff1681565b60405190151581526020015b60405180910390f35b6102366104eb565b60405161022591906118a6565b6102196102513660046118ef565b61057b565b600c54610269906001600160a01b031681565b6040516001600160a01b039091168152602001610225565b600654610269906001600160a01b031681565b60105461021990600160a01b900460ff1681565b6002545b604051908152602001610225565b6102196102c8366004611919565b610591565b600954610269906001600160a01b031681565b601054610269906001600160a01b031681565b600b54610269906001600160a01b031681565b60405160128152602001610225565b610219610323366004611957565b60126020525f908152604090205460ff1681565b6102196103453660046118ef565b610645565b600854610269906001600160a01b031681565b60135461021990610100900460ff1681565b600e54610269906001600160a01b031681565b6102ac610390366004611957565b6001600160a01b03165f9081526020819052604090205490565b6103b2610680565b005b6103b26103c2366004611986565b610693565b6005546001600160a01b0316610269565b6102366106c5565b600f54610269906001600160a01b031681565b6102196104013660046118ef565b6106d4565b610219610414366004611957565b60076020525f908152604090205460ff1681565b6102196104363660046118ef565b61076c565b6103b2610449366004611957565b610778565b61023661081e565b6103b26104643660046119bd565b6108aa565b6102366108cc565b6102ac61047f3660046119d8565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b600d54610269906001600160a01b031681565b6102ac60115481565b6103b26104d3366004611957565b6108d9565b600a54610269906001600160a01b031681565b6060600380546104fa90611a04565b80601f016020809104026020016040519081016040528092919081815260200182805461052690611a04565b80156105715780601f1061054857610100808354040283529160200191610571565b820191905f5260205f20905b81548152906001019060200180831161055457829003601f168201915b5050505050905090565b5f610587338484610952565b5060015b92915050565b6001600160a01b0383165f9081526001602090815260408083203384529091528120545f19811461062f57828110156106225760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61062f8533858403610952565b61063a858585610a75565b506001949350505050565b335f8181526001602090815260408083206001600160a01b0387168452909152812054909161058791859061067b908690611a50565b610952565b610688610c7a565b6106915f610cd4565b565b61069b610c7a565b6001600160a01b03919091165f908152601260205260409020805460ff1916911515919091179055565b6060600480546104fa90611a04565b335f9081526001602090815260408083206001600160a01b0386168452909152812054828110156107555760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610619565b6107623385858403610952565b5060019392505050565b5f610587338484610a75565b610780610c7a565b601080546001600160a01b0319166001600160a01b038316908117909155604080516361d027b360e01b815290516361d027b3916004808201926020929091908290030181865afa1580156107d7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107fb9190611a63565b600e80546001600160a01b0319166001600160a01b039290921691909117905550565b6004805461082b90611a04565b80601f016020809104026020016040519081016040528092919081815260200182805461085790611a04565b80156108a25780601f10610879576101008083540402835291602001916108a2565b820191905f5260205f20905b81548152906001019060200180831161088557829003601f168201915b505050505081565b6108b2610c7a565b601380549115156101000261ff0019909216919091179055565b6003805461082b90611a04565b6108e1610c7a565b6001600160a01b0381166109465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610619565b61094f81610cd4565b50565b6001600160a01b0383166109b45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610619565b6001600160a01b038216610a155760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610619565b6001600160a01b038381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6010546001600160a01b0383811691161480610a9e57506010546001600160a01b038481169116145b15610ab357610aae838383610d25565b505050565b601354610100900460ff16610b25576001600160a01b0383165f9081526012602052604090205460ff1615610aed57610aae838383610d25565b60405162461bcd60e51b815260206004820152600d60248201526c3a3930b234b7339022b93937b960991b6044820152606401610619565b305f9081526020819052604081205460115460105491929083101591600160a01b900460ff16158015610b6f57506001600160a01b0385165f9081526007602052604090205460ff165b8015610b7e5750610b7e610ef3565b9050818015610b8b575080155b8015610ba15750601054600160a01b900460ff16155b8015610bc557506001600160a01b0386165f9081526007602052604090205460ff16155b15610bf4576010805460ff60a01b1916600160a01b179055610be683611017565b6010805460ff60a01b191690555b601054600160a01b900460ff16158015610c2557506001600160a01b0385165f9081526007602052604090205460ff165b8015610c2f575080155b15610c67575f6064610c42866003611a7e565b610c4c9190611a95565b9050610c588186611ab4565b9450610c65873083610d25565b505b610c72868686610d25565b505050505050565b6005546001600160a01b031633146106915760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610619565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b038316610d895760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610619565b6001600160a01b038216610deb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610619565b6001600160a01b0383165f9081526020819052604090205481811015610e625760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610619565b6001600160a01b038085165f90815260208190526040808220858503905591851681529081208054849290610e98908490611a50565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ee491815260200190565b60405180910390a35b50505050565b5f5f5f60085f9054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610f46573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f6a9190611ae2565b50600c546008546040516370a0823160e01b81526001600160a01b0391821660048201529395509193505f929116906370a0823190602401602060405180830381865afa158015610fbd573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fe19190611b2e565b60135490915060ff161561100257826001600160701b031681119350611011565b816001600160701b0316811193505b50505090565b5f611023600383611a95565b600c54600e549192506110449183916001600160a01b0390811691166113bf565b5f61104f8284611ab4565b90505f61105d600283611a95565b90505f61106a8284611ab4565b600c54600f5491925061108b9184916001600160a01b0390811691166113bf565b6110b1611099600283611a95565b600b54600f546001600160a01b0391821691166113bf565b600c546040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa1580156110f7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061111b9190611b2e565b600b546040516370a0823160e01b81523060048201529192505f916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611166573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061118a9190611b2e565b600c54600b549192506111b5916001600160a01b0391821691166111af600286611a95565b846116b6565b600c546111e29030906001600160a01b03166111d2600287611a95565b6111dd600287611a95565b6116b6565b600b546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611228573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061124c9190611b2e565b905080156112cc57600b5460095460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb906044016020604051808303815f875af11580156112a6573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112ca9190611b45565b505b600c546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611312573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113369190611b2e565b915081156113b657600c5460095460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810185905291169063a9059cbb906044016020604051808303815f875af1158015611390573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113b49190611b45565b505b50505050505050565b600c546001600160a01b0390811690831603611552576040805160028082526060820183525f9260208301908036833701905050905030815f8151811061140857611408611b60565b6001600160a01b039283166020918202929092010152600c5482519116908290600190811061143957611439611b60565b6001600160a01b03928316602091820292909201015260065416635c11d795855f8486611467426064611a50565b6040518663ffffffff1660e01b8152600401611487959493929190611b74565b5f604051808303815f87803b15801561149e575f5ffd5b505af11580156114b0573d5f5f3e3d5ffd5b5050600e546001600160a01b039081169085160391506114d290505750505050565b600c54600f546040516370a0823160e01b81526001600160a01b039182166004820152610eed9291909116908490309083906370a08231906024015b602060405180830381865afa158015611529573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061154d9190611b2e565b611783565b600b546001600160a01b0390811690831603610aae57604080516003808252608082019092525f916020820160608036833701905050905030815f8151811061159d5761159d611b60565b6001600160a01b039283166020918202929092010152600c548251911690829060019081106115ce576115ce611b60565b6001600160a01b039283166020918202929092010152600b548251911690829060029081106115ff576115ff611b60565b6001600160a01b03928316602091820292909201015260065416635c11d795855f848661162d426064611a50565b6040518663ffffffff1660e01b815260040161164d959493929190611b74565b5f604051808303815f87803b158015611664575f5ffd5b505af1158015611676573d5f5f3e3d5ffd5b5050600b546040516370a0823160e01b81526001600160a01b038681166004830152610eed945090911691508490309083906370a082319060240161150e565b6006546009546001600160a01b039182169163e8e337009187918791879187915f918291166116e642600a611a50565b60405160e08a901b6001600160e01b03191681526001600160a01b039889166004820152968816602488015260448701959095526064860193909352608485019190915260a484015290921660c482015260e4810191909152610104016060604051808303815f875af115801561175f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113b69190611be4565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291515f928392908816916117e69190611c0f565b5f604051808303815f865af19150503d805f811461181f576040519150601f19603f3d011682016040523d82523d5f602084013e611824565b606091505b509150915081801561184e57508051158061184e57508080602001905181019061184e9190611b45565b610c725760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610619565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b038116811461094f575f5ffd5b5f5f60408385031215611900575f5ffd5b823561190b816118db565b946020939093013593505050565b5f5f5f6060848603121561192b575f5ffd5b8335611936816118db565b92506020840135611946816118db565b929592945050506040919091013590565b5f60208284031215611967575f5ffd5b8135611972816118db565b9392505050565b801515811461094f575f5ffd5b5f5f60408385031215611997575f5ffd5b82356119a2816118db565b915060208301356119b281611979565b809150509250929050565b5f602082840312156119cd575f5ffd5b813561197281611979565b5f5f604083850312156119e9575f5ffd5b82356119f4816118db565b915060208301356119b2816118db565b600181811c90821680611a1857607f821691505b602082108103611a3657634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561058b5761058b611a3c565b5f60208284031215611a73575f5ffd5b8151611972816118db565b808202811582820484141761058b5761058b611a3c565b5f82611aaf57634e487b7160e01b5f52601260045260245ffd5b500490565b8181038181111561058b5761058b611a3c565b80516001600160701b0381168114611add575f5ffd5b919050565b5f5f5f60608486031215611af4575f5ffd5b611afd84611ac7565b9250611b0b60208501611ac7565b9150604084015163ffffffff81168114611b23575f5ffd5b809150509250925092565b5f60208284031215611b3e575f5ffd5b5051919050565b5f60208284031215611b55575f5ffd5b815161197281611979565b634e487b7160e01b5f52603260045260245ffd5b5f60a0820187835286602084015260a0604084015280865180835260c0850191506020880192505f5b81811015611bc45783516001600160a01b0316835260209384019390920191600101611b9d565b50506001600160a01b039590951660608401525050608001529392505050565b5f5f5f60608486031215611bf6575f5ffd5b5050815160208301516040909301519094929350919050565b5f82518060208501845e5f92019182525091905056fea2646970667358221220e81c4941575b10a422bd8abb9c61c043b85fc4e4ca42776fbd588a9fafc7ad0f64736f6c634300081e0033
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.
Add Token to MetaMask (Web3)