More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 2,738 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Sell | 86067871 | 8 days ago | IN | 0 XDC | 0.004066 | ||||
Sell | 86067844 | 8 days ago | IN | 0 XDC | 0.004381 | ||||
Sell | 85869652 | 13 days ago | IN | 0 XDC | 0.00373487 | ||||
Drop | 85867537 | 13 days ago | IN | 4,610 XDC | 0.02138525 | ||||
Claim | 85832108 | 14 days ago | IN | 0 XDC | 0.00169013 | ||||
Sell | 85827679 | 14 days ago | IN | 0 XDC | 0.00443275 | ||||
Buy | 85728490 | 17 days ago | IN | 4.60117522 XDC | 0.00439852 | ||||
Sell | 85728472 | 17 days ago | IN | 0 XDC | 0.00397035 | ||||
Sell | 85728434 | 17 days ago | IN | 0 XDC | 0.00429925 | ||||
Buy | 85428743 | 25 days ago | IN | 100 XDC | 0.00443617 | ||||
Drop | 85428705 | 25 days ago | IN | 230 XDC | 0.0208455 | ||||
Claim | 85269486 | 28 days ago | IN | 0 XDC | 0.00206197 | ||||
Claim | 85241323 | 29 days ago | IN | 0 XDC | 0.00150263 | ||||
Sell | 85211301 | 30 days ago | IN | 0 XDC | 0.00406646 | ||||
Claim | 85195416 | 30 days ago | IN | 0 XDC | 0.00169013 | ||||
Buy | 85177112 | 31 days ago | IN | 312.72858097 XDC | 0.00453962 | ||||
Sell | 85166295 | 31 days ago | IN | 0 XDC | 0.004066 | ||||
Buy | 85166291 | 31 days ago | IN | 2,209.07744785 XDC | 0.00441067 | ||||
Sell | 85165266 | 31 days ago | IN | 0 XDC | 0.004066 | ||||
Buy | 85165257 | 31 days ago | IN | 3,700.00084825 XDC | 0.00441067 | ||||
Sell | 85165247 | 31 days ago | IN | 0 XDC | 0.00401355 | ||||
Sell | 85165247 | 31 days ago | IN | 0 XDC | 0.00406605 | ||||
Sell | 85165237 | 31 days ago | IN | 0 XDC | 0.0045347 | ||||
Buy | 85165235 | 31 days ago | IN | 4,450.0010202 XDC | 0.00435827 | ||||
Buy | 85165232 | 31 days ago | IN | 2,565.65252611 XDC | 0.00441072 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
86067871 | 8 days ago | 15.50541303 XDC | ||||
86067871 | 8 days ago | 1,535.0358903 XDC | ||||
86067844 | 8 days ago | 51.68083171 XDC | ||||
86067844 | 8 days ago | 5,116.40233932 XDC | ||||
85869652 | 13 days ago | 1 wei | ||||
85869652 | 13 days ago | 45.34199999 XDC | ||||
85869652 | 13 days ago | 4,488.858 XDC | ||||
85867537 | 13 days ago | 45.8 XDC | ||||
85867537 | 13 days ago | Contract Creation | 0 XDC | |||
85867537 | 13 days ago | 30 XDC | ||||
85827679 | 14 days ago | 3.15412414 XDC | ||||
85827679 | 14 days ago | 312.25829048 XDC | ||||
85728490 | 17 days ago | 0.04601175 XDC | ||||
85728472 | 17 days ago | 0.00205093 XDC | ||||
85728472 | 17 days ago | 0.20304232 XDC | ||||
85728434 | 17 days ago | 0.00437131 XDC | ||||
85728434 | 17 days ago | 0.43276019 XDC | ||||
85428743 | 25 days ago | 1 XDC | ||||
85428705 | 25 days ago | 2 XDC | ||||
85428705 | 25 days ago | Contract Creation | 0 XDC | |||
85428705 | 25 days ago | 30 XDC | ||||
85211301 | 30 days ago | 11.56447408 XDC | ||||
85211301 | 30 days ago | 1,144.88293474 XDC | ||||
85177112 | 31 days ago | 3.1272858 XDC | ||||
85166295 | 31 days ago | 21.86986673 XDC |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
BBBPumpFun
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity =0.8.23; import {PointToken, Ownable} from "./extensions/PointToken.sol"; import {MegadropBBB} from "./MegadropBBB.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {IUniswapV2Factory} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import {IWETH} from "./extensions/IWETH.sol"; import {OptimizedIterableSet} from "./extensions/OptimizedIterableSet.sol"; contract BBBPumpFun is Ownable, ReentrancyGuard, OptimizedIterableSet { struct DropToken { uint256 index; address token; string name; string symbol; uint256 deployFee; address deployer; uint256 snapshotId; uint256 maxXdc; uint256 removed; uint256 xdcAmount; uint256 createTime; uint256 dropAmt; string imageUrl; string description; string website; string telegram; string twitter; } struct Kline { uint256 time; uint256 open; uint256 close; uint256 tradeAmt; uint256 xdcAmt; } struct TradeObj { uint256 index; address token; string tradeType; uint256 time; address account; uint256 xdcAmount; } DropToken[] public dropTokens; TradeObj public latestTrade; mapping(uint256 => Kline[]) public klineMap; mapping(address => mapping(uint256 => bool)) public claimed; uint256 public latestKingIndex; address public megadropBBBV1; address public uniswapV2Factory; uint256 public deployFee; uint256 public defaultMinXdcCap; address public weth; uint256 public swapFee; address public foundation; uint256 public constant k = 2e25; mapping(address => mapping(address => bool)) public delegateAllowance; mapping(address => uint256) public tokenMapping; event Drop( uint256 index, address token, string name, string symbol, uint256 deployFee, address deployer, uint256 maxXdc, uint256 createTime ); event Trade( uint256 indexed index, address indexed token, string tradeType, uint256 time, uint256 open, uint256 close, uint256 xdcAmount, uint256 tokenAmount ); constructor() Ownable(msg.sender) { foundation = 0x2475Dcd4Fe333bE814Ef7C8f8CE8A1E9B5FcDEA0; //mainnet deployFee = 100 ether; megadropBBBV1 = 0x37c00AE5C4b49Ab0F5fD2FFB1033588e9bC33B08; uniswapV2Factory = 0x9E6d21E759A7A288b80eef94E4737D313D31c13f; defaultMinXdcCap = 1e6 ether; weth = 0x951857744785E80e2De051c32EE7b25f9c458C42; swapFee = 100; //devnet // deployFee = 100 ether; // megadropBBBV1 = 0xb89D5cb86f2403ca602Ee45a687437a9F0Ce1C9c; // uniswapV2Factory = 0x295CE027f21D45bc08386d8c59f51bE5f38a01C1; // defaultMinXdcCap = 1 ether; // weth = 0x7025d0a3AC01AE31469a9eC018D54A0fe3A30dE9; // swapFee = 100; } function getKlineLength(uint256 index) external view returns (uint256) { return klineMap[index].length; } function updateToken( uint256 index, string calldata imageUrl, string calldata description, string calldata website, string calldata telegram, string calldata twitter ) external { DropToken storage dropTokenStorage = dropTokens[index - 1]; require( dropTokenStorage.deployer == msg.sender, "MegadropBBBV2: must deployer" ); require( bytes(imageUrl).length <= 256 && bytes(imageUrl).length > 0, "MegadropBBBV2: imageUrl need less 256 bytes and gt 0 bytes" ); require( bytes(description).length <= 256 && bytes(description).length > 0, "MegadropBBBV2: description need less 256 bytes and gt 0 bytes" ); require( bytes(website).length <= 256, "MegadropBBBV2: website need less 256 bytes" ); require( bytes(telegram).length <= 256, "MegadropBBBV2: telegram need less 256 bytes" ); require( bytes(twitter).length <= 256, "MegadropBBBV2: twitter need less 256 bytes" ); dropTokenStorage.imageUrl = imageUrl; dropTokenStorage.description = description; dropTokenStorage.website = website; dropTokenStorage.telegram = telegram; dropTokenStorage.twitter = twitter; } function drop( string calldata name, string calldata symbol, string calldata imageUrl, string calldata description, string calldata website, string calldata telegram, string calldata twitter, uint256 maxXdcCap ) external payable nonReentrant { require(msg.value >= deployFee, "MegadropBBBV2: incorrect value"); require( bytes(name).length <= 20 && bytes(name).length > 0, "MegadropBBBV2: name need less 20 bytes and gt 0 bytes" ); require( bytes(symbol).length <= 10 && bytes(symbol).length > 0, "MegadropBBBV2: symbol need less 10 bytes and gt 0 bytes" ); require( bytes(imageUrl).length <= 256 && bytes(imageUrl).length > 0, "MegadropBBBV2: imageUrl need less 256 bytes and gt 0 bytes" ); require( bytes(description).length <= 256 && bytes(description).length > 0, "MegadropBBBV2: description need less 256 bytes and gt 0 bytes" ); require( bytes(website).length <= 256, "MegadropBBBV2: website need less 256 bytes" ); require( bytes(telegram).length <= 256, "MegadropBBBV2: telegram need less 256 bytes" ); require( bytes(twitter).length <= 256, "MegadropBBBV2: twitter need less 256 bytes" ); if (deployFee > 0) { payable(foundation).transfer(deployFee); } PointToken dropToken = new PointToken(name, symbol); if (maxXdcCap < defaultMinXdcCap) { maxXdcCap = defaultMinXdcCap; } uint256 index = dropTokens.length + 1; dropTokens.push( DropToken( index, address(dropToken), name, symbol, deployFee, msg.sender, 0, maxXdcCap, 0, 0, block.timestamp, 0, imageUrl, description, website, telegram, twitter ) ); tokenMapping[address(dropToken)] = index; add(index); emit Drop( index, address(dropToken), name, symbol, deployFee, msg.sender, maxXdcCap, block.timestamp ); if (msg.value - deployFee > 0) { uint256 paymentAmount = msg.value - deployFee; buyInternal(index, paymentAmount); } } function buyInternal(uint256 index, uint256 paymentAmount) private { require(paymentAmount > 0, "MegadropBBBV2: value must greater than 0"); DropToken memory dropToken = getDropToken(index); require( dropToken.removed == 0, "MegadropBBBV2: liquilty already removed" ); DropToken storage dropTokenStorage = dropTokens[index - 1]; uint256 xdcAmount = dropToken.xdcAmount; uint256 xdcSwapFee = (paymentAmount * swapFee) / 10000; uint256 newBuyXdcAmount = paymentAmount - xdcSwapFee; if (xdcSwapFee > 0) { payable(foundation).transfer(xdcSwapFee); } uint256 open = price(index); uint256 moveLiq = 0; if (xdcAmount + newBuyXdcAmount >= dropToken.maxXdc) { uint256 maxBuyXdcAmount = dropToken.maxXdc - xdcAmount; payable(msg.sender).transfer(newBuyXdcAmount - maxBuyXdcAmount); newBuyXdcAmount = maxBuyXdcAmount; moveLiq = 1; dropTokenStorage.xdcAmount = dropToken.maxXdc; } else { dropTokenStorage.xdcAmount += newBuyXdcAmount; } uint256 buyAmount = getBuyAmount(index, newBuyXdcAmount); PointToken(dropToken.token).mint(msg.sender, buyAmount); uint256 close = price(index); if (moveLiq == 1) { moveLiquidity(index); } klineMap[index].push( Kline(block.timestamp, open, close, buyAmount, newBuyXdcAmount) ); emit Trade( index, dropToken.token, "buy", block.timestamp, open, close, newBuyXdcAmount, buyAmount ); add(index); latestTrade = TradeObj( index, dropToken.token, "buy", block.timestamp, msg.sender, newBuyXdcAmount ); if (dropTokenStorage.xdcAmount * 100 >= dropTokenStorage.maxXdc * 80) { latestKingIndex = index; } } function getLatestTrade() public view returns ( TradeObj memory, string memory name, string memory symbol, string memory imageUrl ) { if (latestTrade.index == 0) return (latestTrade, "", "", ""); DropToken memory dropToken = getDropToken(latestTrade.index); return ( latestTrade, dropToken.name, dropToken.symbol, dropToken.imageUrl ); } function getLatestKing() public view returns (DropToken memory) { if (latestKingIndex == 0) return emptyDropToken(); return dropTokens[latestKingIndex - 1]; } function emptyDropToken() public pure returns (DropToken memory) { return DropToken( 0, address(0), "", "", 0, address(0), 0, 0, 0, 0, 0, 0, "", "", "", "", "" ); } function getLatestDropToken() public view returns (DropToken memory) { if (dropTokens.length == 0) return emptyDropToken(); return dropTokens[dropTokens.length - 1]; } function getBuyAmount( uint256 index, uint256 amount ) public view returns (uint256) { DropToken memory dropToken = getDropToken(index); uint256 totalSupply = PointToken(dropToken.token).totalSupply(); uint256 buyAmount = Math.sqrt(totalSupply ** 2 + k * amount) - totalSupply; return buyAmount; } function getSellAmount( uint256 index, uint256 amount ) public view returns (uint256) { DropToken memory dropToken = getDropToken(index); uint256 totalSupply = PointToken(dropToken.token).totalSupply(); uint256 newTotalSupply = totalSupply - amount; uint256 refund = (totalSupply ** 2 - newTotalSupply ** 2) / k; return refund; } function price(uint256 index) public view returns (uint256) { DropToken memory dropToken = getDropToken(index); return Math.sqrt((dropToken.xdcAmount * 1e36) / k); } function buy(uint256 index) external payable nonReentrant { require(msg.value > 0, "MegadropBBBV2: value must greater than 0"); DropToken memory dropToken = getDropToken(index); require( dropToken.removed == 0, "MegadropBBBV2: liquilty already removed" ); DropToken storage dropTokenStorage = dropTokens[index - 1]; uint256 xdcAmount = dropToken.xdcAmount; uint256 xdcSwapFee = (msg.value * swapFee) / 10000; uint256 newBuyXdcAmount = msg.value - xdcSwapFee; if (xdcSwapFee > 0) { payable(foundation).transfer(xdcSwapFee); } uint256 open = price(index); uint256 moveLiq = 0; if (xdcAmount + newBuyXdcAmount >= dropToken.maxXdc) { uint256 maxBuyXdcAmount = dropToken.maxXdc - xdcAmount; payable(msg.sender).transfer(newBuyXdcAmount - maxBuyXdcAmount); newBuyXdcAmount = maxBuyXdcAmount; moveLiq = 1; dropTokenStorage.xdcAmount = dropToken.maxXdc; } else { dropTokenStorage.xdcAmount += newBuyXdcAmount; } uint256 buyAmount = getBuyAmount(index, newBuyXdcAmount); PointToken(dropToken.token).mint(msg.sender, buyAmount); uint256 close = price(index); if (moveLiq == 1) { moveLiquidity(index); } klineMap[index].push( Kline(block.timestamp, open, close, buyAmount, newBuyXdcAmount) ); emit Trade( index, dropToken.token, "buy", block.timestamp, open, close, newBuyXdcAmount, buyAmount ); add(index); latestTrade = TradeObj( index, dropToken.token, "buy", block.timestamp, msg.sender, newBuyXdcAmount ); if (dropTokenStorage.xdcAmount * 100 >= dropTokenStorage.maxXdc * 80) { latestKingIndex = index; } } function getTradeVolume( uint256 index ) public view returns (uint256, uint256) { Kline[] memory klines = klineMap[index]; uint256 volume = 0; uint256 volume24h = 0; for (uint256 i = 0; i < klines.length; i++) { volume += klines[i].xdcAmt; if (klines[i].time + 86400 >= block.timestamp) { volume24h += klines[i].xdcAmt; } } return (volume, volume24h); } function moveLiquidity(uint256 index) private { DropToken storage dropToken = dropTokens[index - 1]; address pair = IUniswapV2Factory(uniswapV2Factory).getPair( weth, dropToken.token ); if (pair == address(0)) { pair = IUniswapV2Factory(uniswapV2Factory).createPair( weth, dropToken.token ); } uint256 xdcAmount = dropToken.xdcAmount; uint256 totalSupply = PointToken(dropToken.token).totalSupply(); uint256 newMint = (totalSupply * 96) / 100; dropToken.dropAmt = (totalSupply * 4) / 100; IWETH(weth).deposit{value: xdcAmount}(); PointToken(dropToken.token).mint(address(this), newMint); PointToken(dropToken.token).transfer(pair, newMint); IWETH(weth).transfer(pair, xdcAmount); IUniswapV2Pair(pair).mint(address(this)); dropToken.removed = 1; uint256 snapshotId = MegadropBBB(megadropBBBV1).clock(); dropToken.snapshotId = snapshotId; MegadropBBB(megadropBBBV1)._snapshot(); } function sell(uint256 index, uint256 amount) external nonReentrant { require(amount > 0, "MegadropBBBV2: amount must greater than 0"); DropToken memory dropToken = getDropToken(index); require( dropToken.removed == 0, "MegadropBBBV2: liquilty already removed" ); uint256 open = price(index); uint256 refund = getSellAmount(index, amount); DropToken storage dropTokenStorage = dropTokens[index - 1]; dropTokenStorage.xdcAmount -= refund; PointToken(dropToken.token).burnFrom(msg.sender, amount); uint256 refundSwapFee = (refund * swapFee) / 10000; refund -= refundSwapFee; payable(msg.sender).transfer(refund); if (refundSwapFee > 0) { payable(foundation).transfer(refundSwapFee); } if (dropTokenStorage.xdcAmount <= 10) { payable(foundation).transfer(dropTokenStorage.xdcAmount); dropTokenStorage.xdcAmount = 0; } uint256 close = price(index); klineMap[index].push( Kline(block.timestamp, open, close, amount, refund) ); emit Trade( index, dropToken.token, "sell", block.timestamp, open, close, refund, amount ); add(index); latestTrade = TradeObj( index, dropToken.token, "sell", block.timestamp, msg.sender, refund ); } function claim(uint256 index, address account) external { if (!claimed[msg.sender][index]) { DropToken memory dropToken = getDropToken(index); (uint256 claimAmt, , , ) = getClaimAmt(index, account); PointToken(dropToken.token).mint(msg.sender, claimAmt); claimed[account][index] = true; } } function getClaimAmt( uint256 index, address account ) public view returns (uint256, uint256, uint256, uint256) { DropToken memory dropToken = getDropToken(index); if (dropToken.snapshotId == 0) return (0, 0, 0, 0); uint256 snapshotTotalSupply = MegadropBBB(megadropBBBV1) .getPastTotalSupply(dropToken.snapshotId); if (snapshotTotalSupply == 0) { return (0, 0, 0, 0); } uint256 snapshotAmt = MegadropBBB(megadropBBBV1).getPastVotes( account, dropToken.snapshotId ); uint256 airdropAmt = dropToken.dropAmt; uint256 claimAmt = (airdropAmt * snapshotAmt) / snapshotTotalSupply; return (claimAmt, airdropAmt, snapshotAmt, snapshotTotalSupply); } function getDropToken( uint256 index ) public view returns (DropToken memory) { require( index > 0 && index <= dropTokens.length, "MegadropBBBV2: Invalid index" ); DropToken memory dropToken = dropTokens[index - 1]; require( dropToken.token != address(0), "MegadropBBBV2: invalid drop token" ); return dropToken; } function getDropTokenByAddress( address token ) public view returns (DropToken memory) { uint256 index = tokenMapping[token]; return getDropToken(index); } function getDropTokenLength() external view returns (uint256) { return dropTokens.length; } function setDeployFee(uint256 _deployFee) external onlyOwner { deployFee = _deployFee; } function setdefaultMinXdcCap(uint256 _defaultMinXdcCap) external onlyOwner { defaultMinXdcCap = _defaultMinXdcCap; } function setSwapFee(uint256 _swapFee) external onlyOwner { swapFee = _swapFee; } function setFoundation(address _foundation) external onlyOwner { foundation = _foundation; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (governance/utils/IVotes.sol) pragma solidity ^0.8.20; /** * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts. */ interface IVotes { /** * @dev The signature used has expired. */ error VotesExpiredSignature(uint256 expiry); /** * @dev Emitted when an account changes their delegate. */ event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /** * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of voting units. */ event DelegateVotesChanged(address indexed delegate, uint256 previousVotes, uint256 newVotes); /** * @dev Returns the current amount of votes that `account` has. */ function getVotes(address account) external view returns (uint256); /** * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is * configured to use block numbers, this will return the value at the end of the corresponding block. */ function getPastVotes(address account, uint256 timepoint) external view returns (uint256); /** * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is * configured to use block numbers, this will return the value at the end of the corresponding block. * * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. * Votes that have not been delegated are still part of total supply, even though they would not participate in a * vote. */ function getPastTotalSupply(uint256 timepoint) external view returns (uint256); /** * @dev Returns the delegate that `account` has chosen. */ function delegates(address account) external view returns (address); /** * @dev Delegates votes from the sender to `delegatee`. */ function delegate(address delegatee) external; /** * @dev Delegates votes from signer to `delegatee`. */ function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (governance/utils/Votes.sol) pragma solidity ^0.8.20; import {IERC5805} from "../../interfaces/IERC5805.sol"; import {Context} from "../../utils/Context.sol"; import {Nonces} from "../../utils/Nonces.sol"; import {EIP712} from "../../utils/cryptography/EIP712.sol"; import {Checkpoints} from "../../utils/structs/Checkpoints.sol"; import {SafeCast} from "../../utils/math/SafeCast.sol"; import {ECDSA} from "../../utils/cryptography/ECDSA.sol"; import {Time} from "../../utils/types/Time.sol"; /** * @dev This is a base abstract contract that tracks voting units, which are a measure of voting power that can be * transferred, and provides a system of vote delegation, where an account can delegate its voting units to a sort of * "representative" that will pool delegated voting units from different accounts and can then use it to vote in * decisions. In fact, voting units _must_ be delegated in order to count as actual votes, and an account has to * delegate those votes to itself if it wishes to participate in decisions and does not have a trusted representative. * * This contract is often combined with a token contract such that voting units correspond to token units. For an * example, see {ERC721Votes}. * * The full history of delegate votes is tracked on-chain so that governance protocols can consider votes as distributed * at a particular block number to protect against flash loans and double voting. The opt-in delegate system makes the * cost of this history tracking optional. * * When using this module the derived contract must implement {_getVotingUnits} (for example, make it return * {ERC721-balanceOf}), and can use {_transferVotingUnits} to track a change in the distribution of those units (in the * previous example, it would be included in {ERC721-_update}). */ abstract contract Votes is Context, EIP712, Nonces, IERC5805 { using Checkpoints for Checkpoints.Trace208; bytes32 private constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); mapping(address account => address) private _delegatee; mapping(address delegatee => Checkpoints.Trace208) private _delegateCheckpoints; Checkpoints.Trace208 private _totalCheckpoints; /** * @dev The clock was incorrectly modified. */ error ERC6372InconsistentClock(); /** * @dev Lookup to future votes is not available. */ error ERC5805FutureLookup(uint256 timepoint, uint48 clock); /** * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based * checkpoints (and voting), in which case {CLOCK_MODE} should be overridden as well to match. */ function clock() public view virtual returns (uint48) { return Time.blockNumber(); } /** * @dev Machine-readable description of the clock as specified in EIP-6372. */ // solhint-disable-next-line func-name-mixedcase function CLOCK_MODE() public view virtual returns (string memory) { // Check that the clock was not modified if (clock() != Time.blockNumber()) { revert ERC6372InconsistentClock(); } return "mode=blocknumber&from=default"; } /** * @dev Returns the current amount of votes that `account` has. */ function getVotes(address account) public view virtual returns (uint256) { return _delegateCheckpoints[account].latest(); } /** * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is * configured to use block numbers, this will return the value at the end of the corresponding block. * * Requirements: * * - `timepoint` must be in the past. If operating using block numbers, the block must be already mined. */ function getPastVotes(address account, uint256 timepoint) public view virtual returns (uint256) { uint48 currentTimepoint = clock(); if (timepoint >= currentTimepoint) { revert ERC5805FutureLookup(timepoint, currentTimepoint); } return _delegateCheckpoints[account].upperLookupRecent(SafeCast.toUint48(timepoint)); } /** * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is * configured to use block numbers, this will return the value at the end of the corresponding block. * * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. * Votes that have not been delegated are still part of total supply, even though they would not participate in a * vote. * * Requirements: * * - `timepoint` must be in the past. If operating using block numbers, the block must be already mined. */ function getPastTotalSupply(uint256 timepoint) public view virtual returns (uint256) { uint48 currentTimepoint = clock(); if (timepoint >= currentTimepoint) { revert ERC5805FutureLookup(timepoint, currentTimepoint); } return _totalCheckpoints.upperLookupRecent(SafeCast.toUint48(timepoint)); } /** * @dev Returns the current total supply of votes. */ function _getTotalSupply() internal view virtual returns (uint256) { return _totalCheckpoints.latest(); } /** * @dev Returns the delegate that `account` has chosen. */ function delegates(address account) public view virtual returns (address) { return _delegatee[account]; } /** * @dev Delegates votes from the sender to `delegatee`. */ function delegate(address delegatee) public virtual { address account = _msgSender(); _delegate(account, delegatee); } /** * @dev Delegates votes from signer to `delegatee`. */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public virtual { if (block.timestamp > expiry) { revert VotesExpiredSignature(expiry); } address signer = ECDSA.recover( _hashTypedDataV4(keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry))), v, r, s ); _useCheckedNonce(signer, nonce); _delegate(signer, delegatee); } /** * @dev Delegate all of `account`'s voting units to `delegatee`. * * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}. */ function _delegate(address account, address delegatee) internal virtual { address oldDelegate = delegates(account); _delegatee[account] = delegatee; emit DelegateChanged(account, oldDelegate, delegatee); _moveDelegateVotes(oldDelegate, delegatee, _getVotingUnits(account)); } /** * @dev Transfers, mints, or burns voting units. To register a mint, `from` should be zero. To register a burn, `to` * should be zero. Total supply of voting units will be adjusted with mints and burns. */ function _transferVotingUnits(address from, address to, uint256 amount) internal virtual { if (from == address(0)) { _push(_totalCheckpoints, _add, SafeCast.toUint208(amount)); } if (to == address(0)) { _push(_totalCheckpoints, _subtract, SafeCast.toUint208(amount)); } _moveDelegateVotes(delegates(from), delegates(to), amount); } /** * @dev Moves delegated votes from one delegate to another. */ function _moveDelegateVotes(address from, address to, uint256 amount) private { if (from != to && amount > 0) { if (from != address(0)) { (uint256 oldValue, uint256 newValue) = _push( _delegateCheckpoints[from], _subtract, SafeCast.toUint208(amount) ); emit DelegateVotesChanged(from, oldValue, newValue); } if (to != address(0)) { (uint256 oldValue, uint256 newValue) = _push( _delegateCheckpoints[to], _add, SafeCast.toUint208(amount) ); emit DelegateVotesChanged(to, oldValue, newValue); } } } /** * @dev Get number of checkpoints for `account`. */ function _numCheckpoints(address account) internal view virtual returns (uint32) { return SafeCast.toUint32(_delegateCheckpoints[account].length()); } /** * @dev Get the `pos`-th checkpoint for `account`. */ function _checkpoints( address account, uint32 pos ) internal view virtual returns (Checkpoints.Checkpoint208 memory) { return _delegateCheckpoints[account].at(pos); } function _push( Checkpoints.Trace208 storage store, function(uint208, uint208) view returns (uint208) op, uint208 delta ) private returns (uint208, uint208) { return store.push(clock(), op(store.latest(), delta)); } function _add(uint208 a, uint208 b) private pure returns (uint208) { return a + b; } function _subtract(uint208 a, uint208 b) private pure returns (uint208) { return a - b; } /** * @dev Must return the voting units held by an account. */ function _getVotingUnits(address) internal view virtual returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.20; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5805.sol) pragma solidity ^0.8.20; import {IVotes} from "../governance/utils/IVotes.sol"; import {IERC6372} from "./IERC6372.sol"; interface IERC5805 is IERC6372, IVotes {}
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC6372.sol) pragma solidity ^0.8.20; interface IERC6372 { /** * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting). */ function clock() external view returns (uint48); /** * @dev Description of the clock */ // solhint-disable-next-line func-name-mixedcase function CLOCK_MODE() external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.20; import {ERC20} from "../ERC20.sol"; import {Context} from "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys a `value` amount of tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 value) public virtual { _burn(_msgSender(), value); } /** * @dev Destroys a `value` amount of tokens from `account`, deducting from * the caller's allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `value`. */ function burnFrom(address account, uint256 value) public virtual { _spendAllowance(account, _msgSender(), value); _burn(account, value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Votes.sol) pragma solidity ^0.8.20; import {ERC20} from "../ERC20.sol"; import {Votes} from "../../../governance/utils/Votes.sol"; import {Checkpoints} from "../../../utils/structs/Checkpoints.sol"; /** * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's, * and supports token supply up to 2^208^ - 1, while COMP is limited to 2^96^ - 1. * * NOTE: This contract does not provide interface compatibility with Compound's COMP token. * * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting * power can be queried through the public accessors {getVotes} and {getPastVotes}. * * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked. */ abstract contract ERC20Votes is ERC20, Votes { /** * @dev Total supply cap has been exceeded, introducing a risk of votes overflowing. */ error ERC20ExceededSafeSupply(uint256 increasedSupply, uint256 cap); /** * @dev Maximum token supply. Defaults to `type(uint208).max` (2^208^ - 1). * * This maximum is enforced in {_update}. It limits the total supply of the token, which is otherwise a uint256, * so that checkpoints can be stored in the Trace208 structure used by {{Votes}}. Increasing this value will not * remove the underlying limitation, and will cause {_update} to fail because of a math overflow in * {_transferVotingUnits}. An override could be used to further restrict the total supply (to a lower value) if * additional logic requires it. When resolving override conflicts on this function, the minimum should be * returned. */ function _maxSupply() internal view virtual returns (uint256) { return type(uint208).max; } /** * @dev Move voting power when tokens are transferred. * * Emits a {IVotes-DelegateVotesChanged} event. */ function _update(address from, address to, uint256 value) internal virtual override { super._update(from, to, value); if (from == address(0)) { uint256 supply = totalSupply(); uint256 cap = _maxSupply(); if (supply > cap) { revert ERC20ExceededSafeSupply(supply, cap); } } _transferVotingUnits(from, to, value); } /** * @dev Returns the voting units of an `account`. * * WARNING: Overriding this function may compromise the internal vote accounting. * `ERC20Votes` assumes tokens map to voting units 1:1 and this is not easy to change. */ function _getVotingUnits(address account) internal view virtual override returns (uint256) { return balanceOf(account); } /** * @dev Get number of checkpoints for `account`. */ function numCheckpoints(address account) public view virtual returns (uint32) { return _numCheckpoints(account); } /** * @dev Get the `pos`-th checkpoint for `account`. */ function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoints.Checkpoint208 memory) { return _checkpoints(account, pos); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "./MessageHashUtils.sol"; import {ShortStrings, ShortString} from "../ShortStrings.sol"; import {IERC5267} from "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * @custom:oz-upgrades-unsafe-allow state-variable-immutable */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: By default this function reads _name which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Name() internal view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } /** * @dev The version parameter for the EIP712 domain. * * NOTE: By default this function reads _version which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Version() internal view returns (string memory) { return _version.toStringWithFallback(_versionFallback); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.20; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeCast { /** * @dev Value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); /** * @dev An int value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedIntToUint(int256 value); /** * @dev Value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); /** * @dev An uint value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedUintToInt(uint256 value); /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits */ function toUint248(uint256 value) internal pure returns (uint248) { if (value > type(uint248).max) { revert SafeCastOverflowedUintDowncast(248, value); } return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits */ function toUint240(uint256 value) internal pure returns (uint240) { if (value > type(uint240).max) { revert SafeCastOverflowedUintDowncast(240, value); } return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits */ function toUint232(uint256 value) internal pure returns (uint232) { if (value > type(uint232).max) { revert SafeCastOverflowedUintDowncast(232, value); } return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { if (value > type(uint224).max) { revert SafeCastOverflowedUintDowncast(224, value); } return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits */ function toUint216(uint256 value) internal pure returns (uint216) { if (value > type(uint216).max) { revert SafeCastOverflowedUintDowncast(216, value); } return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 value) internal pure returns (uint208) { if (value > type(uint208).max) { revert SafeCastOverflowedUintDowncast(208, value); } return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits */ function toUint200(uint256 value) internal pure returns (uint200) { if (value > type(uint200).max) { revert SafeCastOverflowedUintDowncast(200, value); } return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits */ function toUint192(uint256 value) internal pure returns (uint192) { if (value > type(uint192).max) { revert SafeCastOverflowedUintDowncast(192, value); } return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits */ function toUint184(uint256 value) internal pure returns (uint184) { if (value > type(uint184).max) { revert SafeCastOverflowedUintDowncast(184, value); } return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits */ function toUint176(uint256 value) internal pure returns (uint176) { if (value > type(uint176).max) { revert SafeCastOverflowedUintDowncast(176, value); } return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits */ function toUint168(uint256 value) internal pure returns (uint168) { if (value > type(uint168).max) { revert SafeCastOverflowedUintDowncast(168, value); } return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits */ function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) { revert SafeCastOverflowedUintDowncast(160, value); } return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits */ function toUint152(uint256 value) internal pure returns (uint152) { if (value > type(uint152).max) { revert SafeCastOverflowedUintDowncast(152, value); } return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits */ function toUint144(uint256 value) internal pure returns (uint144) { if (value > type(uint144).max) { revert SafeCastOverflowedUintDowncast(144, value); } return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits */ function toUint136(uint256 value) internal pure returns (uint136) { if (value > type(uint136).max) { revert SafeCastOverflowedUintDowncast(136, value); } return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { if (value > type(uint128).max) { revert SafeCastOverflowedUintDowncast(128, value); } return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { if (value > type(uint120).max) { revert SafeCastOverflowedUintDowncast(120, value); } return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits */ function toUint112(uint256 value) internal pure returns (uint112) { if (value > type(uint112).max) { revert SafeCastOverflowedUintDowncast(112, value); } return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits */ function toUint104(uint256 value) internal pure returns (uint104) { if (value > type(uint104).max) { revert SafeCastOverflowedUintDowncast(104, value); } return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { if (value > type(uint96).max) { revert SafeCastOverflowedUintDowncast(96, value); } return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { if (value > type(uint88).max) { revert SafeCastOverflowedUintDowncast(88, value); } return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { if (value > type(uint80).max) { revert SafeCastOverflowedUintDowncast(80, value); } return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits */ function toUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert SafeCastOverflowedUintDowncast(72, value); } return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { if (value > type(uint64).max) { revert SafeCastOverflowedUintDowncast(64, value); } return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits */ function toUint56(uint256 value) internal pure returns (uint56) { if (value > type(uint56).max) { revert SafeCastOverflowedUintDowncast(56, value); } return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits */ function toUint48(uint256 value) internal pure returns (uint48) { if (value > type(uint48).max) { revert SafeCastOverflowedUintDowncast(48, value); } return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert SafeCastOverflowedUintDowncast(40, value); } return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { if (value > type(uint32).max) { revert SafeCastOverflowedUintDowncast(32, value); } return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits */ function toUint24(uint256 value) internal pure returns (uint24) { if (value > type(uint24).max) { revert SafeCastOverflowedUintDowncast(24, value); } return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { if (value > type(uint16).max) { revert SafeCastOverflowedUintDowncast(16, value); } return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits */ function toUint8(uint256 value) internal pure returns (uint8) { if (value > type(uint8).max) { revert SafeCastOverflowedUintDowncast(8, value); } return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { if (value < 0) { revert SafeCastOverflowedIntToUint(value); } return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(248, value); } } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(240, value); } } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(232, value); } } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(224, value); } } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(216, value); } } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(208, value); } } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(192, value); } } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(176, value); } } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(168, value); } } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(160, value); } } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(152, value); } } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(144, value); } } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(136, value); } } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(128, value); } } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(120, value); } } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(112, value); } } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(104, value); } } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(96, value); } } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(88, value); } } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(80, value); } } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(72, value); } } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(64, value); } } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(56, value); } } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(48, value); } } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(40, value); } } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(32, value); } } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(24, value); } } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(16, value); } } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(8, value); } } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive if (value > uint256(type(int256).max)) { revert SafeCastOverflowedUintToInt(value); } return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol) pragma solidity ^0.8.20; /** * @dev Provides tracking nonces for addresses. Nonces will only increment. */ abstract contract Nonces { /** * @dev The nonce used for an `account` is not the expected current nonce. */ error InvalidAccountNonce(address account, uint256 currentNonce); mapping(address account => uint256) private _nonces; /** * @dev Returns the next unused nonce for an address. */ function nonces(address owner) public view virtual returns (uint256) { return _nonces[owner]; } /** * @dev Consumes a nonce. * * Returns the current value and increments nonce. */ function _useNonce(address owner) internal virtual returns (uint256) { // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be // decremented or reset. This guarantees that the nonce never overflows. unchecked { // It is important to do x++ and not ++x here. return _nonces[owner]++; } } /** * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`. */ function _useCheckedNonce(address owner, uint256 nonce) internal virtual { uint256 current = _useNonce(owner); if (nonce != current) { revert InvalidAccountNonce(owner, current); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using * {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/Checkpoints.sol) // This file was procedurally generated from scripts/generate/templates/Checkpoints.js. pragma solidity ^0.8.20; import {Math} from "../math/Math.sol"; /** * @dev This library defines the `Trace*` struct, for checkpointing values as they change at different points in * time, and later looking up past values by block number. See {Votes} as an example. * * To create a history of checkpoints define a variable type `Checkpoints.Trace*` in your contract, and store a new * checkpoint for the current transaction block using the {push} function. */ library Checkpoints { /** * @dev A value was attempted to be inserted on a past checkpoint. */ error CheckpointUnorderedInsertion(); struct Trace224 { Checkpoint224[] _checkpoints; } struct Checkpoint224 { uint32 _key; uint224 _value; } /** * @dev Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint. * * Returns previous value and new value. * * IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint32).max` key set will disable the * library. */ function push(Trace224 storage self, uint32 key, uint224 value) internal returns (uint224, uint224) { return _insert(self._checkpoints, key, value); } /** * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if * there is none. */ function lowerLookup(Trace224 storage self, uint32 key) internal view returns (uint224) { uint256 len = self._checkpoints.length; uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len); return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value; } /** * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero * if there is none. */ function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) { uint256 len = self._checkpoints.length; uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len); return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero * if there is none. * * NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high * keys). */ function upperLookupRecent(Trace224 storage self, uint32 key) internal view returns (uint224) { uint256 len = self._checkpoints.length; uint256 low = 0; uint256 high = len; if (len > 5) { uint256 mid = len - Math.sqrt(len); if (key < _unsafeAccess(self._checkpoints, mid)._key) { high = mid; } else { low = mid + 1; } } uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high); return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints. */ function latest(Trace224 storage self) internal view returns (uint224) { uint256 pos = self._checkpoints.length; return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value * in the most recent checkpoint. */ function latestCheckpoint(Trace224 storage self) internal view returns (bool exists, uint32 _key, uint224 _value) { uint256 pos = self._checkpoints.length; if (pos == 0) { return (false, 0, 0); } else { Checkpoint224 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1); return (true, ckpt._key, ckpt._value); } } /** * @dev Returns the number of checkpoint. */ function length(Trace224 storage self) internal view returns (uint256) { return self._checkpoints.length; } /** * @dev Returns checkpoint at given position. */ function at(Trace224 storage self, uint32 pos) internal view returns (Checkpoint224 memory) { return self._checkpoints[pos]; } /** * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint, * or by updating the last one. */ function _insert(Checkpoint224[] storage self, uint32 key, uint224 value) private returns (uint224, uint224) { uint256 pos = self.length; if (pos > 0) { // Copying to memory is important here. Checkpoint224 memory last = _unsafeAccess(self, pos - 1); // Checkpoint keys must be non-decreasing. if (last._key > key) { revert CheckpointUnorderedInsertion(); } // Update or push new checkpoint if (last._key == key) { _unsafeAccess(self, pos - 1)._value = value; } else { self.push(Checkpoint224({_key: key, _value: value})); } return (last._value, value); } else { self.push(Checkpoint224({_key: key, _value: value})); return (0, value); } } /** * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` * if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive * `high`. * * WARNING: `high` should not be greater than the array's length. */ function _upperBinaryLookup( Checkpoint224[] storage self, uint32 key, uint256 low, uint256 high ) private view returns (uint256) { while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(self, mid)._key > key) { high = mid; } else { low = mid + 1; } } return high; } /** * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or * `high` if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and * exclusive `high`. * * WARNING: `high` should not be greater than the array's length. */ function _lowerBinaryLookup( Checkpoint224[] storage self, uint32 key, uint256 low, uint256 high ) private view returns (uint256) { while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(self, mid)._key < key) { low = mid + 1; } else { high = mid; } } return high; } /** * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds. */ function _unsafeAccess( Checkpoint224[] storage self, uint256 pos ) private pure returns (Checkpoint224 storage result) { assembly { mstore(0, self.slot) result.slot := add(keccak256(0, 0x20), pos) } } struct Trace208 { Checkpoint208[] _checkpoints; } struct Checkpoint208 { uint48 _key; uint208 _value; } /** * @dev Pushes a (`key`, `value`) pair into a Trace208 so that it is stored as the checkpoint. * * Returns previous value and new value. * * IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint48).max` key set will disable the * library. */ function push(Trace208 storage self, uint48 key, uint208 value) internal returns (uint208, uint208) { return _insert(self._checkpoints, key, value); } /** * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if * there is none. */ function lowerLookup(Trace208 storage self, uint48 key) internal view returns (uint208) { uint256 len = self._checkpoints.length; uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len); return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value; } /** * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero * if there is none. */ function upperLookup(Trace208 storage self, uint48 key) internal view returns (uint208) { uint256 len = self._checkpoints.length; uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len); return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero * if there is none. * * NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high * keys). */ function upperLookupRecent(Trace208 storage self, uint48 key) internal view returns (uint208) { uint256 len = self._checkpoints.length; uint256 low = 0; uint256 high = len; if (len > 5) { uint256 mid = len - Math.sqrt(len); if (key < _unsafeAccess(self._checkpoints, mid)._key) { high = mid; } else { low = mid + 1; } } uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high); return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints. */ function latest(Trace208 storage self) internal view returns (uint208) { uint256 pos = self._checkpoints.length; return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value * in the most recent checkpoint. */ function latestCheckpoint(Trace208 storage self) internal view returns (bool exists, uint48 _key, uint208 _value) { uint256 pos = self._checkpoints.length; if (pos == 0) { return (false, 0, 0); } else { Checkpoint208 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1); return (true, ckpt._key, ckpt._value); } } /** * @dev Returns the number of checkpoint. */ function length(Trace208 storage self) internal view returns (uint256) { return self._checkpoints.length; } /** * @dev Returns checkpoint at given position. */ function at(Trace208 storage self, uint32 pos) internal view returns (Checkpoint208 memory) { return self._checkpoints[pos]; } /** * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint, * or by updating the last one. */ function _insert(Checkpoint208[] storage self, uint48 key, uint208 value) private returns (uint208, uint208) { uint256 pos = self.length; if (pos > 0) { // Copying to memory is important here. Checkpoint208 memory last = _unsafeAccess(self, pos - 1); // Checkpoint keys must be non-decreasing. if (last._key > key) { revert CheckpointUnorderedInsertion(); } // Update or push new checkpoint if (last._key == key) { _unsafeAccess(self, pos - 1)._value = value; } else { self.push(Checkpoint208({_key: key, _value: value})); } return (last._value, value); } else { self.push(Checkpoint208({_key: key, _value: value})); return (0, value); } } /** * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` * if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive * `high`. * * WARNING: `high` should not be greater than the array's length. */ function _upperBinaryLookup( Checkpoint208[] storage self, uint48 key, uint256 low, uint256 high ) private view returns (uint256) { while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(self, mid)._key > key) { high = mid; } else { low = mid + 1; } } return high; } /** * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or * `high` if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and * exclusive `high`. * * WARNING: `high` should not be greater than the array's length. */ function _lowerBinaryLookup( Checkpoint208[] storage self, uint48 key, uint256 low, uint256 high ) private view returns (uint256) { while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(self, mid)._key < key) { low = mid + 1; } else { high = mid; } } return high; } /** * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds. */ function _unsafeAccess( Checkpoint208[] storage self, uint256 pos ) private pure returns (Checkpoint208 storage result) { assembly { mstore(0, self.slot) result.slot := add(keccak256(0, 0x20), pos) } } struct Trace160 { Checkpoint160[] _checkpoints; } struct Checkpoint160 { uint96 _key; uint160 _value; } /** * @dev Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint. * * Returns previous value and new value. * * IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint96).max` key set will disable the * library. */ function push(Trace160 storage self, uint96 key, uint160 value) internal returns (uint160, uint160) { return _insert(self._checkpoints, key, value); } /** * @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if * there is none. */ function lowerLookup(Trace160 storage self, uint96 key) internal view returns (uint160) { uint256 len = self._checkpoints.length; uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len); return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value; } /** * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero * if there is none. */ function upperLookup(Trace160 storage self, uint96 key) internal view returns (uint160) { uint256 len = self._checkpoints.length; uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len); return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero * if there is none. * * NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high * keys). */ function upperLookupRecent(Trace160 storage self, uint96 key) internal view returns (uint160) { uint256 len = self._checkpoints.length; uint256 low = 0; uint256 high = len; if (len > 5) { uint256 mid = len - Math.sqrt(len); if (key < _unsafeAccess(self._checkpoints, mid)._key) { high = mid; } else { low = mid + 1; } } uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high); return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints. */ function latest(Trace160 storage self) internal view returns (uint160) { uint256 pos = self._checkpoints.length; return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value; } /** * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value * in the most recent checkpoint. */ function latestCheckpoint(Trace160 storage self) internal view returns (bool exists, uint96 _key, uint160 _value) { uint256 pos = self._checkpoints.length; if (pos == 0) { return (false, 0, 0); } else { Checkpoint160 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1); return (true, ckpt._key, ckpt._value); } } /** * @dev Returns the number of checkpoint. */ function length(Trace160 storage self) internal view returns (uint256) { return self._checkpoints.length; } /** * @dev Returns checkpoint at given position. */ function at(Trace160 storage self, uint32 pos) internal view returns (Checkpoint160 memory) { return self._checkpoints[pos]; } /** * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint, * or by updating the last one. */ function _insert(Checkpoint160[] storage self, uint96 key, uint160 value) private returns (uint160, uint160) { uint256 pos = self.length; if (pos > 0) { // Copying to memory is important here. Checkpoint160 memory last = _unsafeAccess(self, pos - 1); // Checkpoint keys must be non-decreasing. if (last._key > key) { revert CheckpointUnorderedInsertion(); } // Update or push new checkpoint if (last._key == key) { _unsafeAccess(self, pos - 1)._value = value; } else { self.push(Checkpoint160({_key: key, _value: value})); } return (last._value, value); } else { self.push(Checkpoint160({_key: key, _value: value})); return (0, value); } } /** * @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` * if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive * `high`. * * WARNING: `high` should not be greater than the array's length. */ function _upperBinaryLookup( Checkpoint160[] storage self, uint96 key, uint256 low, uint256 high ) private view returns (uint256) { while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(self, mid)._key > key) { high = mid; } else { low = mid + 1; } } return high; } /** * @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or * `high` if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and * exclusive `high`. * * WARNING: `high` should not be greater than the array's length. */ function _lowerBinaryLookup( Checkpoint160[] storage self, uint96 key, uint256 low, uint256 high ) private view returns (uint256) { while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(self, mid)._key < key) { low = mid + 1; } else { high = mid; } } return high; } /** * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds. */ function _unsafeAccess( Checkpoint160[] storage self, uint256 pos ) private pure returns (Checkpoint160 storage result) { assembly { mstore(0, self.slot) result.slot := add(keccak256(0, 0x20), pos) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/types/Time.sol) pragma solidity ^0.8.20; import {Math} from "../math/Math.sol"; import {SafeCast} from "../math/SafeCast.sol"; /** * @dev This library provides helpers for manipulating time-related objects. * * It uses the following types: * - `uint48` for timepoints * - `uint32` for durations * * While the library doesn't provide specific types for timepoints and duration, it does provide: * - a `Delay` type to represent duration that can be programmed to change value automatically at a given point * - additional helper functions */ library Time { using Time for *; /** * @dev Get the block timestamp as a Timepoint. */ function timestamp() internal view returns (uint48) { return SafeCast.toUint48(block.timestamp); } /** * @dev Get the block number as a Timepoint. */ function blockNumber() internal view returns (uint48) { return SafeCast.toUint48(block.number); } // ==================================================== Delay ===================================================== /** * @dev A `Delay` is a uint32 duration that can be programmed to change value automatically at a given point in the * future. The "effect" timepoint describes when the transitions happens from the "old" value to the "new" value. * This allows updating the delay applied to some operation while keeping some guarantees. * * In particular, the {update} function guarantees that if the delay is reduced, the old delay still applies for * some time. For example if the delay is currently 7 days to do an upgrade, the admin should not be able to set * the delay to 0 and upgrade immediately. If the admin wants to reduce the delay, the old delay (7 days) should * still apply for some time. * * * The `Delay` type is 112 bits long, and packs the following: * * ``` * | [uint48]: effect date (timepoint) * | | [uint32]: value before (duration) * ↓ ↓ ↓ [uint32]: value after (duration) * 0xAAAAAAAAAAAABBBBBBBBCCCCCCCC * ``` * * NOTE: The {get} and {withUpdate} functions operate using timestamps. Block number based delays are not currently * supported. */ type Delay is uint112; /** * @dev Wrap a duration into a Delay to add the one-step "update in the future" feature */ function toDelay(uint32 duration) internal pure returns (Delay) { return Delay.wrap(duration); } /** * @dev Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled * change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered. */ function _getFullAt(Delay self, uint48 timepoint) private pure returns (uint32, uint32, uint48) { (uint32 valueBefore, uint32 valueAfter, uint48 effect) = self.unpack(); return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect); } /** * @dev Get the current value plus the pending value and effect timepoint if there is a scheduled change. If the * effect timepoint is 0, then the pending value should not be considered. */ function getFull(Delay self) internal view returns (uint32, uint32, uint48) { return _getFullAt(self, timestamp()); } /** * @dev Get the current value. */ function get(Delay self) internal view returns (uint32) { (uint32 delay, , ) = self.getFull(); return delay; } /** * @dev Update a Delay object so that it takes a new duration after a timepoint that is automatically computed to * enforce the old delay at the moment of the update. Returns the updated Delay object and the timestamp when the * new delay becomes effective. */ function withUpdate( Delay self, uint32 newValue, uint32 minSetback ) internal view returns (Delay updatedDelay, uint48 effect) { uint32 value = self.get(); uint32 setback = uint32(Math.max(minSetback, value > newValue ? value - newValue : 0)); effect = timestamp() + setback; return (pack(value, newValue, effect), effect); } /** * @dev Split a delay into its components: valueBefore, valueAfter and effect (transition timepoint). */ function unpack(Delay self) internal pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) { uint112 raw = Delay.unwrap(self); valueAfter = uint32(raw); valueBefore = uint32(raw >> 32); effect = uint48(raw >> 64); return (valueBefore, valueAfter, effect); } /** * @dev pack the components into a Delay object. */ function pack(uint32 valueBefore, uint32 valueAfter, uint48 effect) internal pure returns (Delay) { return Delay.wrap((uint112(effect) << 64) | (uint112(valueBefore) << 32) | uint112(valueAfter)); } }
pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; }
pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {ERC20Votes} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; abstract contract ERC20Snapshot is ERC20Votes { uint48 private _snapshotId = 1; event ERC20SnapshotCheckpointed(uint48 id); function clock() public view virtual override returns (uint48) { return _snapshotId; } // solhint-disable-next-line func-name-mixedcase function CLOCK_MODE() public view virtual override returns (string memory) { // Check that the clock was not modified if (clock() != _snapshotId) { revert ERC6372InconsistentClock(); } return "mode=counter"; } function delegates(address account) public pure override returns (address) { return account; } function _snapshot() public virtual returns (uint256) { uint48 currentId = _snapshotId++; emit ERC20SnapshotCheckpointed(currentId); return currentId; } }
interface IWETH { function deposit() external payable; function transfer(address to, uint value) external returns (bool); function withdraw(uint) external; }
pragma solidity ^0.8.0; contract OptimizedIterableSet { // Using mapping to store whether an element exists mapping(uint256 => bool) private set; // Maintain an array to store the order of added elements uint256[] private values; // Additional mapping to store the index of each element in the array mapping(uint256 => uint256) private indexOf; // Add an element to the set function add(uint256 value) public { // If the element already exists, return immediately if (set[value]) { remove(value); } // Mark the element as existing set[value] = true; // Add the element to the array values.push(value); // Store the index of the element in the array indexOf[value] = values.length - 1; } // Remove an element from the set function remove(uint256 value) public { // If the element does not exist, return immediately require(set[value], "Value not in set"); // Mark the element as non-existing set[value] = false; // Find the index of the element in the array uint256 index = indexOf[value]; // Move the last element in the array to the position of the element to be removed uint256 lastValue = values[values.length - 1]; values[index] = lastValue; // Update the index of the last element indexOf[lastValue] = index; // Remove the last element from the array values.pop(); // Delete the index mapping for the removed element delete indexOf[value]; } // Check if an element exists in the set function contains(uint256 value) public view returns (bool) { return set[value]; } // Get the number of elements in the set function size() public view returns (uint256) { return values.length; } // Get all elements in the set as an array function getValues() public view returns (uint256[] memory) { return values; } // Access a specific element in the set by index function getValueAt(uint256 index) public view returns (uint256) { require(index < values.length, "Index out of bounds"); return values[index]; } }
pragma solidity =0.8.23; import {ERC20Burnable, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; contract PointToken is Ownable, ERC20Burnable { constructor( string memory name, string memory symbol ) Ownable(msg.sender) ERC20(name, symbol) {} function mint(address to, uint256 amount) external onlyOwner { _mint(to, amount); } function burnFrom( address account, uint256 value ) public override onlyOwner { _burn(account, value); } }
pragma solidity =0.8.23; import {ERC20Snapshot} from "./extensions/ERC20Snapshot.sol"; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; import {IERC20, ERC20, IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {PointToken, Ownable} from "./extensions/PointToken.sol"; import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; contract MegadropBBB is ERC20Snapshot, Ownable { struct DropToken { address token; string name; string symbol; uint256 totalSupply; uint256 dropAmt; uint256 snapshotId; } DropToken[] dropTokens; IERC20 private immutable _underlying; uint256 public price; mapping(address => mapping(uint256 => bool)) public claimed; event Drop( address droper, string name, string symbol, uint256 totalSupply, uint256 dropAmt ); /** * @dev The underlying token couldn't be wrapped. */ error ERC20InvalidUnderlying(address token); constructor() ERC20("Megadrop BBB", "mBBB") EIP712("mBBB", "1") Ownable(msg.sender) { //mainnet _underlying = IERC20(0xFa4dDcFa8E3d0475f544d0de469277CF6e0A6Fd1); //devnet // _underlying = IERC20(0x1796a4cAf25f1a80626D8a2D26595b19b11697c9); price = 257000 ether; } /** * @dev See {ERC20-decimals}. */ function decimals() public view virtual override returns (uint8) { try IERC20Metadata(address(_underlying)).decimals() returns ( uint8 value ) { return value; } catch { return super.decimals(); } } /** * @dev Returns the address of the underlying ERC-20 token that is being wrapped. */ function underlying() public view returns (IERC20) { return _underlying; } /** * @dev Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens. */ function depositFor( address account, uint256 value ) public virtual returns (bool) { address sender = _msgSender(); if (sender == address(this)) { revert ERC20InvalidSender(address(this)); } if (account == address(this)) { revert ERC20InvalidReceiver(account); } SafeERC20.safeTransferFrom(_underlying, sender, address(this), value); _mint(account, value); return true; } /** * @dev Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens. */ function withdrawTo( address account, uint256 value ) public virtual returns (bool) { if (account == address(this)) { revert ERC20InvalidReceiver(account); } _burn(_msgSender(), value); SafeERC20.safeTransfer(_underlying, account, value); return true; } /** * @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal * function that can be exposed with access control if desired. */ function _recover(address account) internal virtual returns (uint256) { uint256 value = _underlying.balanceOf(address(this)) - totalSupply(); _mint(account, value); return value; } function drop( string calldata name, string calldata symbol, uint256 totalSupply, uint256 dropPercent ) external { require(dropPercent <= 100, "MegadropBBB: invalid drop percent"); PointToken dropToken = new PointToken(name, symbol); uint256 dropAmt = (totalSupply * dropPercent) / 100; uint256 mintAmt = totalSupply - dropAmt; if (mintAmt > 0) { dropToken.mint(_msgSender(), mintAmt); } if (dropAmt > 0) { dropTokens.push( DropToken( address(dropToken), name, symbol, totalSupply, dropAmt, clock() ) ); _snapshot(); } ERC20Burnable(address(_underlying)).burnFrom(_msgSender(), price); emit Drop(msg.sender, name, symbol, totalSupply, dropAmt); } function claim(uint256 index) external { DropToken memory dropToken = dropTokens[index]; require(!claimed[_msgSender()][index], "MegadropBBB: already claimed"); uint256 claimAmt = getClaimAmt(index, _msgSender()); PointToken(dropToken.token).mint(_msgSender(), claimAmt); claimed[_msgSender()][index] = true; } function getClaimAmt( uint256 index, address account ) public view returns (uint256) { DropToken memory dropToken = dropTokens[index]; require( dropToken.token != address(0), "MegadropBBB: invalid drop token" ); uint256 snapshotTotalSupply = getPastTotalSupply(dropToken.snapshotId); if (snapshotTotalSupply == 0) { return 0; } uint256 snapshotAmt = getPastVotes(account, dropToken.snapshotId); uint256 claimAmt = (dropToken.dropAmt * snapshotAmt) / snapshotTotalSupply; return claimAmt; } function getDropToken( uint256 index ) external view returns (DropToken memory) { return dropTokens[index]; } function getDropTokenLength() external view returns (uint256) { return dropTokens.length; } function setPrice(uint256 _price) external onlyOwner { price = _price; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"uint256","name":"deployFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"deployer","type":"address"},{"indexed":false,"internalType":"uint256","name":"maxXdc","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"createTime","type":"uint256"}],"name":"Drop","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":"uint256","name":"index","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"tradeType","type":"string"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"open","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"close","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xdcAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"Trade","type":"event"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"contains","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultMinXdcCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"delegateAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deployFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"twitter","type":"string"},{"internalType":"uint256","name":"maxXdcCap","type":"uint256"}],"name":"drop","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"dropTokens","outputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"deployFee","type":"uint256"},{"internalType":"address","name":"deployer","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"},{"internalType":"uint256","name":"maxXdc","type":"uint256"},{"internalType":"uint256","name":"removed","type":"uint256"},{"internalType":"uint256","name":"xdcAmount","type":"uint256"},{"internalType":"uint256","name":"createTime","type":"uint256"},{"internalType":"uint256","name":"dropAmt","type":"uint256"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"twitter","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emptyDropToken","outputs":[{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"deployFee","type":"uint256"},{"internalType":"address","name":"deployer","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"},{"internalType":"uint256","name":"maxXdc","type":"uint256"},{"internalType":"uint256","name":"removed","type":"uint256"},{"internalType":"uint256","name":"xdcAmount","type":"uint256"},{"internalType":"uint256","name":"createTime","type":"uint256"},{"internalType":"uint256","name":"dropAmt","type":"uint256"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"twitter","type":"string"}],"internalType":"struct BBBPumpFun.DropToken","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"foundation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getBuyAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"getClaimAmt","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getDropToken","outputs":[{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"deployFee","type":"uint256"},{"internalType":"address","name":"deployer","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"},{"internalType":"uint256","name":"maxXdc","type":"uint256"},{"internalType":"uint256","name":"removed","type":"uint256"},{"internalType":"uint256","name":"xdcAmount","type":"uint256"},{"internalType":"uint256","name":"createTime","type":"uint256"},{"internalType":"uint256","name":"dropAmt","type":"uint256"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"twitter","type":"string"}],"internalType":"struct BBBPumpFun.DropToken","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getDropTokenByAddress","outputs":[{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"deployFee","type":"uint256"},{"internalType":"address","name":"deployer","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"},{"internalType":"uint256","name":"maxXdc","type":"uint256"},{"internalType":"uint256","name":"removed","type":"uint256"},{"internalType":"uint256","name":"xdcAmount","type":"uint256"},{"internalType":"uint256","name":"createTime","type":"uint256"},{"internalType":"uint256","name":"dropAmt","type":"uint256"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"twitter","type":"string"}],"internalType":"struct BBBPumpFun.DropToken","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDropTokenLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getKlineLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestDropToken","outputs":[{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"deployFee","type":"uint256"},{"internalType":"address","name":"deployer","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"},{"internalType":"uint256","name":"maxXdc","type":"uint256"},{"internalType":"uint256","name":"removed","type":"uint256"},{"internalType":"uint256","name":"xdcAmount","type":"uint256"},{"internalType":"uint256","name":"createTime","type":"uint256"},{"internalType":"uint256","name":"dropAmt","type":"uint256"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"twitter","type":"string"}],"internalType":"struct BBBPumpFun.DropToken","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestKing","outputs":[{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"deployFee","type":"uint256"},{"internalType":"address","name":"deployer","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"},{"internalType":"uint256","name":"maxXdc","type":"uint256"},{"internalType":"uint256","name":"removed","type":"uint256"},{"internalType":"uint256","name":"xdcAmount","type":"uint256"},{"internalType":"uint256","name":"createTime","type":"uint256"},{"internalType":"uint256","name":"dropAmt","type":"uint256"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"twitter","type":"string"}],"internalType":"struct BBBPumpFun.DropToken","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestTrade","outputs":[{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"tradeType","type":"string"},{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"xdcAmount","type":"uint256"}],"internalType":"struct BBBPumpFun.TradeObj","name":"","type":"tuple"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getSellAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getTradeVolume","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getValueAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getValues","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"k","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"klineMap","outputs":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"open","type":"uint256"},{"internalType":"uint256","name":"close","type":"uint256"},{"internalType":"uint256","name":"tradeAmt","type":"uint256"},{"internalType":"uint256","name":"xdcAmt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestKingIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTrade","outputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"tradeType","type":"string"},{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"xdcAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"megadropBBBV1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"remove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sell","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deployFee","type":"uint256"}],"name":"setDeployFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_foundation","type":"address"}],"name":"setFoundation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_swapFee","type":"uint256"}],"name":"setSwapFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_defaultMinXdcCap","type":"uint256"}],"name":"setdefaultMinXdcCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"size","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenMapping","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2Factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"string","name":"imageUrl","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"string","name":"telegram","type":"string"},{"internalType":"string","name":"twitter","type":"string"}],"name":"updateToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6080806040523461011757331561010157600080546001600160a01b03198082163390811784556040519373951857744785e80e2de051c32ee7b25f9c458c42936001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a360018055732475dcd4fe333be814ef7c8f8ce8a1e9b5fcdea081601554161760155568056bc75e2d631000006011557337c00ae5c4b49ab0f5fd2ffb1033588e9bc33b0881600f541617600f55739e6d21e759a7a288b80eef94e4737d313d31c13f81601054161760105569d3c21bcecceda100000060125560135416176013556064601455615d7e90816200011d8239f35b631e4fbdf760e01b815260006004820152602490fd5b600080fdfe6102a08060405260043610156200001557600080fd5b60006101e0526101e0513560e01c90816309ab8bba14620032e7575080631003e2d214620032c757806319eb4a901462003201578063240df4da14620031bd57806326a49e37146200319b57806327e4ae1114620031785780632f3339a4146200314657806334e19907146200311c5780633fc8cef314620030ef57806341fbb05014620030c25780634bbc4fc81462001e725780634ca2e5291462001c645780634cc822151462001c445780634dd6c8de1462001beb578063524991881462001bc957806354cf2aeb1462001ba757806356d68a2d1462001b8957806359d0f7131462001b5c578063633eaf7f1462001b395780636791ff211462001b17578063715018a61462001ab357806376bc979614620019f7578063780a802614620018ce57806381f06363146200187e57806384c6352214620018515780638a173ebc14620017e05780638da5cb5b14620017b1578063949d225d146200178f578063a6348c241462001769578063a9e52987146200173f578063aa5fac1d14620010f1578063ae418c6914620010c7578063b41481ea1462000f76578063b4f40c611462000f4c578063ba27f50b1462000f0a578063bc6b888b1462000e92578063c34052e01462000e5b578063d5982ae61462000e38578063d79875eb146200098e578063d96a094a14620004d6578063db3543f5146200048a578063ddd5e1b21462000368578063e49a629d1462000333578063eb2a5d2c1462000311578063edb64abe14620002ef5763f2fde38b146200025157600080fd5b34620002e8576020366003190112620002e8576200026e62003346565b6200027862004961565b6001600160a01b03908116908115620002cd57600054826001600160601b0360a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a36101e05180f35b604051631e4fbdf760e01b81526101e0516004820152602490fd5b6101e05180fd5b34620002e8576101e051366003190112620002e8576020601254604051908152f35b34620002e8576101e051366003190112620002e8576020601154604051908152f35b34620002e8576020366003190112620002e857620003646200035760043562004713565b60405191829182620033bb565b0390f35b34620002e8576040366003190112620002e8576004356200038862003362565b336101e05152600d60205260406101e05120826101e0515260205260ff60406101e05120541615620003bc575b6101e05180f35b602090620003ca8362004713565b620003d68285620038d0565b5050509201516001600160a01b039290831690813b15620002e8576040516340c10f1960e01b81526101e08051336004840152602483019390935251909283916044918391905af180156200047c5762000461575b50166101e05152600d60205260406101e05120906101e0515260205260406101e05120600160ff198254161790558080620003b5565b6200046c90620035ed565b6101e051620002e857836200042b565b6040513d6101e051823e3d90fd5b34620002e8576020366003190112620002e857620004a762003346565b620004b162004961565b60018060a01b03166001600160601b0360a01b60155416176015556101e0516101e051f35b6020366003190112620002e857600435620004f06200498e565b620004fd34151562004655565b620005088162004713565b906200051a610100830151156200458c565b6000198101818111620008355762000532906200352b565b506101208301516127106200054a601454346200389b565b0490620005588234620037b0565b91801590811562000953575b5050620005718462003a35565b916101e0519162000583828262003e72565b60e08801805190949110620009365750620005a4620005ac918451620037b0565b8092620037b0565b6101e05181156200092c575b6101e051918291829182913390f1156200047c57916001915160098501555b620005e383866200412a565b60208701516001600160a01b039790881692909190833b15620002e8576040516340c10f1960e01b81526101e0805133600484015260248301859052905191959091869160449183915af19081156200047c57899489926200090a575b50602094957fd860d1de00a1d83be8b8df62fd06b6d6fca5e947c0e8fe25892528a4be1c62b9916001620006748562003a35565b9214620008f9575b836101e05152600c8752620006c060406101e0512060405190620006a08262003601565b428252838a8301528460408301528760608301528b6080830152620045e9565b620006da888888015116958a6040519485944286620046b3565b0390a3620006e886620037d4565b01511693604051620006fa816200361d565b848152602081019586526200070e620046f2565b9586604083015262000754836060840192428452608085019433865260a0810197885251600655511660018060a01b03166001600160601b0360a01b6007541617600755565b86516001600160401b038111620008df576200077d81620007776008546200357d565b62003eca565b60206001601f8311146200085b579080620007ba92620007e19798999a6101e051926200084f575b50508160011b916000199060031b1c19161790565b6008555b51600955511660018060a01b03166001600160601b0360a01b600a541617600a55565b51600b5560098101549060648202918083046064149015171562000835576007015490605082029180830460501490151715620008355710156200082b575b600180556101e05180f35b600e558062000820565b634e487b7160e01b6101e05152601160045260246101e051fd5b015190508a80620007a5565b601f1982169860086101e0515260008051602062005d29833981519152996101e0515b818110620008c6575091620007e19798999a91846001959410620008ac575b505050811b01600855620007be565b015160001960f88460031b161c191690558980806200089d565b838301518c556001909b019a602093840193016200087e565b634e487b7160e01b6101e05152604160045260246101e051fd5b6200090484620049ed565b6200067c565b909450620009199150620035ed565b6101e051620002e8578688938a62000640565b506108fc620005b8565b92505091600984016200094b84825462003e72565b9055620005d7565b60018060a01b03601554166101e0519262000983575b6101e05192839283928392f1156200047c57858062000564565b6108fc925062000969565b34620002e8576200099f3662003744565b620009a96200498e565b801562000de157620009bb8262004713565b91620009cd610100840151156200458c565b620009d88162003a35565b92620009e58383620043be565b9260001983018381116200083557620009fe906200352b565b5062000a0f856009830154620037b0565b600982015560208301516001600160a01b0316803b15620002e85760405163079cc67960e41b81526101e0805133600484015260248301869052905191929091839160449183915af180156200047c5762000dc6575b5062000a8461271062000a7b601454886200389b565b048096620037b0565b946101e051861562000dbc575b6101e051908190819081908a903390f1156200047c57801590811562000d81575b50506009810154600a81111562000d39575b5050827fd860d1de00a1d83be8b8df62fd06b6d6fca5e947c0e8fe25892528a4be1c62b961010062000af68362003a35565b836101e05152600c60205262000b3c60406101e051206040519062000b1b8262003601565b4282528b60208301528360408301528760608301528a6080830152620045e9565b60018060a01b03602087015116946040519160c08352600460c0840152631cd95b1b60e21b9a8b60e08501524260208501526040840152606083015288608083015260a0820152a362000b8f82620037d4565b60200151604051916001600160a01b039091169062000bae836200361d565b8252602082019081526040519362000bc68562003639565b600485526020850152604082018490524260608301908152336080840190815260a0840194855292516006559051600780546001600160a01b0319166001600160a01b039290921691909117905583516001600160401b038111620008df5762000c3781620007776008546200357d565b60206001601f83111462000cb757908062000c719262000c9c96976101e0519262000cab5750508160011b916000199060031b1c19161790565b6008555b5160095551600a80546001600160a01b0319166001600160a01b0392909216919091179055565b51600b55600180556101e05180f35b015190508780620007a5565b601f1982169560086101e0515260008051602062005d29833981519152966101e0515b81811062000d2057509162000c9c96979184600195941062000d06575b505050811b0160085562000c75565b015160001960f88460031b161c1916905586808062000cf7565b8383015189556001909801976020938401930162000cda565b6015546101e05191906001600160a01b0316811562000d76575b6101e05192839283928392f1156200047c5760096101e051910155858062000ac4565b6108fc925062000d53565b60018060a01b03601554166101e0519262000db1575b6101e05192839283928392f1156200047c57868062000ab2565b6108fc925062000d97565b506108fc62000a91565b62000dd190620035ed565b6101e051620002e8578662000a65565b60405162461bcd60e51b815260206004820152602960248201527f4d65676164726f7042424256323a20616d6f756e74206d75737420677265617460448201526806572207468616e20360bc1b6064820152608490fd5b34620002e8576101e051366003190112620002e857620003646200035762004498565b34620002e8576020366003190112620002e8576004356101e051526002602052602060ff60406101e0512054166040519015158152f35b34620002e8576020366003190112620002e85760043560035481101562000ecf5762000ec060209162003778565b90549060031b1c604051908152f35b60405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606490fd5b34620002e8576020366003190112620002e8576001600160a01b0362000f2f62003346565b166101e051526017602052602060406101e0512054604051908152f35b34620002e8576101e051366003190112620002e85760206040516a108b2a2c280290940000008152f35b34620002e857602080600319360112620002e8576004356101e05152600c815260406101e051209081546001600160401b038111620008df5760056040519362000fc6848460051b018662003671565b828552838501906101e05152836101e05120846101e051925b858410620010795787826101e0516101e0516101e0515b84518110156200106b576200101e6080938462001014848962004483565b5101519062003e72565b926200102b828762004483565b515162015180810180911162000835574211156200104e575b5060010162000ff6565b81926200106391620010146001948962004483565b919062001044565b506040928351928352820152f35b60019185916040516200108c8162003601565b855481528486015483820152600286015460408201526003860154606082015260048601546080820152815201920192019190859062000fdf565b34620002e8576020366003190112620002e857620010e462004961565b6004356012556101e05180f35b34620002e85760c0366003190112620002e8576024356001600160401b038111620002e85762001126903690600401620034fb565b906044356001600160401b038111620002e85762001149903690600401620034fb565b6064929192356001600160401b038111620002e8576200116e903690600401620034fb565b6084356001600160401b038111620002e85762001190903690600401620034fb565b92909360a4356001600160401b038111620002e857620011b5903690600401620034fb565b9790986000196004350160043581116200083557620011d4906200352b565b5060058101549098906001600160a01b03163303620016fa57620012456101008084111580620016f0575b6200120a9062003c4a565b8086111580620016e6575b620012209062003cbd565b6200122e8189111562003d30565b6200123c818a111562003d90565b8b111562003df1565b6001600160401b038211620008df57620012728262001268600c8c01546200357d565b600c8c0162003f30565b6101e05190601f83116001146200166d57918091620012aa936101e05192620016615750508160011b916000199060031b1c19161790565b600c8801555b6001600160401b038211620008df57620012dd82620012d3600d8a01546200357d565b600d8a0162003f30565b6101e05190601f8311600114620015e55791809162001315936101e05192620015d95750508160011b916000199060031b1c19161790565b600d8601555b6001600160401b038211620008df5762001348826200133e600e8801546200357d565b600e880162003f30565b6101e05190601f83116001146200155d5791809162001380936101e05192620014db5750508160011b916000199060031b1c19161790565b600e8401555b600f8301916001600160401b038211620008df57620013b282620013ab85546200357d565b8562003f30565b6101e05190601f8311600114620014e7579180620013ee9260109695946101e05192620014db5750508160011b916000199060031b1c19161790565b90555b01906001600160401b038111620008df576200141a816200141384546200357d565b8462003f30565b6101e051601f8211600114620014665781906200145193946101e051926200145a5750508160011b916000199060031b1c19161790565b90556101e05180f35b013590508480620007a5565b601f19821693836101e0515260209160206101e05120926101e051905b878210620014c2575050836001959610620014a7575b505050811b019055620003b5565b0135600019600384901b60f8161c1916905583808062001499565b8060018496829495870135815501950192019062001483565b013590508880620007a5565b6101e080518590525160208082209391601f198616915b828210620015445750509160019391856010989796941062001529575b505050811b019055620013f1565b0135600019600384901b60f8161c191690558780806200151b565b80600185978294968801358155019601930190620014fe565b600e86939293016101e0515260206101e05120906101e051935b601f1984168510620015c0576001945083601f19811610620015a5575b505050811b01600e84015562001386565b0135600019600384901b60f8161c1916905587808062001594565b8181013583556020948501946001909301920162001577565b013590508a80620007a5565b600d88939293016101e0515260206101e05120906101e051935b601f198416851062001648576001945083601f198116106200162d575b505050811b01600d8601556200131b565b0135600019600384901b60f8161c191690558980806200161c565b81810135835560209485019460019093019201620015ff565b013590508c80620007a5565b601f19831691600c8b016101e0515260206101e05120926101e0515b818110620016cd5750908460019594939210620016b2575b505050811b01600c880155620012b0565b0135600019600384901b60f8161c191690558b8080620016a1565b9193602060018192878701358155019501920162001689565b5085151562001215565b50831515620011ff565b60405162461bcd60e51b815260206004820152601c60248201527f4d65676164726f7042424256323a206d757374206465706c6f796572000000006044820152606490fd5b34620002e8576020366003190112620002e8576200175c62004961565b6004356011556101e05180f35b34620002e857602062001787620017803662003744565b90620043be565b604051908152f35b34620002e8576101e051366003190112620002e8576020600354604051908152f35b34620002e8576101e051366003190112620002e8576101e051546040516001600160a01b039091168152602090f35b34620002e857620017f13662003744565b906101e05152600c60205260406101e051208054821015620002e85760a0916200181b916200375b565b50805490600181015490600281015460046003830154920154926040519485526020850152604084015260608301526080820152f35b34620002e8576101e051366003190112620002e857600f546040516001600160a01b039091168152602090f35b34620002e8576020366003190112620002e8576200189b62003346565b620018a562003a7f565b5060018060a01b03166101e051526017602052620003646200035760406101e051205462004713565b34620002e8576101e051366003190112620002e857600654600754604051600854600093926001600160a01b039290831691816200190c826200357d565b968782526020978893600190600181169081600014620019d4575060011462001982575b5050620019409250038262003671565b6200196e60095493600a541691600b5493604051978897885287015260c0604087015260c086019062003379565b926060850152608084015260a08301520390f35b90939150600860005260008051602062005d29833981519152936000915b818310620019bb575089945050820101620019408962001930565b85548784018501529485019486945091830191620019a0565b9150506200194094925060ff191682840152151560051b82010187928962001930565b34620002e8576101e051366003190112620002e85762001aa46200036462001a1e62004319565b919392949062001a95604051968796608088528151608089015260a0602083015192600180831b03809416828b015262001a68604082015160c0808d01526101408c019062003379565b93606082015160e08c01526080820151166101008b01520151610120890152878203602089015262003379565b90858203604087015262003379565b90838203606085015262003379565b34620002e8576101e051366003190112620002e85762001ad262004961565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a36101e05180f35b34620002e8576101e051366003190112620002e8576020600554604051908152f35b34620002e8576101e051366003190112620002e8576200036462000357620041eb565b34620002e8576101e051366003190112620002e8576010546040516001600160a01b039091168152602090f35b34620002e85760206200178762001ba03662003744565b906200412a565b34620002e8576101e051366003190112620002e8576020601454604051908152f35b34620002e8576101e051366003190112620002e8576020600e54604051908152f35b34620002e8576040366003190112620002e8576001600160a01b0362001c1062003346565b166101e05152600d60205260406101e051206024356101e05152602052602060ff60406101e0512054166040519015158152f35b34620002e8576020366003190112620002e857620003b560043562003f8b565b34620002e8576020366003190112620002e857600435600554811015620002e85762001c90906200352b565b50805461024052600181015481906001600160a01b039081169062001cb86002840162003693565b6102805262001cca6003840162003693565b90600484015490600585015416600685015460078601546008870154600988015491600a89015493600b8a015495600c8b0162001d079062003693565b9862001d16600d8d0162003693565b9a62001d25600e8e0162003693565b9c600f0162001d349062003693565b9d60100162001d439062003693565b61022052604051610260526102209061024051610260515261026051602001528061026051604001526102605101610280519062001d819162003379565b610260518103610260516060015262001d9a9162003379565b9761026051608001526102605160a001526102605160c001526102605160e0015261026051610100015261026051610120015261026051610140015261026051610160015261026051810361026051610180015262001df99162003379565b610260518103610260516101a0015262001e139162003379565b610260518103610260516101c0015262001e2d9162003379565b610260518103610260516101e0015262001e479162003379565b6102605181036102605161020001526102605190610220519062001e6b9162003379565b0361026051f35b610100366003190112620002e8576004356001600160401b038111620002e85762001ea2903690600401620034fb565b6101a0526101c0526024356001600160401b038111620002e85762001ecc903690600401620034fb565b61010052610120526044356001600160401b038111620002e85762001ef6903690600401620034fb565b610200526064356001600160401b038111620002e85762001f1c903690600401620034fb565b6084929192356001600160401b038111620002e85762001f41903690600401620034fb565b60a4356001600160401b038111620002e85762001f63903690600401620034fb565b9060a0529360c4356001600160401b038111620002e85762001f8a903690600401620034fb565b60c05260e05262001f9a6200498e565b60e435610140526011548034106200307d5760146101a05111158062003070575b156200300d57600a6101005111158062003000575b1562002f95576101006102005111158062002f88575b62001ff19062003c4a565b6101008511158062002f7e575b620020099062003cbd565b6200201961010084111562003d30565b6200202961010087111562003d90565b6200203b61010060c051111562003df1565b8062002f40575b5060405180610e0e8101106001600160401b03610e0e83011117620008df57610e0e62004f1b82396040610e0e82015280620020af620020916040610e0e8401016101a0516101c05162003e51565b610e0e830181036020610e0e85010152610100516101205162003e51565b03906101e051f06101605261016051156200047c576012548060e4351062002f35575b50600554610180526001610180510161018051116200083557620021f795620021e494620021c4620021d49360115460405160805262002114608051620035ba565b600161018051016080515260018060a01b0361016051166020608051015262002145366101a0516101c05162003e80565b604060805101526200215f36610100516101205162003e80565b606060805101526080805101523360a060805101526101e05160c060805101526101405160e060805101526101e05161010060805101526101e05161012060805101524261014060805101526101e05161016060805101523690610200519062003e80565b6101806080510152369162003e80565b6101a06080510152369162003e80565b6101c06080510152369060a05162003e80565b6101e06080510152620022103660c05160e05162003e80565b6102006080510152600160401b610180511015620008df576001610180510160055562002240610180516200352b565b62002f19576080518051825560208101516001830180546001600160a01b0319166001600160a01b0392909216919091179055604001518051906001600160401b038211620008df57620022a7826200229d60028601546200357d565b6002860162003f30565b6020906001601f84111462002e9c57918091620022dd936101e0519262002c1f5750508160011b916000199060031b1c19161790565b60028201555b606060805101518051906001600160401b038211620008df576200231a826200231060038601546200357d565b6003860162003f30565b6020906001601f84111462002e1f5791809162002350936101e0519262002c1f5750508160011b916000199060031b1c19161790565b60038201555b6080805190810151600483015560a08101516005830180546001600160a01b0319166001600160a01b039290921691909117905560c0810151600683015560e0810151600783015561010081015160088301556101208101516009830155610140810151600a830155610160810151600b83015561018001518051906001600160401b038211620008df57620023ff82620023f5600c8601546200357d565b600c860162003f30565b6020906001601f84111462002da25791809162002435936101e0519262002c1f5750508160011b916000199060031b1c19161790565b600c8201555b6101a060805101518051906001600160401b038211620008df57620024738262002469600d8601546200357d565b600d860162003f30565b6020906001601f84111462002d2557918091620024a9936101e0519262002c1f5750508160011b916000199060031b1c19161790565b600d8201555b6101c060805101518051906001600160401b038211620008df57620024e782620024dd600e8601546200357d565b600e860162003f30565b6020906001601f84111462002ca8579180916200251d936101e0519262002c1f5750508160011b916000199060031b1c19161790565b600e8201555b6101e060805101518051906001600160401b038211620008df576200255b8262002551600f8601546200357d565b600f860162003f30565b6020906001601f84111462002c2b5791809162002591936101e0519262002c1f5750508160011b916000199060031b1c19161790565b600f8201555b61020060805101518051906001600160401b038211620008df57620025cf82620025c560108601546200357d565b6010860162003f30565b6020906001601f84111462002ba457918062002607926010946101e0519262002b985750508160011b916000199060031b1c19161790565b9101555b60018060a01b0361016051166101e0515260176020526001610180510160406101e05120556200264160016101805101620037d4565b6011547f8313c79c7a19472d355c917f0bdeb0bfcf3e5945e4b5da4eac84bed6efeb0a3160405160016101805101815260018060a01b0361016051166020820152610100604082015280620026bc620026a661010083016101a0516101c05162003e51565b8281036060840152610100516101205162003e51565b8460808301523360a08301526101405160c08301524260e08301520390a1620026e68134620037b0565b620026f657600180556101e05180f35b620027029034620037b0565b6200270f81151562004655565b620027206001610180510162004713565b9062002732610100830151156200458c565b62002740610180516200352b565b509161012081015191620027676127106200275e601454846200389b565b048092620037b0565b90801590811562002b5d575b5050620027866001610180510162003a35565b926101e05162002797838362003e72565b60e08501511162002b405750620005a4620027b79160e0850151620037b0565b6101e051811562002b36575b6101e051918291829182913390f1156200047c579160019060e083015160098601555b620027f884600161018051016200412a565b9160018060a01b0360208501511690813b15620002e8576040516340c10f1960e01b81526101e0805133600484015260248301879052905191939091849160449183915af19081156200047c577fd860d1de00a1d83be8b8df62fd06b6d6fca5e947c0e8fe25892528a4be1c62b992879262002b24575b5060016200288281610180510162003a35565b911462002b0d575b600161018051016101e05152600c602052620028d660406101e0512060405190620028b58262003601565b428252866020830152836040830152876060830152846080830152620045e9565b620028fe60018060a01b036020880151169560405193849360016101805101974286620046b3565b0390a36200291260016101805101620037d4565b60200151604051919062002991906001600160a01b031662002934846200361d565b600161018051018452602084019081526200294e620046f2565b6040850181905242606086015233608086015260a0850193909352835160065551600780546001600160a01b0319166001600160a01b0392909216919091179055565b8051906001600160401b038211620008df57620029b582620007776008546200357d565b6020906001601f84111462002a8a579180620029ee9260a095946101e0519262002a7e5750508160011b916000199060031b1c19161790565b6008555b606081015160095562002a27600180841b0360808301511660018060a01b03166001600160601b0360a01b600a541617600a55565b0151600b55600981015490606482029180830460641490151715620008355760070154906050820291808304605014901517156200083557101562002a6e575b8062000820565b60016101805101600e5562002a67565b015190508680620007a5565b9060086101e0515260008051602062005d29833981519152916101e0515b601f198516811062002af4575091839160019360a09695601f1981161062002ada575b505050811b01600855620029f2565b015160001960f88460031b161c1916905585808062002acb565b9192602060018192868501518155019401920162002aa8565b62002b1e60016101805101620049ed565b6200288a565b62002b2f90620035ed565b886200286f565b506108fc620027c3565b919390506009850162002b5585825462003e72565b9055620027e6565b60018060a01b03601554166101e0519262002b8d575b6101e05192839283928392f1156200047c57848062002773565b6108fc925062002b73565b015190508580620007a5565b90601084016101e0515260206101e05120916101e0515b601f198516811062002c065750918391600193601095601f1981161062002bec575b505050811b019101556200260b565b015160001960f88460031b161c1916905584808062002bdd565b9192602060018192868501518155019401920162002bbb565b015190508480620007a5565b9190600f84016101e0515260206101e05120906101e051935b601f198416851062002c8c576001945083601f1981161062002c72575b505050811b01600f82015562002597565b015160001960f88460031b161c1916905583808062002c61565b8181015183556020948501946001909301929091019062002c44565b9190600e84016101e0515260206101e05120906101e051935b601f198416851062002d09576001945083601f1981161062002cef575b505050811b01600e82015562002523565b015160001960f88460031b161c1916905583808062002cde565b8181015183556020948501946001909301929091019062002cc1565b9190600d84016101e0515260206101e05120906101e051935b601f198416851062002d86576001945083601f1981161062002d6c575b505050811b01600d820155620024af565b015160001960f88460031b161c1916905583808062002d5b565b8181015183556020948501946001909301929091019062002d3e565b9190600c84016101e0515260206101e05120906101e051935b601f198416851062002e03576001945083601f1981161062002de9575b505050811b01600c8201556200243b565b015160001960f88460031b161c1916905583808062002dd8565b8181015183556020948501946001909301929091019062002dbb565b9190600384016101e0515260206101e05120906101e051935b601f198416851062002e80576001945083601f1981161062002e66575b505050811b01600382015562002356565b015160001960f88460031b161c1916905583808062002e55565b8181015183556020948501946001909301929091019062002e38565b9190600284016101e0515260206101e05120906101e051935b601f198416851062002efd576001945083601f1981161062002ee3575b505050811b016002820155620022e3565b015160001960f88460031b161c1916905583808062002ed2565b8181015183556020948501946001909301929091019062002eb5565b634e487b7160e01b6101e051526101e05160045260246101e051fd5b6101405286620020d2565b6015546101e05191906001600160a01b0316811562002f73575b6101e05192839283928392f1156200047c578662002042565b6108fc925062002f5a565b5084151562001ffe565b5061020051151562001fe6565b60405162461bcd60e51b815260206004820152603760248201527f4d65676164726f7042424256323a2073796d626f6c206e656564206c6573732060448201527f313020627974657320616e6420677420302062797465730000000000000000006064820152608490fd5b5061010051151562001fd0565b60405162461bcd60e51b815260206004820152603560248201527f4d65676164726f7042424256323a206e616d65206e656564206c65737320323060448201527420627974657320616e64206774203020627974657360581b6064820152608490fd5b506101a051151562001fbb565b60405162461bcd60e51b815260206004820152601e60248201527f4d65676164726f7042424256323a20696e636f72726563742076616c756500006044820152606490fd5b34620002e8576101e051366003190112620002e8576015546040516001600160a01b039091168152602090f35b34620002e8576101e051366003190112620002e8576013546040516001600160a01b039091168152602090f35b34620002e8576020366003190112620002e8576200313962004961565b6004356014556101e05180f35b34620002e8576020366003190112620002e8576004356101e05152600c602052602060406101e0512054604051908152f35b34620002e8576101e051366003190112620002e857620003646200035762003c07565b34620002e8576020366003190112620002e85760206200178760043562003a35565b34620002e8576040366003190112620002e8576080620031e9620031e062003362565b600435620038d0565b91604051938452602084015260408301526060820152f35b34620002e8576101e051366003190112620002e857604051806003548083526020809301809160036101e051527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b906101e0515b86828210620032b25786866200326e8288038362003671565b60405192839281840190828552518091526040840192916101e0515b8281106200329a57505050500390f35b8351855286955093810193928101926001016200328a565b83548552909301926001928301920162003255565b34620002e8576020366003190112620002e857620003b5600435620037d4565b34620002e8576040366003190112620002e8576020906200330762003346565b6200331162003362565b9060018060a01b038091166101e051526016845260406101e0512091166101e05152825260ff60406101e05120541615158152f35b600435906001600160a01b03821682036200335d57565b600080fd5b602435906001600160a01b03821682036200335d57565b919082519283825260005b848110620033a6575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520162003384565b90620034f891602081528151602082015260208201519060018060a01b0380921660408201526040830151620034006102209182606085015261024084019062003379565b926200341f606086015194601f19958686830301608087015262003379565b90608086015160a085015260a08601511660c084015260c085015160e0840152620034e7620034cf620034b76200349f60e089015161010090818901528901516101209081890152890151610140908189015289015161016090818901528901516101809081890152890151946101a0958989830301878a015262003379565b93880151936101c09488888303018689015262003379565b92870151926101e09387878303018588015262003379565b91860151916102009286868303018487015262003379565b940151928285030191015262003379565b90565b9181601f840112156200335d578235916001600160401b0383116200335d57602083818601950101116200335d57565b60055481101562003567576011906005600052027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00190600090565b634e487b7160e01b600052603260045260246000fd5b90600182811c92168015620035af575b60208310146200359957565b634e487b7160e01b600052602260045260246000fd5b91607f16916200358d565b61022081019081106001600160401b03821117620035d757604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b038111620035d757604052565b60a081019081106001600160401b03821117620035d757604052565b60c081019081106001600160401b03821117620035d757604052565b604081019081106001600160401b03821117620035d757604052565b602081019081106001600160401b03821117620035d757604052565b90601f801991011681019081106001600160401b03821117620035d757604052565b90604051918260008254620036a8816200357d565b90818452602094600191600181169081600014620037205750600114620036dd575b505050620036db9250038362003671565b565b600090815285812095935091905b81831062003707575050620036db9350820101388080620036ca565b85548884018501529485019487945091830191620036eb565b92505050620036db94925060ff191682840152151560051b820101388080620036ca565b60409060031901126200335d576004359060243590565b805482101562003567576000526005602060002091020190600090565b600354811015620035675760036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0190600090565b91908203918211620037be57565b634e487b7160e01b600052601160045260246000fd5b6000818152600260205260ff6040822054166200388a575b818152600260205260408120805460ff19166001179055600354600160401b8110156200387657826200382a82600162003843940160035562003778565b90919082549060031b91821b91600019901b1916179055565b6003546000198101929083116200386257815260046020526040902055565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b82526041600452602482fd5b620038958262003f8b565b620037ec565b81810292918115918404141715620037be57565b8115620038ba570490565b634e487b7160e01b600052601260045260246000fd5b620038db9062004713565b60c0810190815191821562003a235760018060a01b03600f54169060405193632394e7a360e21b855260048501526020948585602481865afa948515620039cb57600095620039eb575b508415620039d7579051604051630748d63560e31b81526001600160a01b0390921660048301526024820152908490829060449082905afa938415620039cb5760009462003993575b50506101600151926200398d826200398785876200389b565b620038af565b93929190565b9080929450813d8311620039c3575b620039ae818362003671565b810103126200335d575191610160386200396e565b503d620039a2565b6040513d6000823e3d90fd5b505050505050600090600090600090600090565b90948682813d831162003a1b575b62003a05818362003671565b8101031262003a18575051933862003925565b80fd5b503d620039f9565b50505050600090600090600090600090565b62003a436101209162004713565b01516ec097ce7bc90715b34b9f100000000090818102918183041490151715620037be576a108b2a2c28029094000000620034f8910462004802565b6040519062003a8e82620035ba565b8161020060009182815282602082015260609283604083015283808301528060808301528060a08301528060c08301528060e083015280610100830152806101208301528061014083015261016082015282610180820152826101a0820152826101c0820152826101e08201520152565b9060405162003b0e81620035ba565b61020062003c02601083958054855260018060a01b0380600183015416602087015262003b3e6002830162003693565b604087015262003b516003830162003693565b60608701526004820154608087015260058201541660a0860152600681015460c0860152600781015460e086015260088101546101008601526009810154610120860152600a810154610140860152600b81015461016086015262003bb9600c820162003693565b61018086015262003bcd600d820162003693565b6101a086015262003be1600e820162003693565b6101c086015262003bf5600f820162003693565b6101e08601520162003693565b910152565b62003c1162003a7f565b50600e54801562003c3f576000198101908111620037be5762003c38620034f8916200352b565b5062003aff565b50620034f862004498565b1562003c5257565b60405162461bcd60e51b815260206004820152603a60248201527f4d65676164726f7042424256323a20696d61676555726c206e656564206c657360448201527f732032353620627974657320616e6420677420302062797465730000000000006064820152608490fd5b1562003cc557565b60405162461bcd60e51b815260206004820152603d60248201527f4d65676164726f7042424256323a206465736372697074696f6e206e6565642060448201527f6c6573732032353620627974657320616e6420677420302062797465730000006064820152608490fd5b1562003d3857565b60405162461bcd60e51b815260206004820152602a60248201527f4d65676164726f7042424256323a2077656273697465206e656564206c6573736044820152692032353620627974657360b01b6064820152608490fd5b1562003d9857565b60405162461bcd60e51b815260206004820152602b60248201527f4d65676164726f7042424256323a2074656c656772616d206e656564206c657360448201526a732032353620627974657360a81b6064820152608490fd5b1562003df957565b60405162461bcd60e51b815260206004820152602a60248201527f4d65676164726f7042424256323a2074776974746572206e656564206c6573736044820152692032353620627974657360b01b6064820152608490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b91908201809211620037be57565b9291926001600160401b038211620035d7576040519162003eac601f8201601f19166020018462003671565b8294818452818301116200335d578281602093846000960137010152565b601f811162003ed7575050565b600090600860005260008051602062005d29833981519152906020601f850160051c8301941062003f25575b601f0160051c01915b82811062003f1957505050565b81815560010162003f0c565b909250829062003f03565b90601f811162003f3f57505050565b6000916000526020600020906020601f850160051c8301941062003f80575b601f0160051c01915b82811062003f7457505050565b81815560010162003f67565b909250829062003f5e565b60009080825260206002815260409160ff8385205416156200405e5780845260028252828420805460ff19169055600482528284205460035460001991908281019081116200404a5762003fdf9062003778565b90549060031b1c62003ff6816200382a8462003778565b86526004845284862055600354801562004036579080600494939201906200401e8262003778565b909182549160031b1b19169055600355845252812055565b634e487b7160e01b86526031600452602486fd5b634e487b7160e01b87526011600452602487fd5b50606491519062461bcd60e51b82526004820152601060248201526f15985b1d59481b9bdd081a5b881cd95d60821b6044820152fd5b8015620041245780806001146200411d5760021462004117576001908161013382101682600b831016176200410f57906002815b808211620040e257505081600019048111620037be570290565b909280600019048111620037be5781841662004105575b800292811c90620040c8565b80920291620040f9565b600291500a90565b50600490565b5050600190565b50600090565b6004906020906001600160a01b03908290620041469062004713565b015116604051928380926318160ddd60e01b82525afa908115620039cb57600091620041b3575b50620041798162004094565b916a108b2a2c280290940000009080820291820403620037be57620041a7620041ad91620034f89462003e72565b62004802565b620037b0565b90506020813d602011620041e2575b81620041d16020938362003671565b810103126200335d5751386200416d565b3d9150620041c2565b620041f562003a7f565b50600554801562003c3f576000198101908111620037be5762003c38620034f8916200352b565b604051906200422b826200361d565b81600654815260018060a01b038060075416602090818401526040519081600060085462004259816200357d565b80845290600190818116908115620042f75750600114620042a5575b5050620042859250038262003671565b60408301526009546060830152600a5416608082015260a0600b54910152565b90939150600860005260008051602062005d29833981519152936000915b818310620042de575050620042859350820101388062004275565b85548784018501529485019486945091830191620042c3565b9150506200428594925060ff191682840152151560051b820101388062004275565b60a0604080516200432a816200361d565b6000928184809352826020820152606084820152826060820152826080820152015260065480156200437e576200436391925062004713565b90810151916101806060830151920151906200398d6200421c565b50620043896200421c565b928151620043978162003655565b838152928251620043a88162003655565b818152925190620043b98262003655565b815290565b6004906020906001600160a01b03908290620043da9062004713565b015116604051928380926318160ddd60e01b82525afa908115620039cb5760009162004440575b5080620044356200442e620044276a108b2a2c28029094000000956200443c95620037b0565b9262004094565b9162004094565b90620037b0565b0490565b90506020813d6020116200447a575b816200445e6020938362003671565b810103126200335d57516a108b2a2c2802909400000062004401565b3d91506200444f565b8051821015620035675760209160051b010190565b620044a262003a7f565b506040805190620044b382620035ba565b6000908183528160208401528051620044cc8162003655565b828152818401528051620044e08162003655565b82815260608401528160808401528160a08401528160c08401528160e0840152816101008401528161012084015281610140840152816101608401528051620045298162003655565b82815261018084015280516200453f8162003655565b8281526101a08401528051620045558162003655565b8281526101c084015280516200456b8162003655565b8281526101e08401525190620045818262003655565b815261020082015290565b156200459457565b60405162461bcd60e51b815260206004820152602760248201527f4d65676164726f7042424256323a206c697175696c747920616c7265616479206044820152661c995b5bdd995960ca1b6064820152608490fd5b8054600160401b811015620035d75762004609916001820181556200375b565b9190916200463f576080816004925184556020810151600185015560408101516002850155606081015160038501550151910155565b634e487b7160e01b600052600060045260246000fd5b156200465d57565b60405162461bcd60e51b815260206004820152602860248201527f4d65676164726f7042424256323a2076616c7565206d75737420677265617465604482015267072207468616e20360c41b6064820152608490fd5b919260a093969594919660c08452600360c08501526262757960e81b60e085015261010084019760208501526040840152606083015260808201520152565b60405190620047018262003639565b600382526262757960e81b6020830152565b6200471d62003a7f565b5080151580620047f5575b15620047b0576000198101908111620037be5762003c386200474a916200352b565b60208101516001600160a01b031615620047615790565b60405162461bcd60e51b815260206004820152602160248201527f4d65676164726f7042424256323a20696e76616c69642064726f7020746f6b656044820152603760f91b6064820152608490fd5b60405162461bcd60e51b815260206004820152601c60248201527f4d65676164726f7042424256323a20496e76616c696420696e646578000000006044820152606490fd5b5060055481111562004728565b80156200412457620048e6816000908360801c8062004954575b508060401c8062004946575b508060201c8062004938575b508060101c806200492a575b508060081c806200491c575b508060041c806200490e575b508060021c8062004900575b50600191828092811c620048f8575b1c1b620048818185620038af565b01811c620048908185620038af565b01811c6200489f8185620038af565b01811c620048ae8185620038af565b01811c620048bd8185620038af565b01811c620048cc8185620038af565b01811c620048db8185620038af565b01901c8092620038af565b80821015620048f3575090565b905090565b018162004873565b600291509101903862004864565b600491509101903862004858565b60089150910190386200484c565b601091509101903862004840565b602091509101903862004834565b604091509101903862004828565b915050608090386200481c565b6000546001600160a01b031633036200497657565b60405163118cdaa760e01b8152336004820152602490fd5b600260015414620049a0576002600155565b604051633ee5aeb560e01b8152600490fd5b908160209103126200335d57516001600160a01b03811681036200335d5790565b908160209103126200335d575180151581036200335d5790565b6000906000198101908111620038625762004a08906200352b565b506010546013546001830180546040805163e6a4390560e01b81526001600160a01b0394851660048083018290529386166024830181905260209998939794969593949293929091908616908a85604481855afa94851562004def57908b9392918b9662004ef6575b508786161562004e6e575b505050508460098401549189868254168951938480926318160ddd60e01b82525afa91821562004dc057899262004e39575b50606082029180159281810460601484171562004e265760649004928160021b9182048914171562004e135760649004600b8601558560135416803b1562004df957898491898b5180948193630d0e30db60e41b83525af1801562004def5762004dfd575b5085815416803b1562004df95788516340c10f1960e01b815230818a0190815260208101859052909392918b9185919082908490829060400103925af1801562004def578892888c938e9362004dca575b548c5163a9059cbb60e01b8082526001600160a01b038b169782019788526020880194909452929650919492938593849003604001928492165af1801562004dc0579162004be593918b9362004d9e575b508660135416908a8a518096819582948352898d840160209093929193604081019460018060a01b031681520152565b03925af1801562004d9457602488938a93879362004d60575b5088516335313c2160e11b815230898201529485938492165af1801562004d275790879162004d31575b505060016008820155828683600f54168651928380926324776b7d60e21b82525afa90811562004d275791879391879593869162004ccd575b5065ffffffffffff60069116910155600f541690845180968193632d84f2e360e21b83525af191821562004cc357505062004c9a575050565b813d831162004cbb575b62004cb0818362003671565b810103126200335d57565b503d62004ca4565b51903d90823e3d90fd5b929480929496508391503d831162004d1f575b62004cec818362003671565b8101031262004d1b575165ffffffffffff8116810362004d1b57859387939092909165ffffffffffff62004c61565b8580fd5b503d62004ce0565b85513d88823e3d90fd5b813d831162004d58575b62004d47818362003671565b810103126200335d57853862004c28565b503d62004d3b565b62004d8490853d871162004d8c575b62004d7b818362003671565b810190620049d3565b503862004bfe565b503d62004d6f565b86513d89823e3d90fd5b62004db890843d861162004d8c5762004d7b818362003671565b503862004bb5565b88513d8b823e3d90fd5b9450509362004dda9150620035ed565b62004deb57888a83888a9462004b64565b8880fd5b89513d8c823e3d90fd5b8980fd5b62004e0b90999199620035ed565b973862004b13565b634e487b7160e01b8a526011885260248afd5b634e487b7160e01b8b526011895260248bfd5b9091508981813d831162004e66575b62004e54818362003671565b8101031262004deb5751903862004aae565b503d62004e48565b89516364e329cb60e11b81526001600160a01b039182168a8201908152939091166020840152939450839182908b90829060400103925af190811562004d9457879162004ec2575b50908738808062004a7c565b62004ee79150883d8a1162004eee575b62004ede818362003671565b810190620049b2565b3862004eb6565b503d62004ed2565b62004f12919650843d861162004eee5762004ede818362003671565b943862004a7156fe608060405234620003805762000e0e803803806200001d8162000385565b9283398101604082820312620003805781516001600160401b03908181116200038057826200004e918501620003c1565b926020928382015183811162000380576200006a9201620003c1565b923315620003675760008054336001600160a01b0319821681178355919591906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08780a381519083821162000353576004958654926001948585811c9516801562000348575b8886101462000335578190601f95868111620002e2575b5088908683116001146200027e57849262000272575b5050600019600383901b1c191690851b1787555b81519485116200025f576005968754908582811c9216801562000254575b88831014620002415750838111620001fb575b50859285116001146200019457939450849291908362000188575b50501b916000199060031b1c19161790555b6040516109da9081620004348239f35b01519250388062000166565b86815285812093958591601f198316915b88838310620001e05750505010620001c6575b505050811b01905562000178565b015160001960f88460031b161c19169055388080620001b8565b858701518855909601959485019487935090810190620001a5565b878252868220848088018a1c82019289891062000237575b01891c019085905b8281106200022b5750506200014b565b8381550185906200021b565b9250819262000213565b634e487b7160e01b835260229052602482fd5b91607f169162000138565b634e487b7160e01b815260418752602490fd5b01519050388062000106565b8a85528985208894509190601f198416865b8c828210620002cb5750508411620002b1575b505050811b0187556200011a565b015160001960f88460031b161c19169055388080620002a3565b8385015186558b9790950194938401930162000290565b9091508984528884208680850160051c8201928b86106200032b575b918991869594930160051c01915b8281106200031c575050620000f0565b8681558594508991016200030c565b92508192620002fe565b634e487b7160e01b835260228952602483fd5b94607f1694620000d9565b634e487b7160e01b86526041600452602486fd5b604051631e4fbdf760e01b815260006004820152602490fd5b600080fd5b6040519190601f01601f191682016001600160401b03811183821017620003ab57604052565b634e487b7160e01b600052604160045260246000fd5b919080601f84011215620003805782516001600160401b038111620003ab57602090620003f7601f8201601f1916830162000385565b92818452828287010111620003805760005b8181106200041f57508260009394955001015290565b85810183015184820184015282016200040956fe6080604081815260048036101561001557600080fd5b600092833560e01c90816306fdde031461068557508063095ea7b3146105dc57806318160ddd146105bd57806323b872dd146104ca578063313ce567146104ae57806340c10f19146103fe57806342966c68146103e057806370a08231146103a8578063715018a61461034e57806379cc67901461031b5780638da5cb5b146102f357806395d89b41146101cf578063a9059cbb1461019e578063dd62ed3e146101515763f2fde38b146100c857600080fd5b3461014d57602036600319011261014d576100e16107c3565b906100ea6108d4565b6001600160a01b0391821692831561013757505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8280fd5b50503461019a578060031936011261019a578060209261016f6107c3565b6101776107de565b6001600160a01b0391821683526002865283832091168252845220549051908152f35b5080fd5b50503461019a578060031936011261019a576020906101c86101be6107c3565b60243590336107f4565b5160018152f35b5091903461019a578160031936011261019a578051908260055460018160011c90600183169283156102e9575b60209384841081146102d6578388529081156102ba5750600114610264575b505050829003601f01601f191682019267ffffffffffffffff841183851017610251575082918261024d92528261077a565b0390f35b634e487b7160e01b815260418552602490fd5b600587529192508591837f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db05b8385106102a6575050505083010138808061021b565b805488860183015293019284908201610290565b60ff1916878501525050151560051b840101905038808061021b565b634e487b7160e01b895260228a52602489fd5b91607f16916101fc565b50503461019a578160031936011261019a57905490516001600160a01b039091168152602090f35b50503461019a5736600319011261034b576103486103376107c3565b61033f6108d4565b60243590610900565b80f35b80fd5b833461034b578060031936011261034b576103676108d4565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461019a57602036600319011261019a5760209181906001600160a01b036103d06107c3565b1681526001845220549051908152f35b83823461019a57602036600319011261019a57610348903533610900565b50903461014d578060031936011261014d576104186107c3565b90602435916104256108d4565b6001600160a01b03169283156104995760035490838201809211610486575084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef926020926003558585526001835280852082815401905551908152a380f35b634e487b7160e01b865260119052602485fd5b84602492519163ec442f0560e01b8352820152fd5b50503461019a578160031936011261019a576020905160128152f35b50823461034b57606036600319011261034b576104e56107c3565b6104ed6107de565b916044359360018060a01b038316808352600260205286832033845260205286832054916000198303610529575b6020886101c88989896107f4565b86831061059157811561057a573315610563575082526002602090815286832033845281529186902090859003905582906101c88761051b565b8751634a1406b160e11b8152908101849052602490fd5b875163e602df0560e01b8152908101849052602490fd5b8751637dc7a0d960e11b8152339181019182526020820193909352604081018790528291506060010390fd5b50503461019a578160031936011261019a576020906003549051908152f35b503461014d578160031936011261014d576105f56107c3565b60243590331561066e576001600160a01b031691821561065757508083602095338152600287528181208582528752205582519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925843392a35160018152f35b8351634a1406b160e11b8152908101859052602490fd5b835163e602df0560e01b8152808401869052602490fd5b849150833461014d578260031936011261014d5782845460018160011c9060018316928315610770575b60209384841081146102d65783885290811561075457506001146106ff57505050829003601f01601f191682019267ffffffffffffffff841183851017610251575082918261024d92528261077a565b8787529192508591837f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b838510610740575050505083010185808061021b565b80548886018301529301928490820161072a565b60ff1916878501525050151560051b840101905085808061021b565b91607f16916106af565b6020808252825181830181905290939260005b8281106107af57505060409293506000838284010152601f8019910116010190565b81810186015184820160400152850161078d565b600435906001600160a01b03821682036107d957565b600080fd5b602435906001600160a01b03821682036107d957565b916001600160a01b038084169283156108bb57169283156108a2576000908382526001602052604082205490838210610870575091604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95876020965260018652038282205586815220818154019055604051908152a3565b60405163391434e360e21b81526001600160a01b03919091166004820152602481019190915260448101839052606490fd5b60405163ec442f0560e01b815260006004820152602490fd5b604051634b637e8f60e11b815260006004820152602490fd5b6000546001600160a01b031633036108e857565b60405163118cdaa760e01b8152336004820152602490fd5b91906001600160a01b0383169081156108bb578160005260016020526040600020549381851061097257506020817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9260009596858752600184520360408620558060035403600355604051908152a3565b60405163391434e360e21b81526001600160a01b03919091166004820152602481018590526044810191909152606490fdfea2646970667358221220197028fdf3b86fa4d96b8b3d0b837425ee2c5efb6994f96d0af7a0a3907a56ac64736f6c63430008170033f3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3a2646970667358221220e0c4a1ef0d6a631c1c25252725455079ee066ec97d388a8ec01f36e8969b9c3464736f6c63430008170033
Deployed Bytecode
0x6102a08060405260043610156200001557600080fd5b60006101e0526101e0513560e01c90816309ab8bba14620032e7575080631003e2d214620032c757806319eb4a901462003201578063240df4da14620031bd57806326a49e37146200319b57806327e4ae1114620031785780632f3339a4146200314657806334e19907146200311c5780633fc8cef314620030ef57806341fbb05014620030c25780634bbc4fc81462001e725780634ca2e5291462001c645780634cc822151462001c445780634dd6c8de1462001beb578063524991881462001bc957806354cf2aeb1462001ba757806356d68a2d1462001b8957806359d0f7131462001b5c578063633eaf7f1462001b395780636791ff211462001b17578063715018a61462001ab357806376bc979614620019f7578063780a802614620018ce57806381f06363146200187e57806384c6352214620018515780638a173ebc14620017e05780638da5cb5b14620017b1578063949d225d146200178f578063a6348c241462001769578063a9e52987146200173f578063aa5fac1d14620010f1578063ae418c6914620010c7578063b41481ea1462000f76578063b4f40c611462000f4c578063ba27f50b1462000f0a578063bc6b888b1462000e92578063c34052e01462000e5b578063d5982ae61462000e38578063d79875eb146200098e578063d96a094a14620004d6578063db3543f5146200048a578063ddd5e1b21462000368578063e49a629d1462000333578063eb2a5d2c1462000311578063edb64abe14620002ef5763f2fde38b146200025157600080fd5b34620002e8576020366003190112620002e8576200026e62003346565b6200027862004961565b6001600160a01b03908116908115620002cd57600054826001600160601b0360a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a36101e05180f35b604051631e4fbdf760e01b81526101e0516004820152602490fd5b6101e05180fd5b34620002e8576101e051366003190112620002e8576020601254604051908152f35b34620002e8576101e051366003190112620002e8576020601154604051908152f35b34620002e8576020366003190112620002e857620003646200035760043562004713565b60405191829182620033bb565b0390f35b34620002e8576040366003190112620002e8576004356200038862003362565b336101e05152600d60205260406101e05120826101e0515260205260ff60406101e05120541615620003bc575b6101e05180f35b602090620003ca8362004713565b620003d68285620038d0565b5050509201516001600160a01b039290831690813b15620002e8576040516340c10f1960e01b81526101e08051336004840152602483019390935251909283916044918391905af180156200047c5762000461575b50166101e05152600d60205260406101e05120906101e0515260205260406101e05120600160ff198254161790558080620003b5565b6200046c90620035ed565b6101e051620002e857836200042b565b6040513d6101e051823e3d90fd5b34620002e8576020366003190112620002e857620004a762003346565b620004b162004961565b60018060a01b03166001600160601b0360a01b60155416176015556101e0516101e051f35b6020366003190112620002e857600435620004f06200498e565b620004fd34151562004655565b620005088162004713565b906200051a610100830151156200458c565b6000198101818111620008355762000532906200352b565b506101208301516127106200054a601454346200389b565b0490620005588234620037b0565b91801590811562000953575b5050620005718462003a35565b916101e0519162000583828262003e72565b60e08801805190949110620009365750620005a4620005ac918451620037b0565b8092620037b0565b6101e05181156200092c575b6101e051918291829182913390f1156200047c57916001915160098501555b620005e383866200412a565b60208701516001600160a01b039790881692909190833b15620002e8576040516340c10f1960e01b81526101e0805133600484015260248301859052905191959091869160449183915af19081156200047c57899489926200090a575b50602094957fd860d1de00a1d83be8b8df62fd06b6d6fca5e947c0e8fe25892528a4be1c62b9916001620006748562003a35565b9214620008f9575b836101e05152600c8752620006c060406101e0512060405190620006a08262003601565b428252838a8301528460408301528760608301528b6080830152620045e9565b620006da888888015116958a6040519485944286620046b3565b0390a3620006e886620037d4565b01511693604051620006fa816200361d565b848152602081019586526200070e620046f2565b9586604083015262000754836060840192428452608085019433865260a0810197885251600655511660018060a01b03166001600160601b0360a01b6007541617600755565b86516001600160401b038111620008df576200077d81620007776008546200357d565b62003eca565b60206001601f8311146200085b579080620007ba92620007e19798999a6101e051926200084f575b50508160011b916000199060031b1c19161790565b6008555b51600955511660018060a01b03166001600160601b0360a01b600a541617600a55565b51600b5560098101549060648202918083046064149015171562000835576007015490605082029180830460501490151715620008355710156200082b575b600180556101e05180f35b600e558062000820565b634e487b7160e01b6101e05152601160045260246101e051fd5b015190508a80620007a5565b601f1982169860086101e0515260008051602062005d29833981519152996101e0515b818110620008c6575091620007e19798999a91846001959410620008ac575b505050811b01600855620007be565b015160001960f88460031b161c191690558980806200089d565b838301518c556001909b019a602093840193016200087e565b634e487b7160e01b6101e05152604160045260246101e051fd5b6200090484620049ed565b6200067c565b909450620009199150620035ed565b6101e051620002e8578688938a62000640565b506108fc620005b8565b92505091600984016200094b84825462003e72565b9055620005d7565b60018060a01b03601554166101e0519262000983575b6101e05192839283928392f1156200047c57858062000564565b6108fc925062000969565b34620002e8576200099f3662003744565b620009a96200498e565b801562000de157620009bb8262004713565b91620009cd610100840151156200458c565b620009d88162003a35565b92620009e58383620043be565b9260001983018381116200083557620009fe906200352b565b5062000a0f856009830154620037b0565b600982015560208301516001600160a01b0316803b15620002e85760405163079cc67960e41b81526101e0805133600484015260248301869052905191929091839160449183915af180156200047c5762000dc6575b5062000a8461271062000a7b601454886200389b565b048096620037b0565b946101e051861562000dbc575b6101e051908190819081908a903390f1156200047c57801590811562000d81575b50506009810154600a81111562000d39575b5050827fd860d1de00a1d83be8b8df62fd06b6d6fca5e947c0e8fe25892528a4be1c62b961010062000af68362003a35565b836101e05152600c60205262000b3c60406101e051206040519062000b1b8262003601565b4282528b60208301528360408301528760608301528a6080830152620045e9565b60018060a01b03602087015116946040519160c08352600460c0840152631cd95b1b60e21b9a8b60e08501524260208501526040840152606083015288608083015260a0820152a362000b8f82620037d4565b60200151604051916001600160a01b039091169062000bae836200361d565b8252602082019081526040519362000bc68562003639565b600485526020850152604082018490524260608301908152336080840190815260a0840194855292516006559051600780546001600160a01b0319166001600160a01b039290921691909117905583516001600160401b038111620008df5762000c3781620007776008546200357d565b60206001601f83111462000cb757908062000c719262000c9c96976101e0519262000cab5750508160011b916000199060031b1c19161790565b6008555b5160095551600a80546001600160a01b0319166001600160a01b0392909216919091179055565b51600b55600180556101e05180f35b015190508780620007a5565b601f1982169560086101e0515260008051602062005d29833981519152966101e0515b81811062000d2057509162000c9c96979184600195941062000d06575b505050811b0160085562000c75565b015160001960f88460031b161c1916905586808062000cf7565b8383015189556001909801976020938401930162000cda565b6015546101e05191906001600160a01b0316811562000d76575b6101e05192839283928392f1156200047c5760096101e051910155858062000ac4565b6108fc925062000d53565b60018060a01b03601554166101e0519262000db1575b6101e05192839283928392f1156200047c57868062000ab2565b6108fc925062000d97565b506108fc62000a91565b62000dd190620035ed565b6101e051620002e8578662000a65565b60405162461bcd60e51b815260206004820152602960248201527f4d65676164726f7042424256323a20616d6f756e74206d75737420677265617460448201526806572207468616e20360bc1b6064820152608490fd5b34620002e8576101e051366003190112620002e857620003646200035762004498565b34620002e8576020366003190112620002e8576004356101e051526002602052602060ff60406101e0512054166040519015158152f35b34620002e8576020366003190112620002e85760043560035481101562000ecf5762000ec060209162003778565b90549060031b1c604051908152f35b60405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606490fd5b34620002e8576020366003190112620002e8576001600160a01b0362000f2f62003346565b166101e051526017602052602060406101e0512054604051908152f35b34620002e8576101e051366003190112620002e85760206040516a108b2a2c280290940000008152f35b34620002e857602080600319360112620002e8576004356101e05152600c815260406101e051209081546001600160401b038111620008df5760056040519362000fc6848460051b018662003671565b828552838501906101e05152836101e05120846101e051925b858410620010795787826101e0516101e0516101e0515b84518110156200106b576200101e6080938462001014848962004483565b5101519062003e72565b926200102b828762004483565b515162015180810180911162000835574211156200104e575b5060010162000ff6565b81926200106391620010146001948962004483565b919062001044565b506040928351928352820152f35b60019185916040516200108c8162003601565b855481528486015483820152600286015460408201526003860154606082015260048601546080820152815201920192019190859062000fdf565b34620002e8576020366003190112620002e857620010e462004961565b6004356012556101e05180f35b34620002e85760c0366003190112620002e8576024356001600160401b038111620002e85762001126903690600401620034fb565b906044356001600160401b038111620002e85762001149903690600401620034fb565b6064929192356001600160401b038111620002e8576200116e903690600401620034fb565b6084356001600160401b038111620002e85762001190903690600401620034fb565b92909360a4356001600160401b038111620002e857620011b5903690600401620034fb565b9790986000196004350160043581116200083557620011d4906200352b565b5060058101549098906001600160a01b03163303620016fa57620012456101008084111580620016f0575b6200120a9062003c4a565b8086111580620016e6575b620012209062003cbd565b6200122e8189111562003d30565b6200123c818a111562003d90565b8b111562003df1565b6001600160401b038211620008df57620012728262001268600c8c01546200357d565b600c8c0162003f30565b6101e05190601f83116001146200166d57918091620012aa936101e05192620016615750508160011b916000199060031b1c19161790565b600c8801555b6001600160401b038211620008df57620012dd82620012d3600d8a01546200357d565b600d8a0162003f30565b6101e05190601f8311600114620015e55791809162001315936101e05192620015d95750508160011b916000199060031b1c19161790565b600d8601555b6001600160401b038211620008df5762001348826200133e600e8801546200357d565b600e880162003f30565b6101e05190601f83116001146200155d5791809162001380936101e05192620014db5750508160011b916000199060031b1c19161790565b600e8401555b600f8301916001600160401b038211620008df57620013b282620013ab85546200357d565b8562003f30565b6101e05190601f8311600114620014e7579180620013ee9260109695946101e05192620014db5750508160011b916000199060031b1c19161790565b90555b01906001600160401b038111620008df576200141a816200141384546200357d565b8462003f30565b6101e051601f8211600114620014665781906200145193946101e051926200145a5750508160011b916000199060031b1c19161790565b90556101e05180f35b013590508480620007a5565b601f19821693836101e0515260209160206101e05120926101e051905b878210620014c2575050836001959610620014a7575b505050811b019055620003b5565b0135600019600384901b60f8161c1916905583808062001499565b8060018496829495870135815501950192019062001483565b013590508880620007a5565b6101e080518590525160208082209391601f198616915b828210620015445750509160019391856010989796941062001529575b505050811b019055620013f1565b0135600019600384901b60f8161c191690558780806200151b565b80600185978294968801358155019601930190620014fe565b600e86939293016101e0515260206101e05120906101e051935b601f1984168510620015c0576001945083601f19811610620015a5575b505050811b01600e84015562001386565b0135600019600384901b60f8161c1916905587808062001594565b8181013583556020948501946001909301920162001577565b013590508a80620007a5565b600d88939293016101e0515260206101e05120906101e051935b601f198416851062001648576001945083601f198116106200162d575b505050811b01600d8601556200131b565b0135600019600384901b60f8161c191690558980806200161c565b81810135835560209485019460019093019201620015ff565b013590508c80620007a5565b601f19831691600c8b016101e0515260206101e05120926101e0515b818110620016cd5750908460019594939210620016b2575b505050811b01600c880155620012b0565b0135600019600384901b60f8161c191690558b8080620016a1565b9193602060018192878701358155019501920162001689565b5085151562001215565b50831515620011ff565b60405162461bcd60e51b815260206004820152601c60248201527f4d65676164726f7042424256323a206d757374206465706c6f796572000000006044820152606490fd5b34620002e8576020366003190112620002e8576200175c62004961565b6004356011556101e05180f35b34620002e857602062001787620017803662003744565b90620043be565b604051908152f35b34620002e8576101e051366003190112620002e8576020600354604051908152f35b34620002e8576101e051366003190112620002e8576101e051546040516001600160a01b039091168152602090f35b34620002e857620017f13662003744565b906101e05152600c60205260406101e051208054821015620002e85760a0916200181b916200375b565b50805490600181015490600281015460046003830154920154926040519485526020850152604084015260608301526080820152f35b34620002e8576101e051366003190112620002e857600f546040516001600160a01b039091168152602090f35b34620002e8576020366003190112620002e8576200189b62003346565b620018a562003a7f565b5060018060a01b03166101e051526017602052620003646200035760406101e051205462004713565b34620002e8576101e051366003190112620002e857600654600754604051600854600093926001600160a01b039290831691816200190c826200357d565b968782526020978893600190600181169081600014620019d4575060011462001982575b5050620019409250038262003671565b6200196e60095493600a541691600b5493604051978897885287015260c0604087015260c086019062003379565b926060850152608084015260a08301520390f35b90939150600860005260008051602062005d29833981519152936000915b818310620019bb575089945050820101620019408962001930565b85548784018501529485019486945091830191620019a0565b9150506200194094925060ff191682840152151560051b82010187928962001930565b34620002e8576101e051366003190112620002e85762001aa46200036462001a1e62004319565b919392949062001a95604051968796608088528151608089015260a0602083015192600180831b03809416828b015262001a68604082015160c0808d01526101408c019062003379565b93606082015160e08c01526080820151166101008b01520151610120890152878203602089015262003379565b90858203604087015262003379565b90838203606085015262003379565b34620002e8576101e051366003190112620002e85762001ad262004961565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a36101e05180f35b34620002e8576101e051366003190112620002e8576020600554604051908152f35b34620002e8576101e051366003190112620002e8576200036462000357620041eb565b34620002e8576101e051366003190112620002e8576010546040516001600160a01b039091168152602090f35b34620002e85760206200178762001ba03662003744565b906200412a565b34620002e8576101e051366003190112620002e8576020601454604051908152f35b34620002e8576101e051366003190112620002e8576020600e54604051908152f35b34620002e8576040366003190112620002e8576001600160a01b0362001c1062003346565b166101e05152600d60205260406101e051206024356101e05152602052602060ff60406101e0512054166040519015158152f35b34620002e8576020366003190112620002e857620003b560043562003f8b565b34620002e8576020366003190112620002e857600435600554811015620002e85762001c90906200352b565b50805461024052600181015481906001600160a01b039081169062001cb86002840162003693565b6102805262001cca6003840162003693565b90600484015490600585015416600685015460078601546008870154600988015491600a89015493600b8a015495600c8b0162001d079062003693565b9862001d16600d8d0162003693565b9a62001d25600e8e0162003693565b9c600f0162001d349062003693565b9d60100162001d439062003693565b61022052604051610260526102209061024051610260515261026051602001528061026051604001526102605101610280519062001d819162003379565b610260518103610260516060015262001d9a9162003379565b9761026051608001526102605160a001526102605160c001526102605160e0015261026051610100015261026051610120015261026051610140015261026051610160015261026051810361026051610180015262001df99162003379565b610260518103610260516101a0015262001e139162003379565b610260518103610260516101c0015262001e2d9162003379565b610260518103610260516101e0015262001e479162003379565b6102605181036102605161020001526102605190610220519062001e6b9162003379565b0361026051f35b610100366003190112620002e8576004356001600160401b038111620002e85762001ea2903690600401620034fb565b6101a0526101c0526024356001600160401b038111620002e85762001ecc903690600401620034fb565b61010052610120526044356001600160401b038111620002e85762001ef6903690600401620034fb565b610200526064356001600160401b038111620002e85762001f1c903690600401620034fb565b6084929192356001600160401b038111620002e85762001f41903690600401620034fb565b60a4356001600160401b038111620002e85762001f63903690600401620034fb565b9060a0529360c4356001600160401b038111620002e85762001f8a903690600401620034fb565b60c05260e05262001f9a6200498e565b60e435610140526011548034106200307d5760146101a05111158062003070575b156200300d57600a6101005111158062003000575b1562002f95576101006102005111158062002f88575b62001ff19062003c4a565b6101008511158062002f7e575b620020099062003cbd565b6200201961010084111562003d30565b6200202961010087111562003d90565b6200203b61010060c051111562003df1565b8062002f40575b5060405180610e0e8101106001600160401b03610e0e83011117620008df57610e0e62004f1b82396040610e0e82015280620020af620020916040610e0e8401016101a0516101c05162003e51565b610e0e830181036020610e0e85010152610100516101205162003e51565b03906101e051f06101605261016051156200047c576012548060e4351062002f35575b50600554610180526001610180510161018051116200083557620021f795620021e494620021c4620021d49360115460405160805262002114608051620035ba565b600161018051016080515260018060a01b0361016051166020608051015262002145366101a0516101c05162003e80565b604060805101526200215f36610100516101205162003e80565b606060805101526080805101523360a060805101526101e05160c060805101526101405160e060805101526101e05161010060805101526101e05161012060805101524261014060805101526101e05161016060805101523690610200519062003e80565b6101806080510152369162003e80565b6101a06080510152369162003e80565b6101c06080510152369060a05162003e80565b6101e06080510152620022103660c05160e05162003e80565b6102006080510152600160401b610180511015620008df576001610180510160055562002240610180516200352b565b62002f19576080518051825560208101516001830180546001600160a01b0319166001600160a01b0392909216919091179055604001518051906001600160401b038211620008df57620022a7826200229d60028601546200357d565b6002860162003f30565b6020906001601f84111462002e9c57918091620022dd936101e0519262002c1f5750508160011b916000199060031b1c19161790565b60028201555b606060805101518051906001600160401b038211620008df576200231a826200231060038601546200357d565b6003860162003f30565b6020906001601f84111462002e1f5791809162002350936101e0519262002c1f5750508160011b916000199060031b1c19161790565b60038201555b6080805190810151600483015560a08101516005830180546001600160a01b0319166001600160a01b039290921691909117905560c0810151600683015560e0810151600783015561010081015160088301556101208101516009830155610140810151600a830155610160810151600b83015561018001518051906001600160401b038211620008df57620023ff82620023f5600c8601546200357d565b600c860162003f30565b6020906001601f84111462002da25791809162002435936101e0519262002c1f5750508160011b916000199060031b1c19161790565b600c8201555b6101a060805101518051906001600160401b038211620008df57620024738262002469600d8601546200357d565b600d860162003f30565b6020906001601f84111462002d2557918091620024a9936101e0519262002c1f5750508160011b916000199060031b1c19161790565b600d8201555b6101c060805101518051906001600160401b038211620008df57620024e782620024dd600e8601546200357d565b600e860162003f30565b6020906001601f84111462002ca8579180916200251d936101e0519262002c1f5750508160011b916000199060031b1c19161790565b600e8201555b6101e060805101518051906001600160401b038211620008df576200255b8262002551600f8601546200357d565b600f860162003f30565b6020906001601f84111462002c2b5791809162002591936101e0519262002c1f5750508160011b916000199060031b1c19161790565b600f8201555b61020060805101518051906001600160401b038211620008df57620025cf82620025c560108601546200357d565b6010860162003f30565b6020906001601f84111462002ba457918062002607926010946101e0519262002b985750508160011b916000199060031b1c19161790565b9101555b60018060a01b0361016051166101e0515260176020526001610180510160406101e05120556200264160016101805101620037d4565b6011547f8313c79c7a19472d355c917f0bdeb0bfcf3e5945e4b5da4eac84bed6efeb0a3160405160016101805101815260018060a01b0361016051166020820152610100604082015280620026bc620026a661010083016101a0516101c05162003e51565b8281036060840152610100516101205162003e51565b8460808301523360a08301526101405160c08301524260e08301520390a1620026e68134620037b0565b620026f657600180556101e05180f35b620027029034620037b0565b6200270f81151562004655565b620027206001610180510162004713565b9062002732610100830151156200458c565b62002740610180516200352b565b509161012081015191620027676127106200275e601454846200389b565b048092620037b0565b90801590811562002b5d575b5050620027866001610180510162003a35565b926101e05162002797838362003e72565b60e08501511162002b405750620005a4620027b79160e0850151620037b0565b6101e051811562002b36575b6101e051918291829182913390f1156200047c579160019060e083015160098601555b620027f884600161018051016200412a565b9160018060a01b0360208501511690813b15620002e8576040516340c10f1960e01b81526101e0805133600484015260248301879052905191939091849160449183915af19081156200047c577fd860d1de00a1d83be8b8df62fd06b6d6fca5e947c0e8fe25892528a4be1c62b992879262002b24575b5060016200288281610180510162003a35565b911462002b0d575b600161018051016101e05152600c602052620028d660406101e0512060405190620028b58262003601565b428252866020830152836040830152876060830152846080830152620045e9565b620028fe60018060a01b036020880151169560405193849360016101805101974286620046b3565b0390a36200291260016101805101620037d4565b60200151604051919062002991906001600160a01b031662002934846200361d565b600161018051018452602084019081526200294e620046f2565b6040850181905242606086015233608086015260a0850193909352835160065551600780546001600160a01b0319166001600160a01b0392909216919091179055565b8051906001600160401b038211620008df57620029b582620007776008546200357d565b6020906001601f84111462002a8a579180620029ee9260a095946101e0519262002a7e5750508160011b916000199060031b1c19161790565b6008555b606081015160095562002a27600180841b0360808301511660018060a01b03166001600160601b0360a01b600a541617600a55565b0151600b55600981015490606482029180830460641490151715620008355760070154906050820291808304605014901517156200083557101562002a6e575b8062000820565b60016101805101600e5562002a67565b015190508680620007a5565b9060086101e0515260008051602062005d29833981519152916101e0515b601f198516811062002af4575091839160019360a09695601f1981161062002ada575b505050811b01600855620029f2565b015160001960f88460031b161c1916905585808062002acb565b9192602060018192868501518155019401920162002aa8565b62002b1e60016101805101620049ed565b6200288a565b62002b2f90620035ed565b886200286f565b506108fc620027c3565b919390506009850162002b5585825462003e72565b9055620027e6565b60018060a01b03601554166101e0519262002b8d575b6101e05192839283928392f1156200047c57848062002773565b6108fc925062002b73565b015190508580620007a5565b90601084016101e0515260206101e05120916101e0515b601f198516811062002c065750918391600193601095601f1981161062002bec575b505050811b019101556200260b565b015160001960f88460031b161c1916905584808062002bdd565b9192602060018192868501518155019401920162002bbb565b015190508480620007a5565b9190600f84016101e0515260206101e05120906101e051935b601f198416851062002c8c576001945083601f1981161062002c72575b505050811b01600f82015562002597565b015160001960f88460031b161c1916905583808062002c61565b8181015183556020948501946001909301929091019062002c44565b9190600e84016101e0515260206101e05120906101e051935b601f198416851062002d09576001945083601f1981161062002cef575b505050811b01600e82015562002523565b015160001960f88460031b161c1916905583808062002cde565b8181015183556020948501946001909301929091019062002cc1565b9190600d84016101e0515260206101e05120906101e051935b601f198416851062002d86576001945083601f1981161062002d6c575b505050811b01600d820155620024af565b015160001960f88460031b161c1916905583808062002d5b565b8181015183556020948501946001909301929091019062002d3e565b9190600c84016101e0515260206101e05120906101e051935b601f198416851062002e03576001945083601f1981161062002de9575b505050811b01600c8201556200243b565b015160001960f88460031b161c1916905583808062002dd8565b8181015183556020948501946001909301929091019062002dbb565b9190600384016101e0515260206101e05120906101e051935b601f198416851062002e80576001945083601f1981161062002e66575b505050811b01600382015562002356565b015160001960f88460031b161c1916905583808062002e55565b8181015183556020948501946001909301929091019062002e38565b9190600284016101e0515260206101e05120906101e051935b601f198416851062002efd576001945083601f1981161062002ee3575b505050811b016002820155620022e3565b015160001960f88460031b161c1916905583808062002ed2565b8181015183556020948501946001909301929091019062002eb5565b634e487b7160e01b6101e051526101e05160045260246101e051fd5b6101405286620020d2565b6015546101e05191906001600160a01b0316811562002f73575b6101e05192839283928392f1156200047c578662002042565b6108fc925062002f5a565b5084151562001ffe565b5061020051151562001fe6565b60405162461bcd60e51b815260206004820152603760248201527f4d65676164726f7042424256323a2073796d626f6c206e656564206c6573732060448201527f313020627974657320616e6420677420302062797465730000000000000000006064820152608490fd5b5061010051151562001fd0565b60405162461bcd60e51b815260206004820152603560248201527f4d65676164726f7042424256323a206e616d65206e656564206c65737320323060448201527420627974657320616e64206774203020627974657360581b6064820152608490fd5b506101a051151562001fbb565b60405162461bcd60e51b815260206004820152601e60248201527f4d65676164726f7042424256323a20696e636f72726563742076616c756500006044820152606490fd5b34620002e8576101e051366003190112620002e8576015546040516001600160a01b039091168152602090f35b34620002e8576101e051366003190112620002e8576013546040516001600160a01b039091168152602090f35b34620002e8576020366003190112620002e8576200313962004961565b6004356014556101e05180f35b34620002e8576020366003190112620002e8576004356101e05152600c602052602060406101e0512054604051908152f35b34620002e8576101e051366003190112620002e857620003646200035762003c07565b34620002e8576020366003190112620002e85760206200178760043562003a35565b34620002e8576040366003190112620002e8576080620031e9620031e062003362565b600435620038d0565b91604051938452602084015260408301526060820152f35b34620002e8576101e051366003190112620002e857604051806003548083526020809301809160036101e051527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b906101e0515b86828210620032b25786866200326e8288038362003671565b60405192839281840190828552518091526040840192916101e0515b8281106200329a57505050500390f35b8351855286955093810193928101926001016200328a565b83548552909301926001928301920162003255565b34620002e8576020366003190112620002e857620003b5600435620037d4565b34620002e8576040366003190112620002e8576020906200330762003346565b6200331162003362565b9060018060a01b038091166101e051526016845260406101e0512091166101e05152825260ff60406101e05120541615158152f35b600435906001600160a01b03821682036200335d57565b600080fd5b602435906001600160a01b03821682036200335d57565b919082519283825260005b848110620033a6575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520162003384565b90620034f891602081528151602082015260208201519060018060a01b0380921660408201526040830151620034006102209182606085015261024084019062003379565b926200341f606086015194601f19958686830301608087015262003379565b90608086015160a085015260a08601511660c084015260c085015160e0840152620034e7620034cf620034b76200349f60e089015161010090818901528901516101209081890152890151610140908189015289015161016090818901528901516101809081890152890151946101a0958989830301878a015262003379565b93880151936101c09488888303018689015262003379565b92870151926101e09387878303018588015262003379565b91860151916102009286868303018487015262003379565b940151928285030191015262003379565b90565b9181601f840112156200335d578235916001600160401b0383116200335d57602083818601950101116200335d57565b60055481101562003567576011906005600052027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00190600090565b634e487b7160e01b600052603260045260246000fd5b90600182811c92168015620035af575b60208310146200359957565b634e487b7160e01b600052602260045260246000fd5b91607f16916200358d565b61022081019081106001600160401b03821117620035d757604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b038111620035d757604052565b60a081019081106001600160401b03821117620035d757604052565b60c081019081106001600160401b03821117620035d757604052565b604081019081106001600160401b03821117620035d757604052565b602081019081106001600160401b03821117620035d757604052565b90601f801991011681019081106001600160401b03821117620035d757604052565b90604051918260008254620036a8816200357d565b90818452602094600191600181169081600014620037205750600114620036dd575b505050620036db9250038362003671565b565b600090815285812095935091905b81831062003707575050620036db9350820101388080620036ca565b85548884018501529485019487945091830191620036eb565b92505050620036db94925060ff191682840152151560051b820101388080620036ca565b60409060031901126200335d576004359060243590565b805482101562003567576000526005602060002091020190600090565b600354811015620035675760036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0190600090565b91908203918211620037be57565b634e487b7160e01b600052601160045260246000fd5b6000818152600260205260ff6040822054166200388a575b818152600260205260408120805460ff19166001179055600354600160401b8110156200387657826200382a82600162003843940160035562003778565b90919082549060031b91821b91600019901b1916179055565b6003546000198101929083116200386257815260046020526040902055565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b82526041600452602482fd5b620038958262003f8b565b620037ec565b81810292918115918404141715620037be57565b8115620038ba570490565b634e487b7160e01b600052601260045260246000fd5b620038db9062004713565b60c0810190815191821562003a235760018060a01b03600f54169060405193632394e7a360e21b855260048501526020948585602481865afa948515620039cb57600095620039eb575b508415620039d7579051604051630748d63560e31b81526001600160a01b0390921660048301526024820152908490829060449082905afa938415620039cb5760009462003993575b50506101600151926200398d826200398785876200389b565b620038af565b93929190565b9080929450813d8311620039c3575b620039ae818362003671565b810103126200335d575191610160386200396e565b503d620039a2565b6040513d6000823e3d90fd5b505050505050600090600090600090600090565b90948682813d831162003a1b575b62003a05818362003671565b8101031262003a18575051933862003925565b80fd5b503d620039f9565b50505050600090600090600090600090565b62003a436101209162004713565b01516ec097ce7bc90715b34b9f100000000090818102918183041490151715620037be576a108b2a2c28029094000000620034f8910462004802565b6040519062003a8e82620035ba565b8161020060009182815282602082015260609283604083015283808301528060808301528060a08301528060c08301528060e083015280610100830152806101208301528061014083015261016082015282610180820152826101a0820152826101c0820152826101e08201520152565b9060405162003b0e81620035ba565b61020062003c02601083958054855260018060a01b0380600183015416602087015262003b3e6002830162003693565b604087015262003b516003830162003693565b60608701526004820154608087015260058201541660a0860152600681015460c0860152600781015460e086015260088101546101008601526009810154610120860152600a810154610140860152600b81015461016086015262003bb9600c820162003693565b61018086015262003bcd600d820162003693565b6101a086015262003be1600e820162003693565b6101c086015262003bf5600f820162003693565b6101e08601520162003693565b910152565b62003c1162003a7f565b50600e54801562003c3f576000198101908111620037be5762003c38620034f8916200352b565b5062003aff565b50620034f862004498565b1562003c5257565b60405162461bcd60e51b815260206004820152603a60248201527f4d65676164726f7042424256323a20696d61676555726c206e656564206c657360448201527f732032353620627974657320616e6420677420302062797465730000000000006064820152608490fd5b1562003cc557565b60405162461bcd60e51b815260206004820152603d60248201527f4d65676164726f7042424256323a206465736372697074696f6e206e6565642060448201527f6c6573732032353620627974657320616e6420677420302062797465730000006064820152608490fd5b1562003d3857565b60405162461bcd60e51b815260206004820152602a60248201527f4d65676164726f7042424256323a2077656273697465206e656564206c6573736044820152692032353620627974657360b01b6064820152608490fd5b1562003d9857565b60405162461bcd60e51b815260206004820152602b60248201527f4d65676164726f7042424256323a2074656c656772616d206e656564206c657360448201526a732032353620627974657360a81b6064820152608490fd5b1562003df957565b60405162461bcd60e51b815260206004820152602a60248201527f4d65676164726f7042424256323a2074776974746572206e656564206c6573736044820152692032353620627974657360b01b6064820152608490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b91908201809211620037be57565b9291926001600160401b038211620035d7576040519162003eac601f8201601f19166020018462003671565b8294818452818301116200335d578281602093846000960137010152565b601f811162003ed7575050565b600090600860005260008051602062005d29833981519152906020601f850160051c8301941062003f25575b601f0160051c01915b82811062003f1957505050565b81815560010162003f0c565b909250829062003f03565b90601f811162003f3f57505050565b6000916000526020600020906020601f850160051c8301941062003f80575b601f0160051c01915b82811062003f7457505050565b81815560010162003f67565b909250829062003f5e565b60009080825260206002815260409160ff8385205416156200405e5780845260028252828420805460ff19169055600482528284205460035460001991908281019081116200404a5762003fdf9062003778565b90549060031b1c62003ff6816200382a8462003778565b86526004845284862055600354801562004036579080600494939201906200401e8262003778565b909182549160031b1b19169055600355845252812055565b634e487b7160e01b86526031600452602486fd5b634e487b7160e01b87526011600452602487fd5b50606491519062461bcd60e51b82526004820152601060248201526f15985b1d59481b9bdd081a5b881cd95d60821b6044820152fd5b8015620041245780806001146200411d5760021462004117576001908161013382101682600b831016176200410f57906002815b808211620040e257505081600019048111620037be570290565b909280600019048111620037be5781841662004105575b800292811c90620040c8565b80920291620040f9565b600291500a90565b50600490565b5050600190565b50600090565b6004906020906001600160a01b03908290620041469062004713565b015116604051928380926318160ddd60e01b82525afa908115620039cb57600091620041b3575b50620041798162004094565b916a108b2a2c280290940000009080820291820403620037be57620041a7620041ad91620034f89462003e72565b62004802565b620037b0565b90506020813d602011620041e2575b81620041d16020938362003671565b810103126200335d5751386200416d565b3d9150620041c2565b620041f562003a7f565b50600554801562003c3f576000198101908111620037be5762003c38620034f8916200352b565b604051906200422b826200361d565b81600654815260018060a01b038060075416602090818401526040519081600060085462004259816200357d565b80845290600190818116908115620042f75750600114620042a5575b5050620042859250038262003671565b60408301526009546060830152600a5416608082015260a0600b54910152565b90939150600860005260008051602062005d29833981519152936000915b818310620042de575050620042859350820101388062004275565b85548784018501529485019486945091830191620042c3565b9150506200428594925060ff191682840152151560051b820101388062004275565b60a0604080516200432a816200361d565b6000928184809352826020820152606084820152826060820152826080820152015260065480156200437e576200436391925062004713565b90810151916101806060830151920151906200398d6200421c565b50620043896200421c565b928151620043978162003655565b838152928251620043a88162003655565b818152925190620043b98262003655565b815290565b6004906020906001600160a01b03908290620043da9062004713565b015116604051928380926318160ddd60e01b82525afa908115620039cb5760009162004440575b5080620044356200442e620044276a108b2a2c28029094000000956200443c95620037b0565b9262004094565b9162004094565b90620037b0565b0490565b90506020813d6020116200447a575b816200445e6020938362003671565b810103126200335d57516a108b2a2c2802909400000062004401565b3d91506200444f565b8051821015620035675760209160051b010190565b620044a262003a7f565b506040805190620044b382620035ba565b6000908183528160208401528051620044cc8162003655565b828152818401528051620044e08162003655565b82815260608401528160808401528160a08401528160c08401528160e0840152816101008401528161012084015281610140840152816101608401528051620045298162003655565b82815261018084015280516200453f8162003655565b8281526101a08401528051620045558162003655565b8281526101c084015280516200456b8162003655565b8281526101e08401525190620045818262003655565b815261020082015290565b156200459457565b60405162461bcd60e51b815260206004820152602760248201527f4d65676164726f7042424256323a206c697175696c747920616c7265616479206044820152661c995b5bdd995960ca1b6064820152608490fd5b8054600160401b811015620035d75762004609916001820181556200375b565b9190916200463f576080816004925184556020810151600185015560408101516002850155606081015160038501550151910155565b634e487b7160e01b600052600060045260246000fd5b156200465d57565b60405162461bcd60e51b815260206004820152602860248201527f4d65676164726f7042424256323a2076616c7565206d75737420677265617465604482015267072207468616e20360c41b6064820152608490fd5b919260a093969594919660c08452600360c08501526262757960e81b60e085015261010084019760208501526040840152606083015260808201520152565b60405190620047018262003639565b600382526262757960e81b6020830152565b6200471d62003a7f565b5080151580620047f5575b15620047b0576000198101908111620037be5762003c386200474a916200352b565b60208101516001600160a01b031615620047615790565b60405162461bcd60e51b815260206004820152602160248201527f4d65676164726f7042424256323a20696e76616c69642064726f7020746f6b656044820152603760f91b6064820152608490fd5b60405162461bcd60e51b815260206004820152601c60248201527f4d65676164726f7042424256323a20496e76616c696420696e646578000000006044820152606490fd5b5060055481111562004728565b80156200412457620048e6816000908360801c8062004954575b508060401c8062004946575b508060201c8062004938575b508060101c806200492a575b508060081c806200491c575b508060041c806200490e575b508060021c8062004900575b50600191828092811c620048f8575b1c1b620048818185620038af565b01811c620048908185620038af565b01811c6200489f8185620038af565b01811c620048ae8185620038af565b01811c620048bd8185620038af565b01811c620048cc8185620038af565b01811c620048db8185620038af565b01901c8092620038af565b80821015620048f3575090565b905090565b018162004873565b600291509101903862004864565b600491509101903862004858565b60089150910190386200484c565b601091509101903862004840565b602091509101903862004834565b604091509101903862004828565b915050608090386200481c565b6000546001600160a01b031633036200497657565b60405163118cdaa760e01b8152336004820152602490fd5b600260015414620049a0576002600155565b604051633ee5aeb560e01b8152600490fd5b908160209103126200335d57516001600160a01b03811681036200335d5790565b908160209103126200335d575180151581036200335d5790565b6000906000198101908111620038625762004a08906200352b565b506010546013546001830180546040805163e6a4390560e01b81526001600160a01b0394851660048083018290529386166024830181905260209998939794969593949293929091908616908a85604481855afa94851562004def57908b9392918b9662004ef6575b508786161562004e6e575b505050508460098401549189868254168951938480926318160ddd60e01b82525afa91821562004dc057899262004e39575b50606082029180159281810460601484171562004e265760649004928160021b9182048914171562004e135760649004600b8601558560135416803b1562004df957898491898b5180948193630d0e30db60e41b83525af1801562004def5762004dfd575b5085815416803b1562004df95788516340c10f1960e01b815230818a0190815260208101859052909392918b9185919082908490829060400103925af1801562004def578892888c938e9362004dca575b548c5163a9059cbb60e01b8082526001600160a01b038b169782019788526020880194909452929650919492938593849003604001928492165af1801562004dc0579162004be593918b9362004d9e575b508660135416908a8a518096819582948352898d840160209093929193604081019460018060a01b031681520152565b03925af1801562004d9457602488938a93879362004d60575b5088516335313c2160e11b815230898201529485938492165af1801562004d275790879162004d31575b505060016008820155828683600f54168651928380926324776b7d60e21b82525afa90811562004d275791879391879593869162004ccd575b5065ffffffffffff60069116910155600f541690845180968193632d84f2e360e21b83525af191821562004cc357505062004c9a575050565b813d831162004cbb575b62004cb0818362003671565b810103126200335d57565b503d62004ca4565b51903d90823e3d90fd5b929480929496508391503d831162004d1f575b62004cec818362003671565b8101031262004d1b575165ffffffffffff8116810362004d1b57859387939092909165ffffffffffff62004c61565b8580fd5b503d62004ce0565b85513d88823e3d90fd5b813d831162004d58575b62004d47818362003671565b810103126200335d57853862004c28565b503d62004d3b565b62004d8490853d871162004d8c575b62004d7b818362003671565b810190620049d3565b503862004bfe565b503d62004d6f565b86513d89823e3d90fd5b62004db890843d861162004d8c5762004d7b818362003671565b503862004bb5565b88513d8b823e3d90fd5b9450509362004dda9150620035ed565b62004deb57888a83888a9462004b64565b8880fd5b89513d8c823e3d90fd5b8980fd5b62004e0b90999199620035ed565b973862004b13565b634e487b7160e01b8a526011885260248afd5b634e487b7160e01b8b526011895260248bfd5b9091508981813d831162004e66575b62004e54818362003671565b8101031262004deb5751903862004aae565b503d62004e48565b89516364e329cb60e11b81526001600160a01b039182168a8201908152939091166020840152939450839182908b90829060400103925af190811562004d9457879162004ec2575b50908738808062004a7c565b62004ee79150883d8a1162004eee575b62004ede818362003671565b810190620049b2565b3862004eb6565b503d62004ed2565b62004f12919650843d861162004eee5762004ede818362003671565b943862004a7156fe608060405234620003805762000e0e803803806200001d8162000385565b9283398101604082820312620003805781516001600160401b03908181116200038057826200004e918501620003c1565b926020928382015183811162000380576200006a9201620003c1565b923315620003675760008054336001600160a01b0319821681178355919591906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08780a381519083821162000353576004958654926001948585811c9516801562000348575b8886101462000335578190601f95868111620002e2575b5088908683116001146200027e57849262000272575b5050600019600383901b1c191690851b1787555b81519485116200025f576005968754908582811c9216801562000254575b88831014620002415750838111620001fb575b50859285116001146200019457939450849291908362000188575b50501b916000199060031b1c19161790555b6040516109da9081620004348239f35b01519250388062000166565b86815285812093958591601f198316915b88838310620001e05750505010620001c6575b505050811b01905562000178565b015160001960f88460031b161c19169055388080620001b8565b858701518855909601959485019487935090810190620001a5565b878252868220848088018a1c82019289891062000237575b01891c019085905b8281106200022b5750506200014b565b8381550185906200021b565b9250819262000213565b634e487b7160e01b835260229052602482fd5b91607f169162000138565b634e487b7160e01b815260418752602490fd5b01519050388062000106565b8a85528985208894509190601f198416865b8c828210620002cb5750508411620002b1575b505050811b0187556200011a565b015160001960f88460031b161c19169055388080620002a3565b8385015186558b9790950194938401930162000290565b9091508984528884208680850160051c8201928b86106200032b575b918991869594930160051c01915b8281106200031c575050620000f0565b8681558594508991016200030c565b92508192620002fe565b634e487b7160e01b835260228952602483fd5b94607f1694620000d9565b634e487b7160e01b86526041600452602486fd5b604051631e4fbdf760e01b815260006004820152602490fd5b600080fd5b6040519190601f01601f191682016001600160401b03811183821017620003ab57604052565b634e487b7160e01b600052604160045260246000fd5b919080601f84011215620003805782516001600160401b038111620003ab57602090620003f7601f8201601f1916830162000385565b92818452828287010111620003805760005b8181106200041f57508260009394955001015290565b85810183015184820184015282016200040956fe6080604081815260048036101561001557600080fd5b600092833560e01c90816306fdde031461068557508063095ea7b3146105dc57806318160ddd146105bd57806323b872dd146104ca578063313ce567146104ae57806340c10f19146103fe57806342966c68146103e057806370a08231146103a8578063715018a61461034e57806379cc67901461031b5780638da5cb5b146102f357806395d89b41146101cf578063a9059cbb1461019e578063dd62ed3e146101515763f2fde38b146100c857600080fd5b3461014d57602036600319011261014d576100e16107c3565b906100ea6108d4565b6001600160a01b0391821692831561013757505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8280fd5b50503461019a578060031936011261019a578060209261016f6107c3565b6101776107de565b6001600160a01b0391821683526002865283832091168252845220549051908152f35b5080fd5b50503461019a578060031936011261019a576020906101c86101be6107c3565b60243590336107f4565b5160018152f35b5091903461019a578160031936011261019a578051908260055460018160011c90600183169283156102e9575b60209384841081146102d6578388529081156102ba5750600114610264575b505050829003601f01601f191682019267ffffffffffffffff841183851017610251575082918261024d92528261077a565b0390f35b634e487b7160e01b815260418552602490fd5b600587529192508591837f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db05b8385106102a6575050505083010138808061021b565b805488860183015293019284908201610290565b60ff1916878501525050151560051b840101905038808061021b565b634e487b7160e01b895260228a52602489fd5b91607f16916101fc565b50503461019a578160031936011261019a57905490516001600160a01b039091168152602090f35b50503461019a5736600319011261034b576103486103376107c3565b61033f6108d4565b60243590610900565b80f35b80fd5b833461034b578060031936011261034b576103676108d4565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461019a57602036600319011261019a5760209181906001600160a01b036103d06107c3565b1681526001845220549051908152f35b83823461019a57602036600319011261019a57610348903533610900565b50903461014d578060031936011261014d576104186107c3565b90602435916104256108d4565b6001600160a01b03169283156104995760035490838201809211610486575084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef926020926003558585526001835280852082815401905551908152a380f35b634e487b7160e01b865260119052602485fd5b84602492519163ec442f0560e01b8352820152fd5b50503461019a578160031936011261019a576020905160128152f35b50823461034b57606036600319011261034b576104e56107c3565b6104ed6107de565b916044359360018060a01b038316808352600260205286832033845260205286832054916000198303610529575b6020886101c88989896107f4565b86831061059157811561057a573315610563575082526002602090815286832033845281529186902090859003905582906101c88761051b565b8751634a1406b160e11b8152908101849052602490fd5b875163e602df0560e01b8152908101849052602490fd5b8751637dc7a0d960e11b8152339181019182526020820193909352604081018790528291506060010390fd5b50503461019a578160031936011261019a576020906003549051908152f35b503461014d578160031936011261014d576105f56107c3565b60243590331561066e576001600160a01b031691821561065757508083602095338152600287528181208582528752205582519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925843392a35160018152f35b8351634a1406b160e11b8152908101859052602490fd5b835163e602df0560e01b8152808401869052602490fd5b849150833461014d578260031936011261014d5782845460018160011c9060018316928315610770575b60209384841081146102d65783885290811561075457506001146106ff57505050829003601f01601f191682019267ffffffffffffffff841183851017610251575082918261024d92528261077a565b8787529192508591837f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b838510610740575050505083010185808061021b565b80548886018301529301928490820161072a565b60ff1916878501525050151560051b840101905085808061021b565b91607f16916106af565b6020808252825181830181905290939260005b8281106107af57505060409293506000838284010152601f8019910116010190565b81810186015184820160400152850161078d565b600435906001600160a01b03821682036107d957565b600080fd5b602435906001600160a01b03821682036107d957565b916001600160a01b038084169283156108bb57169283156108a2576000908382526001602052604082205490838210610870575091604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95876020965260018652038282205586815220818154019055604051908152a3565b60405163391434e360e21b81526001600160a01b03919091166004820152602481019190915260448101839052606490fd5b60405163ec442f0560e01b815260006004820152602490fd5b604051634b637e8f60e11b815260006004820152602490fd5b6000546001600160a01b031633036108e857565b60405163118cdaa760e01b8152336004820152602490fd5b91906001600160a01b0383169081156108bb578160005260016020526040600020549381851061097257506020817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9260009596858752600184520360408620558060035403600355604051908152a3565b60405163391434e360e21b81526001600160a01b03919091166004820152602481018590526044810191909152606490fdfea2646970667358221220197028fdf3b86fa4d96b8b3d0b837425ee2c5efb6994f96d0af7a0a3907a56ac64736f6c63430008170033f3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3a2646970667358221220e0c4a1ef0d6a631c1c25252725455079ee066ec97d388a8ec01f36e8969b9c3464736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
XDC | 100.00% | $0.070624 | 237,537.3339 | $16,775.77 |
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.