ERC-20
Overview
Max Total Supply
888,000,000,000 BEN
Holders
4,401
Market
Price
$0.00 @ 0.000000 ETH (-9.90%)
Onchain Market Cap
$307,696.22
Circulating Supply Market Cap
$0.00
Other Info
Token Contract (WITH 18 Decimals)
Balance
106,597,461.422428963473309434 BENValue
$36.94 ( ~0.0106317543775501 Eth) [0.0120%]Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x0b76F145...f94C578d6 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
BenCoinV2
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 850 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; import {Ownable} from "./oz/access/Ownable.sol"; import {IERC20, ERC20, ERC20Permit, ERC20Votes} from "./oz/token/ERC20/extensions/ERC20Votes.sol"; import {SafeERC20} from "./oz/token/ERC20/utils/SafeERC20.sol"; import {IERC165} from "./oz/utils/introspection/IERC165.sol"; import {Address} from "./oz/utils/Address.sol"; import {OFTV2} from "./lz/token/oft/v2/OFTV2.sol"; import {IBuyTaxReceiver} from "./interfaces/IBuyTaxReceiver.sol"; import {IAntiMevStrategy} from "./interfaces/IAntiMevStrategy.sol"; /** * @title BenCoinV2 * @author Ben Coin Collective * * BenCoinV2 is an ERC20 token contract with additional features such as taxing, anti-MEV protection and transfer blacklisting. * * The contract is part of the Ben Coin ecosystem. * The owner of this contract has control over functions such as setting taxes, managing whitelists, enabling/disabling features & * provides a way to recover tokens accidentally sent to the contract. It is not an upgradeable proxy contract, but can however * update logic for the anti-MEV strategy and buy tax receiving. * * No extra tokens can be minted after deployment, but this is a LayerZero cross chain compatible token contract, and is permitted to burn * on the source chain and mint on another, but the overall token count does not change. */ contract BenCoinV2 is OFTV2, ERC20Votes { using SafeERC20 for IERC20; event SetTax(uint buyTax, uint sellTax, bool isTaxing); event SetBuyTaxReceiver(address buyTaxReceiver); event SetTaxableContract(address taxableContract, bool isTaxable); event SetTaxWhitelist(address whitelist, bool isWhitelisted); event SetIsAntiMEV(bool isAntiMEV); event SetIsTransferBlacklisting(bool isBlacklisting); event SetTransferBlacklist(address blacklist, bool isBlacklisted); error OnlyMigrator(); error MigratorSetOnInvalidChain(); error MaxTaxExceeded(); error BothAddressesAreContracts(); error TransferBlacklisted(address); error InvalidBuyTaxReceiver(); error InvalidArrayLength(); error AlreadyInitialized(); address private buyTaxReceiver; uint16 private buyTax; uint16 private sellTax; bool private isTaxingEnabled; bool private isAntiMEV; bool private isBlacklisting; bool private isInitialized; uint8 private taxFlag = NOT_TAXING; mapping(address contractAddress => bool isTaxable) private taxableAddress; mapping(address whitelist => bool isWhitelisted) private taxWhitelist; // For certain addresses to be exempt from tax like exchanges mapping(address blacklist => bool isBlacklisted) private transferBlacklist; IAntiMevStrategy private antiMEVStrategy; uint256 private constant MAX_TAX = 10; // 10% // Using 1 & 2 instead of 0 to save gas when resetting uint8 private constant NOT_TAXING = 1; uint8 private constant TAXING = 2; uint256 private constant FEE_DENOMINATOR = 10000; uint8 private constant SHARED_DECIMALS = 8; /** * @notice BenCoinV2 contract constructor */ constructor() OFTV2("BEN", "BEN", SHARED_DECIMALS) ERC20Permit("BEN") {} /** * @notice Initializes the contract * @param _lzEndpoint The endpoint for Layer Zero * @param _buyTaxReceiver The address to send the buy tax to * @param _antiMEVStrategy The anti-MEV strategy to use * @param _migrator The migrator contract address for benV1 to benV2 (only used on Ethereum) * @param _migratorMintSupply The migrator contract address for benV1 to benV2 (only used on Ethereum) * @param _buyTax The buy tax (10000 basis points, so 300 is 3%) * @param _sellTax The sell tax (10000 basis points, so 100 is 1%) * @param _isTaxingEnabled Whether or not taxing is enabled * @param _isAntiMEV Whether or not anti-MEV is enabled * @param _isTransferBlacklisting Whether or not transfer blacklisting is enabled */ function initialize( address _lzEndpoint, address _buyTaxReceiver, address _antiMEVStrategy, address _migrator, uint256 _migratorMintSupply, uint256 _buyTax, uint256 _sellTax, bool _isTaxingEnabled, bool _isAntiMEV, bool _isTransferBlacklisting ) external notInitialized onlyOwner { __OFTV2_init(_lzEndpoint); _setTax(_buyTax, _sellTax, _isTaxingEnabled); _setIsAntiMEV(_isAntiMEV); _setIsTransferBlacklisting(_isTransferBlacklisting); if (_isTaxingEnabled) { _setBuyTaxReceiver(_buyTaxReceiver); } antiMEVStrategy = IAntiMevStrategy(_antiMEVStrategy); isInitialized = true; if (_migrator != address(0)) { if ( block.chainid != 1 && // ethereum block.chainid != 1337 && // ganache block.chainid != 31337 // hardhat ) { // Migrator can only be set on ethereum as well as local development chain ids like hardhat. // This is because the migrator gets minted with the whole supply to distribute during the V1 to V2 migration. revert MigratorSetOnInvalidChain(); } // If the migrator is set then mint the total supply of BenV2 tokens to it _mint(_migrator, _migratorMintSupply); } } /** * @dev Modifier to check if the contract has been initialized */ modifier notInitialized() { if (isInitialized) { revert AlreadyInitialized(); } _; } /** * @dev Anti-MEV modifier * @param _from The sender address * @param _to The receiver address * @param _amount The amount being transferred */ modifier antiMEV( address _from, address _to, uint256 _amount ) { if (isAntiMEV) { antiMEVStrategy.onTransfer(_from, _to, _amount, taxFlag == TAXING); } _; } /** * @notice Burns BEN coin * @param _amount The amount to burn */ function burn(uint256 _amount) external { _burn(_msgSender(), _amount); } /** * @notice Burns BEN coin from a specific address which has given the sender an allowance * @param _account The account to burn from * @param _amount The amount to burn */ function burnFrom(address _account, uint256 _amount) external { _spendAllowance(_account, _msgSender(), _amount); _burn(_account, _amount); } function _mint(address _account, uint256 _amount) internal override(ERC20, ERC20Votes) { ERC20Votes._mint(_account, _amount); } function _burn(address _account, uint256 _amount) internal override(ERC20, ERC20Votes) { ERC20Votes._burn(_account, _amount); } function _beforeTokenTransfer( address _from, address _to, uint256 _amount ) internal override(ERC20) antiMEV(_from, _to, _amount) { if (isBlacklisting && transferBlacklist[_from]) { revert TransferBlacklisted(_from); } ERC20._beforeTokenTransfer(_from, _to, _amount); if (isTaxingEnabled && taxFlag == NOT_TAXING && taxableAddress[_to] && !taxWhitelist[_from]) { taxFlag = TAXING; // Set this so no further taxing is done by other transfers IBuyTaxReceiver(buyTaxReceiver).swapCallback(); taxFlag = NOT_TAXING; } } function _afterTokenTransfer(address _from, address _to, uint256 _amount) internal override(ERC20, ERC20Votes) { ERC20Votes._afterTokenTransfer(_from, _to, _amount); // Take a fee if it is a taxable contract if (isTaxingEnabled && taxFlag == NOT_TAXING) { // If it's a buy then we take from who-ever it is sent to and send to the contract for selling back to ETH if (taxableAddress[_from] && !taxWhitelist[_to]) { uint256 fee = _calcTax(buyTax, _amount); // Transfers from the receiver to the buy tax receiver for later selling taxFlag = TAXING; _transfer(_to, buyTaxReceiver, fee); taxFlag = NOT_TAXING; } else if (taxableAddress[_to] && !taxWhitelist[_from]) { uint256 fee = _calcTax(sellTax, _amount); // Transfers from taxable contracts (like LPs) to the admin directly taxFlag = TAXING; _transfer(_to, owner(), fee); taxFlag = NOT_TAXING; } } } /** * @notice Calculate the tax fee * @param _tax The tax rate in basis points (10000 basis points = 100%) * @param _amount The amount to apply the tax to * @return fees The calculated tax fees * @dev Internal function used to calculate tax fees */ function _calcTax(uint256 _tax, uint256 _amount) private pure returns (uint256 fees) { fees = (_amount * _tax) / FEE_DENOMINATOR; } function _setTax(uint256 _buyTax, uint256 _sellTax, bool _isTaxingEnabled) internal { // Cannot set tax higher than MAX_TAX (10%) if ((_buyTax * MAX_TAX > FEE_DENOMINATOR) || (_sellTax * MAX_TAX > FEE_DENOMINATOR)) { revert MaxTaxExceeded(); } buyTax = uint16(_buyTax); sellTax = uint16(_sellTax); isTaxingEnabled = _isTaxingEnabled; emit SetTax(_buyTax, _sellTax, _isTaxingEnabled); } function _setIsAntiMEV(bool _isAntiMEV) private { isAntiMEV = _isAntiMEV; emit SetIsAntiMEV(_isAntiMEV); } function _setIsTransferBlacklisting(bool _isBlacklisting) private { isBlacklisting = _isBlacklisting; emit SetIsTransferBlacklisting(_isBlacklisting); } function _setBuyTaxReceiver(address _buyTaxReceiver) private { if ( !Address.isContract(_buyTaxReceiver) || !IERC165(_buyTaxReceiver).supportsInterface(type(IBuyTaxReceiver).interfaceId) ) { revert InvalidBuyTaxReceiver(); } buyTaxReceiver = _buyTaxReceiver; emit SetBuyTaxReceiver(_buyTaxReceiver); } /** * @notice Set the tax parameters * @param _buyTax The buy tax rate in basis points (10000 basis points = 100%) * @param _sellTax The sell tax rate in basis points (10000 basis points = 100%) * @param _isTaxingEnabled Whether or not taxing is enabled * @dev Only callable by the owner */ function setTax(uint256 _buyTax, uint256 _sellTax, bool _isTaxingEnabled) external onlyOwner { _setTax(_buyTax, _sellTax, _isTaxingEnabled); } /** * @notice Set whether or not a contract is taxable * @param _taxableContract The contract to set taxable state for * @param _isTaxable Whether or not the contract is taxable * @dev Only callable by the owner */ function setTaxableContract(address _taxableContract, bool _isTaxable) external onlyOwner { taxableAddress[_taxableContract] = _isTaxable; emit SetTaxableContract(_taxableContract, _isTaxable); } /** * @notice Set whether or not an address is whitelisted for tax * @param _whitelist The address to set whitelist state for * @param _isWhitelisted Whether or not the address is whitelisted * @dev Only callable by the owner */ function setTaxWhitelist(address _whitelist, bool _isWhitelisted) external onlyOwner { taxWhitelist[_whitelist] = _isWhitelisted; emit SetTaxWhitelist(_whitelist, _isWhitelisted); } /** * @notice Set whether an anti-MEV strategy is used * @param _isAntiMEV Whether or not anti-MEV is enabled * @dev Only callable by the owner */ function setIsAntiMEV(bool _isAntiMEV) external onlyOwner { _setIsAntiMEV(_isAntiMEV); } /** * @notice Set the anti-MEV strategy * @param _antiMEVStrategy The anti-MEV strategy to use * @dev Only callable by the owner */ function setAntiMevStrategy(IAntiMevStrategy _antiMEVStrategy) external onlyOwner { antiMEVStrategy = _antiMEVStrategy; } /** * @notice Set whether or not transfer blacklisting is enabled * @param _isBlacklisting Whether or not transfer blacklisting is enabled * @dev Only callable by the owner */ function setIsTransferBlacklisting(bool _isBlacklisting) external onlyOwner { _setIsTransferBlacklisting(_isBlacklisting); } /** * @notice Recover tokens sent to this contract by accident * @param _token The token to recover * @param _amount The amount to recover * @dev Only callable by the owner */ function recoverToken(IERC20 _token, uint _amount) external onlyOwner { _token.safeTransfer(owner(), _amount); } /** * @notice Set the buy tax receiver address * @param _buyTaxReceiver The address to send the buy tax to * @dev Only callable by the owner */ function setBuyTaxReceiver(address _buyTaxReceiver) external onlyOwner { _setBuyTaxReceiver(_buyTaxReceiver); } /** * @notice Set whether or not an address is blacklisted from transferring * @param _blacklist The address to set blacklist state for * @param _isBlacklisted Whether or not the address is blacklisted * @dev Only callable by the owner */ function setTransferBlacklist(address _blacklist, bool _isBlacklisted) external onlyOwner { transferBlacklist[_blacklist] = _isBlacklisted; emit SetTransferBlacklist(_blacklist, _isBlacklisted); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; interface IAntiMevStrategy { function onTransfer(address from, address to, uint256 amount, bool isTaxingInProgress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; interface IBuyTaxReceiver { function swapCallback() external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ILayerZeroUserApplicationConfig.sol"; interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig { // @notice send a LayerZero message to the specified address at a LayerZero endpoint. // @param _dstChainId - the destination chain identifier // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains // @param _payload - a custom bytes payload to send to the destination contract // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // @notice used by the messaging library to publish verified payload // @param _srcChainId - the source chain identifier // @param _srcAddress - the source contract (as bytes) at the source chain // @param _dstAddress - the address on destination chain // @param _nonce - the unbound message ordering nonce // @param _gasLimit - the gas limit for external contract execution // @param _payload - verified payload to send to the destination contract function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external; // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64); // @notice get the outboundNonce from this source chain which, consequently, is always an EVM // @param _srcAddress - the source chain contract address function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64); // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery // @param _dstChainId - the destination chain identifier // @param _userApplication - the user app address on this EVM chain // @param _payload - the custom message to send over LayerZero // @param _payInZRO - if false, user app pays the protocol fee in native token // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee); // @notice get this Endpoint's immutable source identifier function getChainId() external view returns (uint16); // @notice the interface to retry failed message on this Endpoint destination // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address // @param _payload - the payload to be retried function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external; // @notice query if any STORED payload (message blocking) at the endpoint. // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool); // @notice query if the _libraryAddress is valid for sending msgs. // @param _userApplication - the user app address on this EVM chain function getSendLibraryAddress(address _userApplication) external view returns (address); // @notice query if the _libraryAddress is valid for receiving msgs. // @param _userApplication - the user app address on this EVM chain function getReceiveLibraryAddress(address _userApplication) external view returns (address); // @notice query if the non-reentrancy guard for send() is on // @return true if the guard is on. false otherwise function isSendingPayload() external view returns (bool); // @notice query if the non-reentrancy guard for receive() is on // @return true if the guard is on. false otherwise function isReceivingPayload() external view returns (bool); // @notice get the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _userApplication - the contract address of the user application // @param _configType - type of configuration. every messaging library has its own convention. function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory); // @notice get the send() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getSendVersion(address _userApplication) external view returns (uint16); // @notice get the lzReceive() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getReceiveVersion(address _userApplication) external view returns (uint16); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroReceiver { // @notice LayerZero endpoint will invoke this function to deliver the message on the destination // @param _srcChainId - the source endpoint identifier // @param _srcAddress - the source sending contract address from the source chain // @param _nonce - the ordered message nonce // @param _payload - the signed payload is the UA bytes has encoded to be sent function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _configType - type of configuration. every messaging library has its own convention. // @param _config - configuration in the bytes. can encode arbitrary content. function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external; // @notice set the send() LayerZero messaging library version to _version // @param _version - new messaging library version function setSendVersion(uint16 _version) external; // @notice set the lzReceive() LayerZero messaging library version to _version // @param _version - new messaging library version function setReceiveVersion(uint16 _version) external; // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload // @param _srcChainId - the chainId of the source chain // @param _srcAddress - the contract address of the source contract at the source chain function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../oz/access/Ownable.sol"; import "../interfaces/ILayerZeroReceiver.sol"; import "../interfaces/ILayerZeroUserApplicationConfig.sol"; import "../interfaces/ILayerZeroEndpoint.sol"; import "../util/BytesLib.sol"; /* * a generic LzReceiver implementation */ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig { using BytesLib for bytes; error LZAPPInvalidEndpointCaller(); error LZAPPInvalidSourceSendingContract(); error LZAPPInvalidDestinationChain(); error LZAPPInvalidMinGasLimit(); error LZAPPInvalidGasLimit(); error LZAPPInvalidAdapterParams(); error LZAPPInvalidPayloadSize(); error LZAPPNoTrustedPathRecord(); error LZAPPInvalidMinGas(); // ua can not send payload larger than this by default, but it can be changed by the ua owner uint constant public DEFAULT_PAYLOAD_SIZE_LIMIT = 10000; ILayerZeroEndpoint public lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup; mapping(uint16 => uint) public payloadSizeLimitLookup; address public precrime; event SetPrecrime(address precrime); event SetTrustedRemote(uint16 _remoteChainId, bytes _path); event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress); event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas); function __LzApp_init(address _endpoint) internal { lzEndpoint = ILayerZeroEndpoint(_endpoint); } function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override { // lzReceive must be called by the endpoint for security if (_msgSender() != address(lzEndpoint)) { revert LZAPPInvalidEndpointCaller(); } bytes memory trustedRemote = trustedRemoteLookup[_srcChainId]; // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. if ((_srcAddress.length != trustedRemote.length) || trustedRemote.length == 0 || keccak256(_srcAddress) != keccak256(trustedRemote)) { revert LZAPPInvalidSourceSendingContract(); } _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; if (trustedRemote.length == 0) { revert LZAPPInvalidDestinationChain(); } _checkPayloadSize(_dstChainId, _payload.length); lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams); } function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual { uint providedGasLimit = _getGasLimit(_adapterParams); uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas; if (minGasLimit == 0) { revert LZAPPInvalidMinGasLimit(); } if (providedGasLimit < minGasLimit) { revert LZAPPInvalidGasLimit(); } } function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) { if (_adapterParams.length < 34) { revert LZAPPInvalidAdapterParams(); } assembly { gasLimit := mload(add(_adapterParams, 34)) } } function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual { uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId]; if (payloadSizeLimit == 0) { // use default if not set payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT; } if (_payloadSize > payloadSizeLimit) { revert LZAPPInvalidPayloadSize(); } } //---------------------------UserApplication config---------------------------------------- function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) { return lzEndpoint.getConfig(_version, _chainId, address(this), _configType); } // generic config for LayerZero user Application function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner { lzEndpoint.setConfig(_version, _chainId, _configType, _config); } function setSendVersion(uint16 _version) external override onlyOwner { lzEndpoint.setSendVersion(_version); } function setReceiveVersion(uint16 _version) external override onlyOwner { lzEndpoint.setReceiveVersion(_version); } function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // _path = abi.encodePacked(remoteAddress, localAddress) // this function set the trusted path for the cross-chain communication function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner { trustedRemoteLookup[_remoteChainId] = _path; emit SetTrustedRemote(_remoteChainId, _path); } function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner { trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this)); emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress); } function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) { bytes memory path = trustedRemoteLookup[_remoteChainId]; if (path.length == 0) { revert LZAPPNoTrustedPathRecord(); } return path.slice(0, path.length - 20); // the last 20 bytes should be address(this) } function setPrecrime(address _precrime) external onlyOwner { precrime = _precrime; emit SetPrecrime(_precrime); } function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner { if (_minGas == 0) { revert LZAPPInvalidMinGas(); } minDstGasLookup[_dstChainId][_packetType] = _minGas; emit SetMinDstGas(_dstChainId, _packetType, _minGas); } // if the size is 0, it means default size limit function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner { payloadSizeLimitLookup[_dstChainId] = _size; } //--------------------------- VIEW FUNCTION ---------------------------------------- function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { bytes memory trustedSource = trustedRemoteLookup[_srcChainId]; return keccak256(trustedSource) == keccak256(_srcAddress); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LzApp.sol"; import "../util/ExcessivelySafeCall.sol"; /* * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress) */ abstract contract NonblockingLzApp is LzApp { using ExcessivelySafeCall for address; error LZAPPInvalidPayload(); function __NonblockingLzApp_init(address _endpoint) internal { __LzApp_init(_endpoint); } mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason); event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash); // overriding the virtual function in LzReceiver function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)); // try-catch all errors/exceptions if (!success) { _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason); } } function _storeFailedMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason) internal virtual { failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason); } function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual { // only internal transaction if (_msgSender() != address(this)) { revert LZAPPInvalidEndpointCaller(); } _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } //@notice override this function function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual { // assert there is message to retry bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce]; if (payloadHash == bytes32(0)) { revert LZAPPInvalidSourceSendingContract(); } if (keccak256(_payload) != payloadHash) { revert LZAPPInvalidPayload(); } // clear the stored message failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0); // execute the message. revert if it fails again _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./OFTCoreV2.sol"; import "./IOFTV2.sol"; import "../../../../oz/utils/introspection/ERC165.sol"; abstract contract BaseOFTV2 is OFTCoreV2, ERC165, IOFTV2 { constructor(uint8 _sharedDecimals) OFTCoreV2(_sharedDecimals) { } function __BaseOFTV2_init(address _lzEndpoint) internal { __OFTCoreV2_init(_lzEndpoint); } /************************************************************************ * public functions ************************************************************************/ function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) public payable virtual override { _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams); } function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) public payable virtual override { _sendAndCall(_from, _dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams); } /************************************************************************ * public view functions ************************************************************************/ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IOFTV2).interfaceId || super.supportsInterface(interfaceId); } function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams); } function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams); } function circulatingSupply() public view virtual override returns (uint); function token() public view virtual override returns (address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "../../../../oz/utils/introspection/IERC165.sol"; /** * @dev Interface of the IOFT core standard */ interface ICommonOFT is IERC165 { struct LzCallParams { address payable refundAddress; address zroPaymentAddress; bytes adapterParams; } /** * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) * _dstChainId - L0 defined chain id to send tokens too * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain * _amount - amount of the tokens to transfer * _useZro - indicates to use zro to pay L0 fees * _adapterParam - flexible bytes array to indicate messaging adapter services in L0 */ function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); /** * @dev returns the circulating amount of tokens on current chain */ function circulatingSupply() external view returns (uint); /** * @dev returns the address of the ERC20 token */ function token() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; interface IOFTReceiverV2 { /** * @dev Called by the OFT contract when tokens are received from source chain. * @param _srcChainId The chain id of the source chain. * @param _srcAddress The address of the OFT token contract on the source chain. * @param _nonce The nonce of the transaction on the source chain. * @param _from The address of the account who calls the sendAndCall() on the source chain. * @param _amount The amount of tokens to transfer. * @param _payload Additional data with no specified format. */ function onOFTReceived(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes32 _from, uint _amount, bytes calldata _payload) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ICommonOFT.sol"; /** * @dev Interface of the IOFT core standard */ interface IOFTV2 is ICommonOFT { /** * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` * `_from` the owner of token * `_dstChainId` the destination chain identifier * `_toAddress` can be any size depending on the `dstChainId`. * `_amount` the quantity of tokens in wei * `_refundAddress` the address LayerZero refunds if too much message fee is sent * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) * `_adapterParams` is a flexible bytes array to indicate messaging adapter services */ function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) external payable; function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../../lzApp/NonblockingLzApp.sol"; import "../../../util/ExcessivelySafeCall.sol"; import "./ICommonOFT.sol"; import "./IOFTReceiverV2.sol"; abstract contract OFTCoreV2 is NonblockingLzApp { using BytesLib for bytes; using ExcessivelySafeCall for address; error OFTCoreCallerMustBeOFTCore(); error OFTCoreUnknownPacketType(); error OFTCoreAmountZero(); error OFTCoreAdapterParamsNotAllowed(); error OFTCoreAmountSDOverflow(); error OFTCoreInvalidPayload(); uint public constant NO_EXTRA_GAS = 0; // packet type uint8 public constant PT_SEND = 0; uint8 public constant PT_SEND_AND_CALL = 1; uint8 public immutable sharedDecimals; bool public useCustomAdapterParams; mapping(uint16 => mapping(bytes => mapping(uint64 => bool))) public creditedPackets; /** * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`) * `_nonce` is the outbound nonce */ event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes32 indexed _toAddress, uint _amount); /** * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain. * `_nonce` is the inbound nonce. */ event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount); event SetUseCustomAdapterParams(bool _useCustomAdapterParams); event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash); event NonContractAddress(address _address); // _sharedDecimals should be the minimum decimals on all chains constructor(uint8 _sharedDecimals) { sharedDecimals = _sharedDecimals; } function __OFTCoreV2_init(address _lzEndpoint) internal { __NonblockingLzApp_init(_lzEndpoint); } /************************************************************************ * public functions ************************************************************************/ function callOnOFTReceived(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes32 _from, address _to, uint _amount, bytes calldata _payload, uint _gasForCall) public virtual { if (_msgSender() != address(this)) { revert OFTCoreCallerMustBeOFTCore(); } // send _amount = _transferFrom(address(this), _to, _amount); emit ReceiveFromChain(_srcChainId, _to, _amount); // call IOFTReceiverV2(_to).onOFTReceived{gas: _gasForCall}(_srcChainId, _srcAddress, _nonce, _from, _amount, _payload); } function setUseCustomAdapterParams(bool _useCustomAdapterParams) public virtual onlyOwner { useCustomAdapterParams = _useCustomAdapterParams; emit SetUseCustomAdapterParams(_useCustomAdapterParams); } /************************************************************************ * internal functions ************************************************************************/ function _estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes memory _adapterParams) internal view virtual returns (uint nativeFee, uint zroFee) { // mock the payload for sendFrom() bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount)); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function _estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes memory _payload, uint64 _dstGasForCall, bool _useZro, bytes memory _adapterParams) internal view virtual returns (uint nativeFee, uint zroFee) { // mock the payload for sendAndCall() bytes memory payload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(_amount), _payload, _dstGasForCall); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { uint8 packetType = _payload.toUint8(0); if (packetType == PT_SEND) { _sendAck(_srcChainId, _srcAddress, _nonce, _payload); } else if (packetType == PT_SEND_AND_CALL) { _sendAndCallAck(_srcChainId, _srcAddress, _nonce, _payload); } else { revert OFTCoreUnknownPacketType(); } } function _send(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual returns (uint amount) { _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS); (amount,) = _removeDust(_amount); amount = _debitFrom(_from, _dstChainId, _toAddress, amount); // amount returned should not have dust if (amount == 0) { revert OFTCoreAmountZero(); } bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount)); _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendToChain(_dstChainId, _from, _toAddress, amount); } function _sendAck(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual { (address to, uint64 amountSD) = _decodeSendPayload(_payload); if (to == address(0)) { to = address(0xdead); } uint amount = _sd2ld(amountSD); amount = _creditTo(_srcChainId, to, amount); emit ReceiveFromChain(_srcChainId, to, amount); } function _sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes memory _payload, uint64 _dstGasForCall, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual returns (uint amount) { _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall); (amount,) = _removeDust(_amount); amount = _debitFrom(_from, _dstChainId, _toAddress, amount); if (amount == 0) { revert OFTCoreAmountZero(); } // encode the msg.sender into the payload instead of _from bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall); _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendToChain(_dstChainId, _from, _toAddress, amount); } function _sendAndCallAck(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual { (bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload); bool credited = creditedPackets[_srcChainId][_srcAddress][_nonce]; uint amount = _sd2ld(amountSD); // credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds if (!credited) { amount = _creditTo(_srcChainId, address(this), amount); creditedPackets[_srcChainId][_srcAddress][_nonce] = true; } if (!_isContract(to)) { emit NonContractAddress(to); return; } // workaround for stack too deep uint16 srcChainId = _srcChainId; bytes memory srcAddress = _srcAddress; uint64 nonce = _nonce; bytes memory payload = _payload; bytes32 from_ = from; address to_ = to; uint amount_ = amount; bytes memory payloadForCall_ = payloadForCall; // no gas limit for the call if retry uint gas = credited ? gasleft() : gasForCall; (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.callOnOFTReceived.selector, srcChainId, srcAddress, nonce, from_, to_, amount_, payloadForCall_, gas)); if (success) { bytes32 hash = keccak256(payload); emit CallOFTReceivedSuccess(srcChainId, srcAddress, nonce, hash); } else { // store the failed message into the nonblockingLzApp _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason); } } function _isContract(address _account) internal view returns (bool) { return _account.code.length > 0; } function _checkAdapterParams(uint16 _dstChainId, uint16 _pkType, bytes memory _adapterParams, uint _extraGas) internal virtual { if (useCustomAdapterParams) { _checkGasLimit(_dstChainId, _pkType, _adapterParams, _extraGas); } else if (_adapterParams.length != 0) { revert OFTCoreAdapterParamsNotAllowed(); } } function _ld2sd(uint _amount) internal virtual view returns (uint64) { uint amountSD = _amount / _ld2sdRate(); if (amountSD > type(uint64).max) { revert OFTCoreAmountSDOverflow(); } return uint64(amountSD); } function _sd2ld(uint64 _amountSD) internal virtual view returns (uint) { return _amountSD * _ld2sdRate(); } function _removeDust(uint _amount) internal virtual view returns (uint amountAfter, uint dust) { dust = _amount % _ld2sdRate(); amountAfter = _amount - dust; } function _encodeSendPayload(bytes32 _toAddress, uint64 _amountSD) internal virtual view returns (bytes memory) { return abi.encodePacked(PT_SEND, _toAddress, _amountSD); } function _decodeSendPayload(bytes memory _payload) internal virtual view returns (address to, uint64 amountSD) { if (_payload.toUint8(0) != PT_SEND || _payload.length != 41) { revert OFTCoreInvalidPayload(); } to = _payload.toAddress(13); // drop the first 12 bytes of bytes32 amountSD = _payload.toUint64(33); } function _encodeSendAndCallPayload(address _from, bytes32 _toAddress, uint64 _amountSD, bytes memory _payload, uint64 _dstGasForCall) internal virtual view returns (bytes memory) { return abi.encodePacked( PT_SEND_AND_CALL, _toAddress, _amountSD, _addressToBytes32(_from), _dstGasForCall, _payload ); } function _decodeSendAndCallPayload(bytes memory _payload) internal virtual view returns (bytes32 from, address to, uint64 amountSD, bytes memory payload, uint64 dstGasForCall) { if (_payload.toUint8(0) != PT_SEND_AND_CALL) { revert OFTCoreInvalidPayload(); } to = _payload.toAddress(13); // drop the first 12 bytes of bytes32 amountSD = _payload.toUint64(33); from = _payload.toBytes32(41); dstGasForCall = _payload.toUint64(73); payload = _payload.slice(81, _payload.length - 81); } function _addressToBytes32(address _address) internal pure virtual returns (bytes32) { return bytes32(uint(uint160(_address))); } function _debitFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount) internal virtual returns (uint); function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual returns (uint); function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint); function _ld2sdRate() internal view virtual returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../../../oz/token/ERC20/ERC20.sol"; import "./BaseOFTV2.sol"; contract OFTV2 is BaseOFTV2, ERC20 { error OFTSharedDecimalsMustBeLessThanOrEqualToDecimals(uint8 sharedDecimals, uint8 decimals); uint internal immutable ld2sdRate; constructor(string memory _name, string memory _symbol, uint8 _sharedDecimals) ERC20(_name, _symbol) BaseOFTV2(_sharedDecimals) { uint8 decimals = decimals(); if (_sharedDecimals > decimals) { revert OFTSharedDecimalsMustBeLessThanOrEqualToDecimals(_sharedDecimals, decimals); } ld2sdRate = 10 ** (decimals - _sharedDecimals); } function __OFTV2_init(address _lzEndpoint) internal { __BaseOFTV2_init(_lzEndpoint); } /************************************************************************ * public functions ************************************************************************/ function circulatingSupply() public view virtual override returns (uint) { return totalSupply(); } function token() public view virtual override returns (address) { return address(this); } /************************************************************************ * internal functions ************************************************************************/ function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) { address spender = _msgSender(); if (_from != spender) _spendAllowance(_from, spender, _amount); _burn(_from, _amount); return _amount; } function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) { _mint(_toAddress, _amount); return _amount; } function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) { address spender = _msgSender(); // if transfer from this contract, no need to check allowance if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount); _transfer(_from, _to, _amount); return _amount; } function _ld2sdRate() internal view virtual override returns (uint) { return ld2sdRate; } }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.7.6; library ExcessivelySafeCall { uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := call( _gas, // gas _target, // recipient 0, // ether value add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeStaticCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal view returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := staticcall( _gas, // gas _target, // recipient add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /** * @notice Swaps function selectors in encoded contract calls * @dev Allows reuse of encoded calldata for functions with identical * argument types but different names. It simply swaps out the first 4 bytes * for the new selector. This function modifies memory in place, and should * only be used with caution. * @param _newSelector The new 4-byte selector * @param _buf The encoded contract args */ function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure { require(_buf.length >= 4); uint256 _mask = LOW_28_MASK; assembly { // load the first word of let _word := mload(add(_buf, 0x20)) // mask out the top 4 bytes // /x _word := and(_word, _mask) _word := or(_newSelector, _word) mstore(add(_buf, 0x20), _word) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../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. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); error OnlyOwner(); error NewOwnerIsZeroAddress(); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @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 OnlyOwner(); } } /** * @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 NewOwnerIsZeroAddress(); } _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 v4.9.0) (governance/utils/IVotes.sol) pragma solidity ^0.8.0; /** * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts. * * _Available since v4.5._ */ interface IVotes { /** * @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 votes. */ event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance); /** * @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 v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; 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 v4.9.0) (interfaces/IERC5805.sol) pragma solidity ^0.8.0; import "../governance/utils/IVotes.sol"; import "./IERC6372.sol"; interface IERC5805 is IERC6372, IVotes {}
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC6372.sol) pragma solidity ^0.8.0; 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 v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.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}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * 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. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { error ERC20DecreasedAllowanceBelowZero(); error ERC20TransferToZeroAddress(); error ERC20TransferFromZeroAddress(); error ERC20TransferExceedsBalance(); error ERC20MintToZeroAddress(); error ERC20ApproveFromZeroAddress(); error ERC20ApproveToZeroAddress(); error ERC20TransferExceedsAllowance(); mapping(address => uint256) private _balances; mapping(address => mapping(address => 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 override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the 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 override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); if (currentAllowance < subtractedValue) { revert ERC20DecreasedAllowanceBelowZero(); } unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `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. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { if (from == address(0)) { revert ERC20TransferFromZeroAddress(); } if (to == address(0)) { revert ERC20TransferToZeroAddress(); } _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; if (fromBalance < amount) { revert ERC20TransferExceedsBalance(); } unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { if (account == address(0)) { revert ERC20MintToZeroAddress(); } _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { if (owner == address(0)) { revert ERC20ApproveFromZeroAddress(); } if (spender == address(0)) { revert ERC20ApproveToZeroAddress(); } _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < amount) { revert ERC20TransferExceedsAllowance(); } unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.0; import "./IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/cryptography/EIP712.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; error ERC20PermitExpired(); error ERC20PermitInvalidSignature(); mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { if (block.timestamp > deadline) { revert ERC20PermitExpired(); } bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); if (signer != owner) { revert ERC20PermitInvalidSignature(); } _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Votes.sol) pragma solidity ^0.8.0; import "./ERC20Permit.sol"; import "../../../interfaces/IERC5805.sol"; import "../../../utils/math/Math.sol"; import "../../../utils/math/SafeCast.sol"; import "../../../utils/cryptography/ECDSA.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^224^ - 1, while COMP is limited to 2^96^ - 1. * * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module. * * 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. * * _Available since v4.2._ */ abstract contract ERC20Votes is ERC20Permit, IERC5805 { struct Checkpoint { uint32 fromBlock; uint224 votes; } error ERC20VotesBrokenClock(); error ERC20VotesSupplyOverflow(); error ERC20VotesFutureLookup(); error ERC20VotesSignatureExpired(); error ERC20VotesInvalidNonce(); bytes32 private constant _DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); mapping(address => address) private _delegates; mapping(address => Checkpoint[]) private _checkpoints; Checkpoint[] private _totalSupplyCheckpoints; /** * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting). */ function clock() public view virtual override returns (uint48) { return SafeCast.toUint48(block.number); } /** * @dev Description of the clock */ // 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() != block.number) { revert ERC20VotesBrokenClock(); } return "mode=blocknumber&from=default"; } /** * @dev Get the `pos`-th checkpoint for `account`. */ function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) { return _checkpoints[account][pos]; } /** * @dev Get number of checkpoints for `account`. */ function numCheckpoints(address account) public view virtual returns (uint32) { return SafeCast.toUint32(_checkpoints[account].length); } /** * @dev Get the address `account` is currently delegating to. */ function delegates(address account) public view virtual override returns (address) { return _delegates[account]; } /** * @dev Gets the current votes balance for `account` */ function getVotes(address account) public view virtual override returns (uint256) { uint256 pos = _checkpoints[account].length; unchecked { return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes; } } /** * @dev Retrieve the number of votes for `account` at the end of `timepoint`. * * Requirements: * * - `timepoint` must be in the past */ function getPastVotes(address account, uint256 timepoint) public view virtual override returns (uint256) { if (timepoint >= clock()) { revert ERC20VotesFutureLookup(); } return _checkpointsLookup(_checkpoints[account], timepoint); } /** * @dev Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances. * It is NOT the sum of all the delegated votes! * * Requirements: * * - `timepoint` must be in the past */ function getPastTotalSupply(uint256 timepoint) public view virtual override returns (uint256) { if (timepoint >= clock()) { revert ERC20VotesFutureLookup(); } return _checkpointsLookup(_totalSupplyCheckpoints, timepoint); } /** * @dev Lookup a value in a list of (sorted) checkpoints. */ function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 timepoint) private view returns (uint256) { // We run a binary search to look for the last (most recent) checkpoint taken before (or at) `timepoint`. // // Initially we check if the block is recent to narrow the search range. // During the loop, the index of the wanted checkpoint remains in the range [low-1, high). // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant. // - If the middle checkpoint is after `timepoint`, we look in [low, mid) // - If the middle checkpoint is before or equal to `timepoint`, we look in [mid+1, high) // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not // out of bounds (in which case we're looking too far in the past and the result is 0). // Note that if the latest checkpoint available is exactly for `timepoint`, we end up with an index that is // past the end of the array, so we technically don't find a checkpoint after `timepoint`, but it works out // the same. uint256 length = ckpts.length; uint256 low = 0; uint256 high = length; if (length > 5) { uint256 mid = length - Math.sqrt(length); if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) { high = mid; } else { low = mid + 1; } } while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) { high = mid; } else { low = mid + 1; } } unchecked { return high == 0 ? 0 : _unsafeAccess(ckpts, high - 1).votes; } } /** * @dev Delegate votes from the sender to `delegatee`. */ function delegate(address delegatee) public virtual override { _delegate(_msgSender(), delegatee); } /** * @dev Delegates votes from signer to `delegatee` */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public virtual override { if (block.timestamp > expiry) { revert ERC20VotesSignatureExpired(); } address signer = ECDSA.recover( _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))), v, r, s ); if (nonce != _useNonce(signer)) { revert ERC20VotesInvalidNonce(); } _delegate(signer, delegatee); } /** * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1). */ function _maxSupply() internal view virtual returns (uint224) { return type(uint224).max; } /** * @dev Snapshots the totalSupply after it has been increased. */ function _mint(address account, uint256 amount) internal virtual override { super._mint(account, amount); if (totalSupply() > _maxSupply()) { revert ERC20VotesSupplyOverflow(); } _writeCheckpoint(_totalSupplyCheckpoints, _add, amount); } /** * @dev Snapshots the totalSupply after it has been decreased. */ function _burn(address account, uint256 amount) internal virtual override { super._burn(account, amount); _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount); } /** * @dev Move voting power when tokens are transferred. * * Emits a {IVotes-DelegateVotesChanged} event. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); } /** * @dev Change delegation for `delegator` to `delegatee`. * * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}. */ function _delegate(address delegator, address delegatee) internal virtual { address currentDelegate = delegates(delegator); uint256 delegatorBalance = balanceOf(delegator); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveVotingPower(currentDelegate, delegatee, delegatorBalance); } function _moveVotingPower(address src, address dst, uint256 amount) private { if (src != dst && amount > 0) { if (src != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount); emit DelegateVotesChanged(src, oldWeight, newWeight); } if (dst != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount); emit DelegateVotesChanged(dst, oldWeight, newWeight); } } } function _writeCheckpoint( Checkpoint[] storage ckpts, function(uint256, uint256) view returns (uint256) op, uint256 delta ) private returns (uint256 oldWeight, uint256 newWeight) { uint256 pos = ckpts.length; unchecked { Checkpoint memory oldCkpt = pos == 0 ? Checkpoint(0, 0) : _unsafeAccess(ckpts, pos - 1); oldWeight = oldCkpt.votes; newWeight = op(oldWeight, delta); if (pos > 0 && oldCkpt.fromBlock == clock()) { _unsafeAccess(ckpts, pos - 1).votes = SafeCast.toUint224(newWeight); } else { ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(clock()), votes: SafeCast.toUint224(newWeight)})); } } } function _add(uint256 a, uint256 b) private pure returns (uint256) { return a + b; } function _subtract(uint256 a, uint256 b) private pure returns (uint256) { return a - b; } /** * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds. */ function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) { assembly { mstore(0, ckpts.slot) result.slot := add(keccak256(0, 0x20), pos) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @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. */ 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]. */ 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 v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../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; error SafeERC20ApproveFromNonZeroToNonZeroAllowance(); error SafeERC20DecreaseAllowanceBelowZero(); error SafeERC20PermitInvalidNonce(); error SafeERC20ERC20OperationFailed(); /** * @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' if ((value != 0) && (token.allowance(address(this), spender) != 0)) { revert SafeERC20ApproveFromNonZeroToNonZeroAllowance(); } _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); if (oldAllowance < value) { revert SafeERC20DecreaseAllowanceBelowZero(); } _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @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.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); if (nonceAfter != nonceBefore + 1) { revert SafeERC20PermitInvalidNonce(); } } /** * @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, "SafeERC20: low-level call failed"); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20ERC20OperationFailed(); } } /** * @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.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @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, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode 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 {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] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { 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); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode 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 {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); 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] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); 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. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // 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); } // 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); } return (signer, RecoverError.NoError); } /** * @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) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; import "./ECDSA.sol"; import "../ShortStrings.sol"; import "../../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 specified in the EIP is very generic, and such a generic 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 their contracts 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. * * _Available since v3.4._ * * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment */ 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _name.toStringWithFallback(_nameFallback), _version.toStringWithFallback(_versionFallback), block.chainid, address(this), bytes32(0), new uint256[](0) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @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 up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (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; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) 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. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); 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 (rounding == Rounding.Up && 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 down. * * 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @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. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @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 * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); 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 * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); 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 * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); 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 * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); 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 * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); 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 * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); 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 * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); 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 * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); 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 * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); 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 * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); 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 * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); 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 * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); 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 * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); 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 * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); 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 * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); 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 * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); 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 * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); 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 * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); 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 * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); 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 * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); 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 * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); 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 * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); 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 * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); 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 * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); 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 * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); 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 * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); 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 * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); 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 * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); 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 * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); 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 * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); 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 * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); 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 * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @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 * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @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 * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @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 * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @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 * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @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 * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @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 * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @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 v4.9.0) (utils/ShortStrings.sol) pragma solidity ^0.8.8; import "./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 v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @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(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ 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 v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @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), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(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) { 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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); 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 keccak256(bytes(a)) == keccak256(bytes(b)); } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 850, "details": { "yul": true } }, "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"BothAddressesAreContracts","type":"error"},{"inputs":[],"name":"ERC20ApproveFromZeroAddress","type":"error"},{"inputs":[],"name":"ERC20ApproveToZeroAddress","type":"error"},{"inputs":[],"name":"ERC20DecreasedAllowanceBelowZero","type":"error"},{"inputs":[],"name":"ERC20MintToZeroAddress","type":"error"},{"inputs":[],"name":"ERC20PermitExpired","type":"error"},{"inputs":[],"name":"ERC20PermitInvalidSignature","type":"error"},{"inputs":[],"name":"ERC20TransferExceedsAllowance","type":"error"},{"inputs":[],"name":"ERC20TransferExceedsBalance","type":"error"},{"inputs":[],"name":"ERC20TransferFromZeroAddress","type":"error"},{"inputs":[],"name":"ERC20TransferToZeroAddress","type":"error"},{"inputs":[],"name":"ERC20VotesBrokenClock","type":"error"},{"inputs":[],"name":"ERC20VotesFutureLookup","type":"error"},{"inputs":[],"name":"ERC20VotesInvalidNonce","type":"error"},{"inputs":[],"name":"ERC20VotesSignatureExpired","type":"error"},{"inputs":[],"name":"ERC20VotesSupplyOverflow","type":"error"},{"inputs":[],"name":"InvalidArrayLength","type":"error"},{"inputs":[],"name":"InvalidBuyTaxReceiver","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"LZAPPInvalidAdapterParams","type":"error"},{"inputs":[],"name":"LZAPPInvalidDestinationChain","type":"error"},{"inputs":[],"name":"LZAPPInvalidEndpointCaller","type":"error"},{"inputs":[],"name":"LZAPPInvalidGasLimit","type":"error"},{"inputs":[],"name":"LZAPPInvalidMinGas","type":"error"},{"inputs":[],"name":"LZAPPInvalidMinGasLimit","type":"error"},{"inputs":[],"name":"LZAPPInvalidPayload","type":"error"},{"inputs":[],"name":"LZAPPInvalidPayloadSize","type":"error"},{"inputs":[],"name":"LZAPPInvalidSourceSendingContract","type":"error"},{"inputs":[],"name":"LZAPPNoTrustedPathRecord","type":"error"},{"inputs":[],"name":"MaxTaxExceeded","type":"error"},{"inputs":[],"name":"MigratorSetOnInvalidChain","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"OFTCoreAdapterParamsNotAllowed","type":"error"},{"inputs":[],"name":"OFTCoreAmountSDOverflow","type":"error"},{"inputs":[],"name":"OFTCoreAmountZero","type":"error"},{"inputs":[],"name":"OFTCoreCallerMustBeOFTCore","type":"error"},{"inputs":[],"name":"OFTCoreInvalidPayload","type":"error"},{"inputs":[],"name":"OFTCoreUnknownPacketType","type":"error"},{"inputs":[{"internalType":"uint8","name":"sharedDecimals","type":"uint8"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"name":"OFTSharedDecimalsMustBeLessThanOrEqualToDecimals","type":"error"},{"inputs":[],"name":"OnlyMigrator","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[],"name":"SafeERC20ERC20OperationFailed","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"TransferBlacklisted","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"_hash","type":"bytes32"}],"name":"CallOFTReceivedSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_reason","type":"bytes"}],"name":"MessageFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"NonContractAddress","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":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"ReceiveFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"_payloadHash","type":"bytes32"}],"name":"RetryMessageSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"SendToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"buyTaxReceiver","type":"address"}],"name":"SetBuyTaxReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isAntiMEV","type":"bool"}],"name":"SetIsAntiMEV","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isBlacklisting","type":"bool"}],"name":"SetIsTransferBlacklisting","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_minDstGas","type":"uint256"}],"name":"SetMinDstGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"precrime","type":"address"}],"name":"SetPrecrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"buyTax","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sellTax","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isTaxing","type":"bool"}],"name":"SetTax","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"whitelist","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"SetTaxWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"taxableContract","type":"address"},{"indexed":false,"internalType":"bool","name":"isTaxable","type":"bool"}],"name":"SetTaxableContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"blacklist","type":"address"},{"indexed":false,"internalType":"bool","name":"isBlacklisted","type":"bool"}],"name":"SetTransferBlacklist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_path","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"SetTrustedRemoteAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"SetUseCustomAdapterParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"CLOCK_MODE","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_PAYLOAD_SIZE_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NO_EXTRA_GAS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT_SEND","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT_SEND_AND_CALL","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes32","name":"_from","type":"bytes32"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_payload","type":"bytes"},{"internalType":"uint256","name":"_gasForCall","type":"uint256"}],"name":"callOnOFTReceived","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32","name":"pos","type":"uint32"}],"name":"checkpoints","outputs":[{"components":[{"internalType":"uint32","name":"fromBlock","type":"uint32"},{"internalType":"uint224","name":"votes","type":"uint224"}],"internalType":"struct ERC20Votes.Checkpoint","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"circulatingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clock","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"creditedPackets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_payload","type":"bytes"},{"internalType":"uint64","name":"_dstGasForCall","type":"uint64"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendAndCallFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"failedMessages","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"forceResumeReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timepoint","type":"uint256"}],"name":"getPastTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timepoint","type":"uint256"}],"name":"getPastVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getTrustedRemoteAddress","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"address","name":"_buyTaxReceiver","type":"address"},{"internalType":"address","name":"_antiMEVStrategy","type":"address"},{"internalType":"address","name":"_migrator","type":"address"},{"internalType":"uint256","name":"_migratorMintSupply","type":"uint256"},{"internalType":"uint256","name":"_buyTax","type":"uint256"},{"internalType":"uint256","name":"_sellTax","type":"uint256"},{"internalType":"bool","name":"_isTaxingEnabled","type":"bool"},{"internalType":"bool","name":"_isAntiMEV","type":"bool"},{"internalType":"bool","name":"_isTransferBlacklisting","type":"bool"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"payloadSizeLimitLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"precrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recoverToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_payload","type":"bytes"},{"internalType":"uint64","name":"_dstGasForCall","type":"uint64"},{"components":[{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"address","name":"zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"adapterParams","type":"bytes"}],"internalType":"struct ICommonOFT.LzCallParams","name":"_callParams","type":"tuple"}],"name":"sendAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"components":[{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"address","name":"zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"adapterParams","type":"bytes"}],"internalType":"struct ICommonOFT.LzCallParams","name":"_callParams","type":"tuple"}],"name":"sendFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IAntiMevStrategy","name":"_antiMEVStrategy","type":"address"}],"name":"setAntiMevStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_buyTaxReceiver","type":"address"}],"name":"setBuyTaxReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isAntiMEV","type":"bool"}],"name":"setIsAntiMEV","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isBlacklisting","type":"bool"}],"name":"setIsTransferBlacklisting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"setPayloadSizeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_precrime","type":"address"}],"name":"setPrecrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_buyTax","type":"uint256"},{"internalType":"uint256","name":"_sellTax","type":"uint256"},{"internalType":"bool","name":"_isTaxingEnabled","type":"bool"}],"name":"setTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_whitelist","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setTaxWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_taxableContract","type":"address"},{"internalType":"bool","name":"_isTaxable","type":"bool"}],"name":"setTaxableContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_blacklist","type":"address"},{"internalType":"bool","name":"_isBlacklisted","type":"bool"}],"name":"setTransferBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"setUseCustomAdapterParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sharedDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useCustomAdapterParams","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101a0604090808252346200048357620000198162000488565b60039081815260209182820190622122a760e91b8083528551946200003e8662000488565b8286528181870152865191620000548362000488565b83835281830152865196620000698862000488565b6001808952603160f81b838a0190815260008054336001600160a01b0319821681178355919792969291906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08980a3600860805289516001600160401b039a908b81116200039f57600c54918583811c9316801562000478575b8884101462000380578190601f9384811162000424575b508890848311600114620003bf578b92620003b3575b505060001982851b1c191690851b17600c555b8251928b84116200039f57600d548581811c9116801562000394575b88821014620003805782811162000337575b5086918411600114620002ce579383949184928a95620002c2575b50501b92600019911b1c191617600d555b6402540be40060a0526200019a86620004ba565b94610160958652620001ac8962000697565b966101809788525190209261012098848a5251902093610140948086524660e0528251938401947f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f86528385015260608401524660808401523060a084015260a0835260c083019783891090891117620002ae575086905251902060c052306101009081526015805460ff60e01b1916600160e01b179055615fd795908662000850873960805186611a51015260a05186818161396a01528181613c5f01528181613fa4015261400c015260c051866159d1015260e05186615a8c015251856159a201525184615a2001525183615a4601525182611959015251816119830152f35b634e487b7160e01b81526041600452602490fd5b01519350388062000175565b600d895286892092919084601f1981168b5b8a898383106200031f575050501062000304575b50505050811b01600d5562000186565b01519060f884600019921b161c1916905538808080620002f4565b868601518955909701969485019488935001620002e0565b600d8a52878a208380870160051c8201928a881062000376575b0160051c019086905b8281106200036a5750506200015a565b8b81550186906200035a565b9250819262000351565b634e487b7160e01b8a52602260045260248afd5b90607f169062000148565b634e487b7160e01b89526041600452602489fd5b01519050388062000119565b600c8c52898c208894509190601f1984168d5b8c8282106200040d5750508411620003f4575b505050811b01600c556200012c565b015160001983871b60f8161c19169055388080620003e5565b8385015186558b97909501949384019301620003d2565b909150600c8b52888b208480850160051c8201928b86106200046e575b918991869594930160051c01915b8281106200045f57505062000103565b8d81558594508991016200044f565b9250819262000441565b92607f1692620000ec565b600080fd5b604081019081106001600160401b03821117620004a457604052565b634e487b7160e01b600052604160045260246000fd5b805160209081811015620005575750601f825111620004f65780825192015190808310620004e757501790565b82600019910360031b1b161790565b90604051809263305a27a960e01b82528060048301528251908160248401526000935b8285106200053d575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935062000519565b906001600160401b038211620004a457600e54926001938481811c911680156200068c575b838210146200067657601f81116200063c575b5081601f8411600114620005d05750928293918392600094620005c4575b50501b916000199060031b1c191617600e5560ff90565b015192503880620005ad565b919083601f198116600e60005284600020946000905b8883831062000621575050501062000607575b505050811b01600e5560ff90565b015160001960f88460031b161c19169055388080620005f9565b858701518855909601959485019487935090810190620005e6565b600e60005284601f84600020920160051c820191601f860160051c015b828110620006695750506200058f565b6000815501859062000659565b634e487b7160e01b600052602260045260246000fd5b90607f16906200057c565b805160209081811015620007255750601f825111620006c45780825192015190808310620004e757501790565b90604051809263305a27a960e01b82528060048301528251908160248401526000935b8285106200070b575050604492506000838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350620006e7565b906001600160401b038211620004a457600f54926001938481811c9116801562000844575b838210146200067657601f81116200080a575b5081601f84116001146200079e575092829391839260009462000792575b50501b916000199060031b1c191617600f5560ff90565b0151925038806200077b565b919083601f198116600f60005284600020946000905b88838310620007ef5750505010620007d5575b505050811b01600f5560ff90565b015160001960f88460031b161c19169055388080620007c7565b858701518855909601959485019487935090810190620007b4565b600f60005284601f84600020920160051c820191601f860160051c015b828110620008375750506200075d565b6000815501859062000827565b90607f16906200074a56fe6080604052600436101561001257600080fd5b60003560e01c80621d3567146104dc57806301ffc9a7146104d757806306fdde03146104d257806307e0db17146104cd578063095ea7b3146104c85780630df37483146104c357806310ddb137146104be57806318160ddd1461040a57806323b872dd146104b95780632518d450146104b4578063313ce567146104af5780633644e515146104aa578063365260b4146104a557806339509351146104a05780633a46b1a81461049b5780633d8b38f6146104965780633f1f4fa41461049157806342966c681461048c57806342d65a8d14610487578063447705151461047d5780634bf5d7e9146104825780634c42899a1461047d578063587cde1e146104785780635afde063146104735780635b8c41e61461046e5780635c19a95c1461046957806363cd3c691461046457806366ad5c8a1461045f578063695ef6bf1461045a5780636fcfff451461045557806370a0823114610450578063715018a61461044b5780637533d7881461044657806376203b481461044157806379cc67901461043c5780637c9242e8146104375780637ecebe001461043257806384761dbb1461042d57806384b0196e14610428578063857749b0146104235780638cfd8f5c1461041e5780638da5cb5b146104195780638e539e8c1461041457806391ddadf41461040f5780639358928b1461040a578063950c8a741461040557806395d89b41146104005780639ab24eb0146103fb5780639bdb9812146103f65780639f38369a146103f1578063a457c2d7146103ec578063a4c51df5146103e7578063a6c3d165146103e2578063a9059cbb146103dd578063ac8da3c4146103d8578063b29a8140146103d3578063b353aaa7146103ce578063baf3292d146103c9578063c3cda520146103c4578063c4461834146103bf578063cbed8b9c146103ba578063d1deba1f146103b5578063d505accf146103b0578063dd62ed3e146103ab578063df2a5b3b146103a6578063e5a001f3146103a1578063e6a20ae61461039c578063e9c80e6314610397578063eab45d9c14610392578063eaffd49a1461038d578063eb8d72b714610388578063ed629c5c14610383578063f1127ed81461037e578063f2fde38b14610379578063f5ecbdbc14610374578063f840edfd1461036f5763fc0c546a1461036a57600080fd5b612f41565b612efd565b612e33565b612d97565b612d11565b612cee565b612ba9565b612b23565b612ac1565b612a8e565b612a72565b6129c9565b612904565b6128a8565b612765565b612625565b612545565b612528565b6123fc565b612370565b612349565b61220c565b6121df565b6121b5565b61202c565b611f98565b611f0e565b611df8565b611dad565b611d47565b611c9e565b611c77565b610a1e565b611c4b565b611ae6565b611abf565b611a75565b611a37565b61193e565b611911565b6118d3565b6118a6565b611872565b611750565b6116fd565b6115b9565b61157b565b61152f565b611411565b6113d1565b61136d565b611347565b6112df565b61109e565b61105e565b610fa3565b610fbf565b610f22565b610f05565b610ed0565b610e74565b610cbd565b610c5a565b610b6b565b610b48565b610b2c565b610aab565b610a3c565b61099e565b610963565b61092e565b610888565b6107a9565b6106ba565b61059e565b6004359061ffff821682036104f257565b600080fd5b6024359061ffff821682036104f257565b9181601f840112156104f25782359167ffffffffffffffff83116104f257602083818601950101116104f257565b9060806003198301126104f25760043561ffff811681036104f2579167ffffffffffffffff906024358281116104f2578161057391600401610508565b9390939260443581811681036104f257926064359182116104f25761059a91600401610508565b9091565b346104f2576105ac36610536565b91929493906105d56105c96105c96001546001600160a01b031690565b6001600160a01b031690565b3303610690576105fb6105f68661ffff166000526002602052604060002090565b6116e2565b80519081881491821592610687575b508115610663575b506106395761062961063192610637973691611226565b923691611226565b9261352c565b005b60046040517f9c5f4e7a000000000000000000000000000000000000000000000000000000008152fd5b9050610670368885611226565b602081519101209060208151910120141538610612565b1591503861060a565b60046040517f4f7ad9c4000000000000000000000000000000000000000000000000000000008152fd5b346104f25760203660031901126104f2576004357fffffffff0000000000000000000000000000000000000000000000000000000081168091036104f257807f1f7ecdf70000000000000000000000000000000000000000000000000000000060209214908115610731575b506040519015158152f35b6301ffc9a760e01b91501438610726565b60009103126104f257565b60005b8381106107605750506000910152565b8181015183820152602001610750565b906020916107898151809281855285808601910161074d565b601f01601f1916010190565b9060206107a6928181520190610770565b90565b346104f2576000806003193601126108855760405181600c546107cb81611613565b908184526020926001918281169081600014610863575060011461080a575b610806856107fa818903826111d9565b60405191829182610795565b0390f35b929450600c83527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c75b8284106108505750505081610806936107fa9282010193386107ea565b8054858501870152928501928101610833565b60ff191686860152505050151560051b82010191506107fa81610806386107ea565b80fd5b346104f25760006020366003190112610885576108a36104e1565b6108ab614567565b816001600160a01b036001541691823b1561091957602461ffff918360405195869485937f07e0db170000000000000000000000000000000000000000000000000000000085521660048401525af1801561091457610908575080f35b61091190611118565b80f35b61330d565b5080fd5b6001600160a01b038116036104f257565b346104f25760403660031901126104f25761095860043561094e8161091d565b6024359033614d15565b602060405160018152f35b346104f25760403660031901126104f25761ffff61097f6104e1565b610987614567565b166000526004602052602435604060002055600080f35b346104f25760006020366003190112610885576109b96104e1565b6109c1614567565b816001600160a01b036001541691823b1561091957602461ffff918360405195869485937f10ddb1370000000000000000000000000000000000000000000000000000000085521660048401525af1801561091457610908575080f35b346104f25760003660031901126104f2576020600b54604051908152f35b346104f25760603660031901126104f257610958600435610a5c8161091d565b602435610a688161091d565b60443591610a77833383614dde565b6145a5565b801515036104f257565b60409060031901126104f257600435610a9e8161091d565b906024356107a681610a7c565b346104f2577ffd7f6d25e7487e01d60c54f215c3a81bb6f973034cb26cf98baa0355fcc05f19610ada36610a86565b90610ae3614567565b6001600160a01b0381166000526016602052610b0f8260406000209060ff801983541691151516179055565b604080516001600160a01b039290921682529115156020820152a1005b346104f25760003660031901126104f257602060405160128152f35b346104f25760003660031901126104f2576020610b63615998565b604051908152f35b346104f25760a03660031901126104f257610b846104e1565b606435610b9081610a7c565b6084359067ffffffffffffffff82116104f257610bbd610bb66040933690600401610508565b3691611226565b92610bd4610bcc604435613fa2565b602435614041565b6001600160a01b036001541691610c0285519687958694859463040a7bb160e41b865230906004870161389d565b03915afa908115610914576000908192610c29575b50604080519182526020820192909252f35b9050610c4c915060403d8111610c53575b610c4481836111d9565b810190613887565b9038610c17565b503d610c3a565b346104f25760403660031901126104f257600435610c778161091d565b33600052600a602052610ca1816040600020906001600160a01b0316600052602052604060002090565b546024358101809111610cb8576109589133614d15565b6130a0565b346104f25760403660031901126104f257600435610cda8161091d565b6024359065ffffffffffff610cee43615e8d565b16821015610e0f576001600160a01b03166000526013602052604060002080549160008360058111610dbe575b50905b838210610d6d57505081610d455750506001600160e01b0360005b60405191168152602090f35b6000908152602090206001600160e01b0391610d689101600019015b5460201c90565b610d39565b9092610d798185615ca7565b908263ffffffff610d9e610d94858860005260206000200190565b5463ffffffff1690565b161115610dae5750925b90610d1e565b9350610db990613f54565b610da8565b80610dce610dd492969396615cbc565b9061351f565b908263ffffffff610def610d94858860005260206000200190565b161115610dff5750925b38610d1b565b9350610e0a90613f54565b610df9565b60046040517fb95f42c3000000000000000000000000000000000000000000000000000000008152fd5b9060406003198301126104f25760043561ffff811681036104f257916024359067ffffffffffffffff82116104f25761059a91600401610508565b346104f257602061ffff610ec1610e8a36610e39565b9390911660005260028452610eac610eb360406000206040519283809261164d565b03826111d9565b848151910120923691611226565b82815191012014604051908152f35b346104f25760203660031901126104f25761ffff610eec6104e1565b1660005260046020526020604060002054604051908152f35b346104f25760203660031901126104f257610637600435336150b9565b346104f2576001600160a01b03610f3836610e39565b610f40614567565b6001549160009485931690813b15610f9f5783610f8d95604051968795869485937f42d65a8d000000000000000000000000000000000000000000000000000000008552600485016134a1565b03925af1801561091457610908575080f35b8380fd5b346104f25760003660031901126104f257602060405160008152f35b346104f25760003660031901126104f2574365ffffffffffff610fe143615e8d565b160361103457610806604051610ff681611131565b601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c740000006020820152604051918291602083526020830190610770565b60046040517fd50637bf000000000000000000000000000000000000000000000000000000008152fd5b346104f25760203660031901126104f257602060043561107d8161091d565b6001600160a01b038091166000526012825260406000205416604051908152f35b346104f2577f8f3675e5a31b083483e5a782db4130316da1e3c5fca72fc2398f59692286d8a56110cd36610a86565b906110d6614567565b6001600160a01b0381166000526017602052610b0f8260406000209060ff801983541691151516179055565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff811161112c57604052565b611102565b6040810190811067ffffffffffffffff82111761112c57604052565b6020810190811067ffffffffffffffff82111761112c57604052565b6080810190811067ffffffffffffffff82111761112c57604052565b60a0810190811067ffffffffffffffff82111761112c57604052565b60e0810190811067ffffffffffffffff82111761112c57604052565b60c0810190811067ffffffffffffffff82111761112c57604052565b90601f8019910116810190811067ffffffffffffffff82111761112c57604052565b6040519061120882611131565b565b67ffffffffffffffff811161112c57601f01601f191660200190565b9291926112328261120a565b9161124060405193846111d9565b8294818452818301116104f2578281602093846000960137010152565b60606003198201126104f25760043561ffff811681036104f2579160243567ffffffffffffffff928382116104f257806023830112156104f2578160246112a993600401359101611226565b9160443590811681036104f25790565b6020906112d392826040519483868095519384920161074d565b82019081520301902090565b346104f257602061133e61ffff61131c836112f93661125d565b94909116600052600682526040600020826040519483868095519384920161074d565b8201908152030190209067ffffffffffffffff16600052602052604060002090565b54604051908152f35b346104f25760203660031901126104f2576106376004356113678161091d565b33615170565b346104f2577f271a6c83d2d471fc3b7e0785e77e48c25259853378b45972025bdfa21af522f361139c36610a86565b906113a5614567565b6001600160a01b0381166000526018602052610b0f8260406000209060ff801983541691151516179055565b346104f2576113df36610536565b9192949390303303610690576106296113fd92610637973691611226565b926138e2565b908160609103126104f25790565b60a03660031901126104f2576004356114298161091d565b6114316104f7565b6044359160843567ffffffffffffffff81116104f257611455903690600401611403565b908135916114628361091d565b611481610bb66020830135926114778461091d565b604081019061369e565b9261148c8486613eee565b6114a161149a60643561400a565b50846141fa565b938415611505577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a936114f861ffff936001600160a01b03936020966114ef6114e98b613fa2565b8d614041565b9234938c613a7b565b60405195865216941692a4005b60046040517fca69cd3c000000000000000000000000000000000000000000000000000000008152fd5b346104f25760203660031901126104f2576001600160a01b036004356115548161091d565b166000526013602052602061156d604060002054615f0b565b63ffffffff60405191168152f35b346104f25760203660031901126104f2576001600160a01b036004356115a08161091d565b1660005260096020526020604060002054604051908152f35b346104f257600080600319360112610885576115d3614567565b806001600160a01b0381546001600160a01b031981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90600182811c92168015611643575b602083101461162d57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611622565b80546000939261165c82611613565b9182825260209360019182811690816000146116c35750600114611682575b5050505050565b90939495506000929192528360002092846000945b8386106116af5750505050010190388080808061167b565b805485870183015294019385908201611697565b60ff19168685015250505090151560051b01019150388080808061167b565b906112086116f6926040519384809261164d565b03836111d9565b346104f25760203660031901126104f25761ffff6117196104e1565b166000526002602052610806610eac61173c60406000206040519283809261164d565b604051918291602083526020830190610770565b60e03660031901126104f2576004356117688161091d565b6117706104f7565b6044359167ffffffffffffffff906084358281116104f257611796903690600401610508565b9160a435848116948582036104f25760c4359081116104f2576117bd903690600401611403565b936117ff6117f78635926117d08461091d565b6117ef6117e560208a0135996114778b61091d565b9890923691611226565b963691611226565b968789613de4565b61180d61149a60643561400a565b958615611505577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a9561185661185f946001600160a01b039761184f8b613fa2565b8d33614097565b9234938a613a7b565b604051938452169261ffff1691602090a4005b346104f25760403660031901126104f2576106376004356118928161091d565b602435906118a1823383614dde565b6150b9565b346104f25760203660031901126104f2576106376004356118c681610a7c565b6118ce614567565b61327e565b346104f25760203660031901126104f2576001600160a01b036004356118f88161091d565b1660005260106020526020604060002054604051908152f35b346104f25760203660031901126104f25761063760043561193181610a7c565b611939614567565b613205565b346104f257600080600319360112610885576119db9061197d7f0000000000000000000000000000000000000000000000000000000000000000615ad8565b906119a77f0000000000000000000000000000000000000000000000000000000000000000615bea565b90604051916119b58361114d565b8183526119e9602091604051968796600f60f81b885260e08589015260e0880190610770565b908682036040880152610770565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b828110611a2057505050500390f35b835185528695509381019392810192600101611a11565b346104f25760003660031901126104f257602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104f25760403660031901126104f257602061133e611a936104e1565b61ffff611a9e6104f7565b91166000526003835260406000209061ffff16600052602052604060002090565b346104f25760003660031901126104f25760206001600160a01b0360005416604051908152f35b346104f25760203660031901126104f25760043565ffffffffffff611b0a43615e8d565b16811015610e0f576014549060008260058111611be4575b50905b828210611b81578280611b495750602060005b6001600160e01b0360405191168152f35b6014600052602090611b7c907fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb01610d61565b611b38565b9091611b8d8184615ca7565b6014600052908263ffffffff611bc47fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610d94565b161115611bd45750915b90611b25565b9250611bdf90613f54565b611bce565b80610dce611bf492959395615cbc565b6014600052908263ffffffff611c2b7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610d94565b161115611c3b5750915b38611b22565b9250611c4690613f54565b611c35565b346104f25760003660031901126104f2576020611c6743615e8d565b65ffffffffffff60405191168152f35b346104f25760003660031901126104f25760206001600160a01b0360055416604051908152f35b346104f2576000806003193601126108855760405181600d54611cc081611613565b9081845260209260019182811690816000146108635750600114611cee57610806856107fa818903826111d9565b929450600d83527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb55b828410611d345750505081610806936107fa9282010193386107ea565b8054858501870152928501928101611d17565b346104f25760203660031901126104f2576001600160a01b03600435611d6c8161091d565b166000526013602052604060002080548015600014611d9357505060405160008152602090f35b602091611da4916000190190614e5e565b5054811c611b38565b346104f257602060ff611dec61ffff61131c84611dc93661125d565b94909116600052600882526040600020826040519483868095519384920161074d565b54166040519015158152f35b346104f2576020806003193601126104f257611e359061ffff611e196104e1565b16600052600281526040611e3c8160002082519485809261164d565b03846111d9565b825115611ee55782516013199384820190828211610cb857611e6882611e6181613f46565b1015614343565b611e75828251101561438f565b81611e9857505050610806925080519160008352820181525b5191829182610795565b839594955194601f8316801560051b91828289010195860101920101905b808410611ed45750508352601f01601f191681526108069250611e8e565b815184529286019290860190611eb6565b600490517f6897706a000000000000000000000000000000000000000000000000000000008152fd5b346104f25760403660031901126104f257600435611f2b8161091d565b6024359033600052600a602052611f59816040600020906001600160a01b0316600052602052604060002090565b5491808310611f6e5761095892039033614d15565b60046040517f9703dd42000000000000000000000000000000000000000000000000000000008152fd5b346104f25760e03660031901126104f257611fb16104e1565b67ffffffffffffffff906064358281116104f257611fd3903690600401610508565b60849291923584811681036104f25760a43591611fef83610a7c565b60c4359586116104f25761200a61201a963690600401610508565b95909460443590602435906136d1565b60408051928352602083019190915290f35b346104f25761203a36610e39565b9190612044614567565b60405191602084838286013761206f6034858781013060601b858201520360148101875201856111d9565b60009361ffff8316855260028252604085209181519167ffffffffffffffff831161112c576120a8836120a28654611613565b866134bc565b81601f841160011461211f57508287989361210e95936120ff937f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a92612114575b50508160011b916000199060031b1c19161790565b90555b604051938493846134a1565b0390a180f35b0151905038806120ea565b9190601f19841661213586600052602060002090565b9389905b82821061219d5750509260019285927f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a9b9661210e989610612184575b505050811b019055612102565b015160001960f88460031b161c19169055388080612177565b80600186978294978701518155019601940190612139565b346104f25760403660031901126104f2576109586004356121d58161091d565b60243590336145a5565b346104f25760203660031901126104f2576106376004356121ff8161091d565b612207614567565b613319565b346104f25760403660031901126104f2576004356122298161091d565b612231614567565b6001600160a01b03906122f760009280845416848060405193602096878601947fa9059cbb000000000000000000000000000000000000000000000000000000008652602487015260243560448701526044865261228e86611169565b16926040519461229d86611131565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af13d15612341573d916122dc8361120a565b926122ea60405194856111d9565b83523d878785013e61572e565b908151918215159182612321575b505090506123105780f35b60405162a4546b60e21b8152600490fd5b6123359250806123399483010191016132f8565b1590565b803880612305565b60609161572e565b346104f25760003660031901126104f25760206001600160a01b0360015416604051908152f35b346104f25760203660031901126104f2577f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b60206001600160a01b036004356123b88161091d565b6123c0614567565b16806001600160a01b03196005541617600555604051908152a1005b6064359060ff821682036104f257565b6084359060ff821682036104f257565b346104f25760c03660031901126104f2576004356124198161091d565b602435906044356124286123dc565b908042116124fe5761249f916040519060208201927fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf84526001600160a01b038616604084015286606084015260808301526080825261248782611185565b61249a60a4359360843593519020615ab2565b6157bf565b916124c6836001600160a01b03166000526010602052604060002090815491600183019055565b036124d45761063791615170565b60046040517f713f9ea1000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd52e1db5000000000000000000000000000000000000000000000000000000008152fd5b346104f25760003660031901126104f25760206040516127108152f35b346104f25760803660031901126104f25761255e6104e1565b6125666104f7565b60643567ffffffffffffffff81116104f257612586903690600401610508565b9092612590614567565b6001600160a01b036001541690813b156104f25760008094612602604051978896879586947fcbed8b9c00000000000000000000000000000000000000000000000000000000865261ffff80921660048701521660248501526044356044850152608060648501526084840191613480565b03925af180156109145761261257005b8061261f61063792611118565b80610742565b61262e36610536565b90612671836126586126518997989961ffff166000526006602052604060002090565b888a613685565b9067ffffffffffffffff16600052602052604060002090565b549182156106395782612685368385611226565b602081519101200361273b577fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e59661ffff9661271061272a938761270967ffffffffffffffff9760006126f5846126588f6126ee9061ffff166000526006602052604060002090565b8a8c613685565b55612701368789611226565b933691611226565b918a6138e2565b604051978897168752608060208801526080870191613480565b9216604084015260608301520390a1005b60046040517f1bcbd8e4000000000000000000000000000000000000000000000000000000008152fd5b346104f25760e03660031901126104f2576004356127828161091d565b60243561278e8161091d565b6044359060643561279d6123ec565b9080421161287e576128456127ce866001600160a01b03166000526010602052604060002090815491600183019055565b9260405160208101917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983526001600160a01b0394858a1696876040850152868916606085015289608085015260a084015260c083015260c08252612832826111a1565b61249a60c4359360a43593519020615ab2565b16036128545761063792614d15565b60046040517f822a64c8000000000000000000000000000000000000000000000000000000008152fd5b60046040517fc77deac2000000000000000000000000000000000000000000000000000000008152fd5b346104f25760403660031901126104f257602061133e6004356128ca8161091d565b6001600160a01b03602435916128df8361091d565b16600052600a83526040600020906001600160a01b0316600052602052604060002090565b346104f25760603660031901126104f25761291d6104e1565b6129256104f7565b9060443591612932614567565b821561299f577f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09260609261ffff809116928360005260036020528261298a8260406000209061ffff16600052602052604060002090565b556040519384521660208301526040820152a1005b60046040517f73157870000000000000000000000000000000000000000000000000000000008152fd5b346104f2576101403660031901126104f2576004356129e78161091d565b602435906129f48261091d565b60443591612a018361091d565b60643592612a0e8461091d565b60e43590612a1b82610a7c565b6101043592612a2984610a7c565b6101243594612a3786610a7c565b60ff60155460d81c16612a615761063796612a50614567565b60c4359360a4359360843593612f5c565b60405162dc149f60e41b8152600490fd5b346104f25760003660031901126104f257602060405160018152f35b346104f25760603660031901126104f257610637604435612aae81610a7c565b612ab6614567565b6024356004356130c9565b346104f25760203660031901126104f2577f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a46020600435612b0181610a7c565b612b09614567565b151560ff196007541660ff821617600755604051908152a1005b346104f2576101003660031901126104f257612b3d6104e1565b67ffffffffffffffff906024358281116104f257612b5f903690600401610508565b91906044359084821682036104f257608435612b7a8161091d565b60c4359586116104f257612b95610637963690600401610508565b94909360e4359660a4359460643593613766565b346104f257612bb736610e39565b9190612bc1614567565b60009161ffff81168352602060028152604084209067ffffffffffffffff861161112c57612bf986612bf38454611613565b846134bc565b8490601f8711600114612c5a57509461210e916120ff828088997ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab9991612c4f575b508160011b916000199060031b1c19161790565b905087013538612c3b565b90601f198716612c6f84600052602060002090565b9287905b828210612cd65750509161210e9391887ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab98999410612cbc575b5050600182811b019055612102565b860135600019600385901b60f8161c191690553880612cad565b80600185968294968b01358155019501930190612c73565b346104f25760003660031901126104f257602060ff600754166040519015158152f35b346104f25760403660031901126104f257600435612d2e8161091d565b63ffffffff60243581811681036104f2576020612d85612d7f6001600160e01b03936001600160a01b036040976000868a51612d6981611131565b8281520152166000526013845286600020614e5e565b50614e8c565b84519381511684520151166020820152f35b346104f25760203660031901126104f257600435612db48161091d565b612dbc614567565b6001600160a01b038091168015612e09576000918254826001600160a01b03198216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60046040517f7448fbae000000000000000000000000000000000000000000000000000000008152fd5b346104f25760803660031901126104f257612e4c6104e1565b6000612e566104f7565b91612e6260443561091d565b60846001600160a01b03600154169360405194859384927ff5ecbdbc00000000000000000000000000000000000000000000000000000000845261ffff809216600485015216602483015230604483015260643560648301525afa80156109145761080691600091612edc575b5060405191829182610795565b612ef7913d8091833e612eef81836111d9565b810190613421565b38612ecf565b346104f25760203660031901126104f2576001600160a01b03600435612f228161091d565b612f2a614567565b166001600160a01b03196019541617601955600080f35b346104f25760003660031901126104f2576020604051308152f35b9596919397986118ce612f9492949a611939856001600160a01b039b8c9a8b6001600160a01b03199d168d60015416176001556130c9565b613059575b5016906019541617601955612fef7b010000000000000000000000000000000000000000000000000000007fffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffff6015541617601555565b8216612ff9575050565b60014614158061304d575b80613041575b6130175761120891614eae565b60046040517f606ab29e000000000000000000000000000000000000000000000000000000008152fd5b50617a6946141561300a565b50610539461415613004565b61306290613319565b38612f99565b8161307291614ff8565b6001600160e01b03600b541161308f5761308b906154ce565b5050565b60405162b2ad6d60e71b8152600490fd5b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715610cb857565b600a8102818104600a1482151715610cb8576127108091119081156131ea575b506131c0576015805478ff00000000000000000000000000000000000000000000000094151560c081901b959095167fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff90911675ffff000000000000000000000000000000000000000060a085901b161777ffff0000000000000000000000000000000000000000000060b086901b1617179055604080519182526020820192909252908101919091527f7294b4c7617e41cb925ae9440310fb23923aff0612102e0dbc68dab1b5b86c659080606081015b0390a1565b60046040517f0421d1aa000000000000000000000000000000000000000000000000000000008152fd5b9050600a8302838104600a1484151715610cb85711386130e9565b60207f12dcaec55ae8add66312d9a3feb1c94658903c007d895c262ce36355111ed1589115156015547fffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffff79ff000000000000000000000000000000000000000000000000008360c81b16911617601555604051908152a1565b60207f4afb66c9bb6da7f9e6cbb478337238477302fef1901949e5cbc037b2db7cd3429115156015547fffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffff7aff00000000000000000000000000000000000000000000000000008360d01b16911617601555604051908152a1565b908160209103126104f257516107a681610a7c565b6040513d6000823e3d90fd5b803b1580156133b0575b613386576131bb8161336c7f063dfd21e2b799ca4cb66556e57c360c6abc46f21805029c971f7475a96bd69a936001600160a01b03166001600160a01b03196015541617601555565b6040516001600160a01b0390911681529081906020820190565b60046040517f9dcd44a3000000000000000000000000000000000000000000000000000000008152fd5b506040516301ffc9a760e01b8152630d4d18e360e31b60048201526020816024816001600160a01b0386165afa908115610914576000916133f3575b5015613323565b613414915060203d811161341a575b61340c81836111d9565b8101906132f8565b386133ec565b503d613402565b6020818303126104f25780519067ffffffffffffffff82116104f2570181601f820112156104f25780516134548161120a565b9261346260405194856111d9565b818452602082840101116104f2576107a6916020808501910161074d565b908060209392818452848401376000828201840152601f01601f1916010190565b60409061ffff6107a695931681528160208201520191613480565b90601f81116134ca57505050565b600091825260208220906020601f850160051c83019410613506575b601f0160051c01915b8281106134fb57505050565b8181556001016134ef565b90925082906134e6565b605019810191908211610cb857565b91908203918211610cb857565b9290916135b85a604051907f66ad5c8a00000000000000000000000000000000000000000000000000000000602083015261ffff87166024830152608060448301526135b2826135a461358260a483018a610770565b67ffffffffffffffff8816606484015282810360231901608484015288610770565b03601f1981018452836111d9565b3061451c565b9390156135c6575050505050565b6135cf946135d9565b388080808061167b565b91936136777fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c956131bb939561ffff8151602083012096169586600052600660205261363d8361131c60208b6040600020826040519483868095519384920161074d565b5567ffffffffffffffff613663604051988998895260a060208a015260a0890190610770565b921660408701528582036060870152610770565b908382036080850152610770565b6020919283604051948593843782019081520301902090565b903590601e19813603018212156104f2570180359067ffffffffffffffff82116104f2576020019181360383136104f257565b94926136f76040986136ef6136fd93613704989d9c969d3691611226565b943691611226565b99613fa2565b9033614097565b6001600160a01b03600154169161373285519788958694859463040a7bb160e41b865230906004870161389d565b03915afa91821561091457600090819361374b57509190565b905061059a91925060403d8111610c5357610c4481836111d9565b9895939096979894919430330361385d5761ffff6001600160a01b039161378e8786306145a5565b1692169283837fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf6020604051898152a3833b156104f25761381e996000998a966138409467ffffffffffffffff6040519e8f9d8e9c8d9a7f7fcf35da000000000000000000000000000000000000000000000000000000008c5260048c015260c060248c015260c48b0191613480565b95166044880152606487015260848601528483036003190160a4860152613480565b0393f18015610914576138505750565b8061261f61120892611118565b60046040517fb9984ab5000000000000000000000000000000000000000000000000000000008152fd5b91908260409103126104f2576020825192015190565b91926001600160a01b036107a6969461ffff6138cd9416855216602084015260a0604084015260a0830190610770565b92151560608201526080818403910152610770565b92919060ff6138f0846144b7565b16806139ea5750505060ff613904826144b7565b16158015906139de575b6139b45761392461391e8261445f565b9161450c565b906001600160a01b03808216156139aa575b6139966139907fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf939467ffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000091166130b6565b84614320565b60405190815292169261ffff1691602090a3565b61dead9150613936565b60046040517fc20e59c6000000000000000000000000000000000000000000000000000000008152fd5b5060298151141561390e565b6001036139fa5761120893613c12565b60046040517fa0e89db1000000000000000000000000000000000000000000000000000000008152fd5b92613a496107a697959361ffff613a579416865260c0602087015260c0860190610770565b908482036040860152610770565b936001600160a01b03809216606084015216608082015260a0818403910152610770565b94611e3591939295613aaa613a9e8261ffff166000526002602052604060002090565b6040519485809261164d565b825115613b5857845161ffff82166000526004602052604060002054908115613b4e575b11613b2457613ae86105c96001546001600160a01b031690565b93843b156104f257600096613b1391604051998a988997889662c5803160e81b885260048801613a24565b03925af18015610914576138505750565b60046040517fbba53260000000000000000000000000000000000000000000000000000000008152fd5b6127109150613ace565b60046040517f7af198bf000000000000000000000000000000000000000000000000000000008152fd5b989796929394613be19567ffffffffffffffff613bbd60e099956001600160a01b03958e61ffff610100921681528160208201520190610770565b961660408c015260608b015216608089015260a088015286820360c0880152610770565b930152565b67ffffffffffffffff613c0760409396959496606084526060840190610770565b951660208201520152565b9091613c1d84614114565b9091613c4e613c4787612658613c418b61ffff166000526008602052604060002090565b8c6112b9565b5460ff1690565b91613c8567ffffffffffffffff92837f000000000000000000000000000000000000000000000000000000000000000091166130b6565b9288888b8315613d9a575b505050853b15613d4f5794613cf096946135b2948a946135a4948d99600014613d485750505a925b5a978b6040519a8b987feaffd49a0000000000000000000000000000000000000000000000000000000060208b015260248a01613b82565b9015613d3d575090613d3861ffff928560207fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd88496975191012090604051948594169684613be6565b0390a2565b9261120894926135d9565b1692613cb8565b50506040516001600160a01b039094168452507f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9750919550859450506020840192506131bb915050565b90612658613dcf92613dc989613db4613ddc979b30613068565b9961ffff166000526008602052604060002090565b906112b9565b805460ff19166001179055565b88888b613c90565b9160ff60075416600014613eba576022825110613e905761ffff6022613e2e93015193166000526003602052613e2860406000206001600052602052604060002090565b54613f70565b908115613e665710613e3c57565b60046040517f918e5cfa000000000000000000000000000000000000000000000000000000008152fd5b60046040517ff39d7eda000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6db89b3e000000000000000000000000000000000000000000000000000000008152fd5b50905051613ec457565b60046040517f1beaad3f000000000000000000000000000000000000000000000000000000008152fd5b9060ff60075416600014613f3d576022815110613e9057602261ffff91015191166000526003602052613f2e604060002060008052602052604060002090565b54908115613e665710613e3c57565b905051613ec457565b90601f8201809211610cb857565b9060018201809211610cb857565b6051019081605111610cb857565b91908201809211610cb857565b634e487b7160e01b600052601260045260246000fd5b8115613f9d570490565b613f7d565b7f0000000000000000000000000000000000000000000000000000000000000000908115613f9d570467ffffffffffffffff90818111613fe0571690565b60046040517f70049130000000000000000000000000000000000000000000000000000000008152fd5b7f00000000000000000000000000000000000000000000000000000000000000008015613f9d57810690818103908111610cb85791565b9077ffffffffffffffffffffffffffffffffffffffffffffffff19906040519260006020850152602184015260c01b166041820152602981526060810181811067ffffffffffffffff82111761112c5760405290565b93926071926107a6946001600160a01b03604051978895600160f81b6020880152602187015277ffffffffffffffffffffffffffffffffffffffffffffffff19809460c01b16604187015216604985015260c01b166069830152614104815180926020868601910161074d565b81010360518101845201826111d9565b90600160ff614122846144b7565b16036139b4576141318261445f565b9061413b8361450c565b9060498451106141b55760498401519360518151106141705761416d6051820151916141678151613510565b906143db565b91565b60405162461bcd60e51b815260206004820152601460248201527f746f55696e7436345f6f75744f66426f756e64730000000000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601560248201527f746f427974657333325f6f75744f66426f756e647300000000000000000000006044820152606490fd5b6001600160a01b03811690338203614310575b81156142c157600081816142b3946142268780966146ea565b84614244846001600160a01b03166000526009602052604060002090565b54614251828210156150e5565b0361426f846001600160a01b03166000526009602052604060002090565b5561427d85600b5403600b55565b6040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081015b0390a3614b3e565b6142bc816155fe565b505090565b60405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b61431b833383614dde565b61420d565b8161432a91614ff8565b6001600160e01b03600b541161308f576142bc816154ce565b1561434a57565b60405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606490fd5b1561439657565b60405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152606490fd5b6143e882611e6181613f46565b6143fd81516143f684613f62565b111561438f565b81614415575050604051600081526020810160405290565b60405191601f8116916051831560051b80858701019484860193010101905b80841061444c5750508252601f01601f191660405290565b9092835181526020809101930190614434565b602181511061447257602d015160601c90565b60405162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e647300000000000000000000006044820152606490fd5b60018151106144c7576001015190565b60405162461bcd60e51b815260206004820152601360248201527f746f55696e74385f6f75744f66426f756e6473000000000000000000000000006044820152606490fd5b6029815110614170576029015190565b9092916000809160405195614530876111bd565b6096875282602088019560a036883760208451940192f1903d906096821161455e575b6000908286523e9190565b60969150614553565b6001600160a01b0360005416330361457b57565b60046040517f5fc483c5000000000000000000000000000000000000000000000000000000008152fd5b91906001600160a01b03928381169384156146c05782168015614696576145cd848484614778565b6145ea826001600160a01b03166000526009602052604060002090565b549484861061466c57846112089603614616846001600160a01b03166000526009602052604060002090565b55614634846001600160a01b03166000526009602052604060002090565b8054860190556040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081016142ab565b60046040517fd01849fe000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0359c55e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f27903dcf000000000000000000000000000000000000000000000000000000008152fd5b6015549160ff8360c81c16614705575b50611208915061498f565b6001600160a01b03908160195416803b156104f25760009283608492600260ff604051998a978896632163733b60e21b88528b166004880152856024880152604487015260e01c161460648401525af19182156109145761120892156146fa578061261f61477292611118565b386146fa565b6015549260ff8460c81c16614793575b506112089250614a85565b6001600160a01b03908160195416803b156104f25760009283608492600260ff6040519a8b978896632163733b60e21b8852808c1660048901528c166024880152604487015260e01c161460648401525af1928315610914576112089315614788578061261f61480292611118565b38614788565b6015549060ff8260d01c1680614957575b61493a5760ff8260c01c169182614929575b5081614901575b50806148c6575b61483f57565b614857600160e11b60ff60e01b196015541617601555565b61486f6105c96105c96015546001600160a01b031690565b803b156104f25760008091600460405180948193630d4d18e360e31b83525af18015610914576148b3575b50611208600160e01b60ff60e01b196015541617601555565b8061261f6148c092611118565b3861489a565b506000805260176020526148fc6123357fd840e16649f6b9a295d95876f4633d3a6b10b55e8162971cf78afd886d5ec89b613c47565b614839565b6149239150613c47906001600160a01b03166000526016602052604060002090565b38614832565b60e01c60ff1660011491503861482b565b604051635504bc0760e01b815260006004820152602490fd5b0390fd5b5060008052601860205261498a7f999d26de3473317ead3eeaf34ca78057f1439db67b6953469c3c96ce9caf6bd7613c47565b614819565b6015549060ff8260d01c1680614a5f575b614a3c5760ff8260c01c169182614a2b575b50816149f1575b816149c6575b5061483f57565b6149eb9150613c47612335916001600160a01b03166000526017602052604060002090565b386149bf565b6000805260166020529050614a257f0263c2b778d062355049effc2dece97bc6547ff8a88a3258daa512061c2153dd613c47565b906149b9565b60e01c60ff166001149150386149b2565b604051635504bc0760e01b81526001600160a01b03919091166004820152602490fd5b50614a80613c47826001600160a01b03166000526018602052604060002090565b6149a0565b6015549160ff8360d01c1680614b18575b614af75760ff8360c01c169283614ae6575b5082614abc575b50816149c6575061483f57565b614adf919250613c47906001600160a01b03166000526016602052604060002090565b9038614aaf565b60e01c60ff16600114925038614aa8565b604051635504bc0760e01b81526001600160a01b0383166004820152602490fd5b50614b39613c47836001600160a01b03166000526018602052604060002090565b614a96565b91614b4a81838561513c565b6015549260ff8460c01c1680614cf4575b614b66575b50505050565b614b86613c47826001600160a01b03166000526016602052604060002090565b80614ccb575b15614c085750614be79250614bbb90614bb6614baf60155461ffff9060a01c1690565b61ffff1690565b614d04565b90614bd4600160e11b60ff60e01b196015541617601555565b6015546001600160a01b03165b906145a5565b614bff600160e01b60ff60e01b196015541617601555565b38808080614b60565b614c28613c47846001600160a01b03166000526016602052604060002090565b9081614ca0575b50614c3d575b505050614bff565b614c556127109161ffff614c809560b01c16906130b6565b0490614c6f600160e11b60ff60e01b196015541617601555565b6000546001600160a01b0316614be1565b614c98600160e01b60ff60e01b196015541617601555565b388080614c35565b614cc59150613c47612335916001600160a01b03166000526017602052604060002090565b38614c2f565b50614cef612335613c47856001600160a01b03166000526017602052604060002090565b614b8c565b50600160ff8560e01c1614614b5b565b614d1190612710926130b6565b0490565b90916001600160a01b03809216918215614db4578316928315614d8a57817f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592614d8060209386600052600a85526040600020906001600160a01b0316600052602052604060002090565b55604051908152a3565b60046040517fd8aedff6000000000000000000000000000000000000000000000000000000008152fd5b60046040517fbec36d8f000000000000000000000000000000000000000000000000000000008152fd5b906001600160a01b038216600052600a602052614e12816040600020906001600160a01b0316600052602052604060002090565b549260018401614e225750505050565b808410614e3457614bff930391614d15565b60046040517fb9788773000000000000000000000000000000000000000000000000000000008152fd5b8054821015614e765760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b90604051614e9981611131565b602081935463ffffffff81168352811c910152565b6001600160a01b0390818116908115614fce5783916015549360ff8560c81c16614f4f575b506130729350614ee282614808565b614ef6614ef184600b54613f70565b600b55565b614f13826001600160a01b03166000526009602052604060002090565b8054840190556040518381526000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602090a36000614b3e565b90925060195416803b156104f257604051632163733b60e21b81526000600482018190526001600160a01b03841660248301526044820187905260e09590951c60ff166002146064820152939084908183816084810103925af19182156109145761307293859315614ed3578061261f614fc892611118565b38614ed3565b60046040517fd1bb5a3e000000000000000000000000000000000000000000000000000000008152fd5b906001600160a01b038216918215614fce576015549260ff8460c81c16615028575b6112089350614ee282614808565b61503d6105c96019546001600160a01b031690565b803b156104f257604051632163733b60e21b81526000600482018190526001600160a01b03851660248301526044820186905260e09690961c60ff166002146064820152949085908183816084810103925af193841561091457611208946150a6575b5061501a565b8061261f6150b392611118565b386150a0565b906001600160a01b03821680156142c15781600084816150e0946142268561308b996146ea565b6155fe565b156150ec57565b60405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608490fd5b9061120892916001600160a01b038091166000526012602052808060406000205416921660005260406000205416906151df565b611208916001600160a01b03809216600092818452601260205280604085205416809260096020527f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60408720549660126020526040812094871694856001600160a01b031982541617905580a45b91906001600160a01b03808216931683811415806153fa575b6152025750505050565b80615275575b5082615215575b80614b60565b7fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7249161525761525c926001600160a01b03166000526013602052604060002090565b615676565b60408051928352602083019190915290a238808061520f565b8060005260136020527fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72460406000208054801591826000146153d7576152b96111fb565b6000815260006020820152915b6152e96152dd60208501516001600160e01b031690565b6001600160e01b031690565b926152f48985615f87565b941590816153b4575b50156153525761532561533c9261531386615e0e565b92600019019060005260206000200190565b9063ffffffff82549181199060201b169116179055565b604080519182526020820192909252a238615208565b506153af9061537661537161536643615e8d565b65ffffffffffff1690565b615f0b565b906153aa61538386615e0e565b61539a61538e6111fb565b63ffffffff9095168552565b6001600160e01b03166020840152565b61546f565b61533c565b5163ffffffff16905063ffffffff6153ce61536643615e8d565b911614386152fd565b6153f46153ef60001984018360005260206000200190565b614e8c565b916152c6565b508215156151f8565b601454906801000000000000000082101561112c576001820180601455821015614e76576014600052805160209182015190911b63ffffffff191663ffffffff91909116177fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec90910155565b80546801000000000000000081101561112c5761549191600182018155614e5e565b6154b857815160209283015190921b63ffffffff191663ffffffff92909216919091179055565b634e487b7160e01b600052600060045260246000fd5b601454909181159182156155c9576154e46111fb565b60008152600060208201525b61551161550a6152dd60208401516001600160e01b031690565b9586615f94565b931590816155a6575b501561555b576112089061532561553085615e0e565b6014600052917fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb0190565b5061120861556e61537161536643615e8d565b6155a161557a85615e0e565b6155916155856111fb565b63ffffffff9094168452565b6001600160e01b03166020830152565b615403565b5163ffffffff16905063ffffffff6155c061536643615e8d565b9116143861551a565b60146000526155f97fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614e8c565b6154f0565b60145490918115918215615641576156146111fb565b60008152600060208201525b61551161563a6152dd60208401516001600160e01b031690565b9586615f87565b60146000526156717fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614e8c565b615620565b9091815491821592836000146157115761568e6111fb565b60008152600060208201525b6156bb6156b46152dd60208401516001600160e01b031690565b9687615f94565b941590816156ee575b50156156da576153256112089261531386615e0e565b506112089061537661537161536643615e8d565b5163ffffffff16905063ffffffff61570861536643615e8d565b911614386156c4565b6157296153ef60001983018460005260206000200190565b61569a565b919290156157905750815115615742575090565b3b1561574b5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156157a35750805190602001fd5b60405162461bcd60e51b81529081906149539060048301610795565b916107a693916157ce93615916565b9190916157f6565b600511156157e057565b634e487b7160e01b600052602160045260246000fd5b6157ff816157d6565b806158075750565b615810816157d6565b6001810361585d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b615866816157d6565b600281036158b35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b806158bf6003926157d6565b146158c657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831161598c5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156109145781516001600160a01b03811615615986579190565b50600190565b50505050600090600390565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016301480615a89575b156159f3577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a08152615a83816111bd565b51902090565b507f000000000000000000000000000000000000000000000000000000000000000046146159ca565b604290615abd615998565b906040519161190160f01b8352600283015260228201522090565b60ff8114615b2e5760ff811690601f8211615b045760405191615afa83611131565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600e54816000615b4183611613565b808352602093600190818116908115615bca5750600114615b6b575b50506107a6925003826111d9565b90939150600e6000527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd936000915b818310615bb25750506107a693508201013880615b5d565b85548784018501529485019486945091830191615b9a565b9150506107a694925060ff191682840152151560051b8201013880615b5d565b60ff8114615c0c5760ff811690601f8211615b045760405191615afa83611131565b50604051600f54816000615c1f83611613565b808352602093600190818116908115615bca5750600114615c485750506107a6925003826111d9565b90939150600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802936000915b818310615c8f5750506107a693508201013880615b5d565b85548784018501529485019486945091830191615c77565b90808216911860011c8101809111610cb85790565b8015615df65780615d8f615d88615d7e615d74615d6a615d60615d56615d4c60016107a69a6000908b60801c80615dea575b508060401c80615ddd575b508060201c80615dd0575b508060101c80615dc3575b508060081c80615db6575b508060041c80615da9575b508060021c80615d9c575b50821c615d95575b811c1b615d45818b613f93565b0160011c90565b615d45818a613f93565b615d458189613f93565b615d458188613f93565b615d458187613f93565b615d458186613f93565b615d458185613f93565b8092613f93565b90615dfc565b8101615d38565b6002915091019038615d30565b6004915091019038615d25565b6008915091019038615d1a565b6010915091019038615d0f565b6020915091019038615d04565b6040915091019038615cf9565b91505060809038615cee565b50600090565b9080821015615e09575090565b905090565b6001600160e01b0390818111615e22571690565b60405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f32342062697473000000000000000000000000000000000000000000000000006064820152608490fd5b65ffffffffffff90818111615ea0571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201527f38206269747300000000000000000000000000000000000000000000000000006064820152608490fd5b63ffffffff90818111615f1c571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f32206269747300000000000000000000000000000000000000000000000000006064820152608490fd5b908103908111610cb85790565b908101809111610cb8579056fea2646970667358221220ad8aa43a92bcd576362f8628a448b8e6178756dffd4abd69878d463233019fa864736f6c63430008150033
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80621d3567146104dc57806301ffc9a7146104d757806306fdde03146104d257806307e0db17146104cd578063095ea7b3146104c85780630df37483146104c357806310ddb137146104be57806318160ddd1461040a57806323b872dd146104b95780632518d450146104b4578063313ce567146104af5780633644e515146104aa578063365260b4146104a557806339509351146104a05780633a46b1a81461049b5780633d8b38f6146104965780633f1f4fa41461049157806342966c681461048c57806342d65a8d14610487578063447705151461047d5780634bf5d7e9146104825780634c42899a1461047d578063587cde1e146104785780635afde063146104735780635b8c41e61461046e5780635c19a95c1461046957806363cd3c691461046457806366ad5c8a1461045f578063695ef6bf1461045a5780636fcfff451461045557806370a0823114610450578063715018a61461044b5780637533d7881461044657806376203b481461044157806379cc67901461043c5780637c9242e8146104375780637ecebe001461043257806384761dbb1461042d57806384b0196e14610428578063857749b0146104235780638cfd8f5c1461041e5780638da5cb5b146104195780638e539e8c1461041457806391ddadf41461040f5780639358928b1461040a578063950c8a741461040557806395d89b41146104005780639ab24eb0146103fb5780639bdb9812146103f65780639f38369a146103f1578063a457c2d7146103ec578063a4c51df5146103e7578063a6c3d165146103e2578063a9059cbb146103dd578063ac8da3c4146103d8578063b29a8140146103d3578063b353aaa7146103ce578063baf3292d146103c9578063c3cda520146103c4578063c4461834146103bf578063cbed8b9c146103ba578063d1deba1f146103b5578063d505accf146103b0578063dd62ed3e146103ab578063df2a5b3b146103a6578063e5a001f3146103a1578063e6a20ae61461039c578063e9c80e6314610397578063eab45d9c14610392578063eaffd49a1461038d578063eb8d72b714610388578063ed629c5c14610383578063f1127ed81461037e578063f2fde38b14610379578063f5ecbdbc14610374578063f840edfd1461036f5763fc0c546a1461036a57600080fd5b612f41565b612efd565b612e33565b612d97565b612d11565b612cee565b612ba9565b612b23565b612ac1565b612a8e565b612a72565b6129c9565b612904565b6128a8565b612765565b612625565b612545565b612528565b6123fc565b612370565b612349565b61220c565b6121df565b6121b5565b61202c565b611f98565b611f0e565b611df8565b611dad565b611d47565b611c9e565b611c77565b610a1e565b611c4b565b611ae6565b611abf565b611a75565b611a37565b61193e565b611911565b6118d3565b6118a6565b611872565b611750565b6116fd565b6115b9565b61157b565b61152f565b611411565b6113d1565b61136d565b611347565b6112df565b61109e565b61105e565b610fa3565b610fbf565b610f22565b610f05565b610ed0565b610e74565b610cbd565b610c5a565b610b6b565b610b48565b610b2c565b610aab565b610a3c565b61099e565b610963565b61092e565b610888565b6107a9565b6106ba565b61059e565b6004359061ffff821682036104f257565b600080fd5b6024359061ffff821682036104f257565b9181601f840112156104f25782359167ffffffffffffffff83116104f257602083818601950101116104f257565b9060806003198301126104f25760043561ffff811681036104f2579167ffffffffffffffff906024358281116104f2578161057391600401610508565b9390939260443581811681036104f257926064359182116104f25761059a91600401610508565b9091565b346104f2576105ac36610536565b91929493906105d56105c96105c96001546001600160a01b031690565b6001600160a01b031690565b3303610690576105fb6105f68661ffff166000526002602052604060002090565b6116e2565b80519081881491821592610687575b508115610663575b506106395761062961063192610637973691611226565b923691611226565b9261352c565b005b60046040517f9c5f4e7a000000000000000000000000000000000000000000000000000000008152fd5b9050610670368885611226565b602081519101209060208151910120141538610612565b1591503861060a565b60046040517f4f7ad9c4000000000000000000000000000000000000000000000000000000008152fd5b346104f25760203660031901126104f2576004357fffffffff0000000000000000000000000000000000000000000000000000000081168091036104f257807f1f7ecdf70000000000000000000000000000000000000000000000000000000060209214908115610731575b506040519015158152f35b6301ffc9a760e01b91501438610726565b60009103126104f257565b60005b8381106107605750506000910152565b8181015183820152602001610750565b906020916107898151809281855285808601910161074d565b601f01601f1916010190565b9060206107a6928181520190610770565b90565b346104f2576000806003193601126108855760405181600c546107cb81611613565b908184526020926001918281169081600014610863575060011461080a575b610806856107fa818903826111d9565b60405191829182610795565b0390f35b929450600c83527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c75b8284106108505750505081610806936107fa9282010193386107ea565b8054858501870152928501928101610833565b60ff191686860152505050151560051b82010191506107fa81610806386107ea565b80fd5b346104f25760006020366003190112610885576108a36104e1565b6108ab614567565b816001600160a01b036001541691823b1561091957602461ffff918360405195869485937f07e0db170000000000000000000000000000000000000000000000000000000085521660048401525af1801561091457610908575080f35b61091190611118565b80f35b61330d565b5080fd5b6001600160a01b038116036104f257565b346104f25760403660031901126104f25761095860043561094e8161091d565b6024359033614d15565b602060405160018152f35b346104f25760403660031901126104f25761ffff61097f6104e1565b610987614567565b166000526004602052602435604060002055600080f35b346104f25760006020366003190112610885576109b96104e1565b6109c1614567565b816001600160a01b036001541691823b1561091957602461ffff918360405195869485937f10ddb1370000000000000000000000000000000000000000000000000000000085521660048401525af1801561091457610908575080f35b346104f25760003660031901126104f2576020600b54604051908152f35b346104f25760603660031901126104f257610958600435610a5c8161091d565b602435610a688161091d565b60443591610a77833383614dde565b6145a5565b801515036104f257565b60409060031901126104f257600435610a9e8161091d565b906024356107a681610a7c565b346104f2577ffd7f6d25e7487e01d60c54f215c3a81bb6f973034cb26cf98baa0355fcc05f19610ada36610a86565b90610ae3614567565b6001600160a01b0381166000526016602052610b0f8260406000209060ff801983541691151516179055565b604080516001600160a01b039290921682529115156020820152a1005b346104f25760003660031901126104f257602060405160128152f35b346104f25760003660031901126104f2576020610b63615998565b604051908152f35b346104f25760a03660031901126104f257610b846104e1565b606435610b9081610a7c565b6084359067ffffffffffffffff82116104f257610bbd610bb66040933690600401610508565b3691611226565b92610bd4610bcc604435613fa2565b602435614041565b6001600160a01b036001541691610c0285519687958694859463040a7bb160e41b865230906004870161389d565b03915afa908115610914576000908192610c29575b50604080519182526020820192909252f35b9050610c4c915060403d8111610c53575b610c4481836111d9565b810190613887565b9038610c17565b503d610c3a565b346104f25760403660031901126104f257600435610c778161091d565b33600052600a602052610ca1816040600020906001600160a01b0316600052602052604060002090565b546024358101809111610cb8576109589133614d15565b6130a0565b346104f25760403660031901126104f257600435610cda8161091d565b6024359065ffffffffffff610cee43615e8d565b16821015610e0f576001600160a01b03166000526013602052604060002080549160008360058111610dbe575b50905b838210610d6d57505081610d455750506001600160e01b0360005b60405191168152602090f35b6000908152602090206001600160e01b0391610d689101600019015b5460201c90565b610d39565b9092610d798185615ca7565b908263ffffffff610d9e610d94858860005260206000200190565b5463ffffffff1690565b161115610dae5750925b90610d1e565b9350610db990613f54565b610da8565b80610dce610dd492969396615cbc565b9061351f565b908263ffffffff610def610d94858860005260206000200190565b161115610dff5750925b38610d1b565b9350610e0a90613f54565b610df9565b60046040517fb95f42c3000000000000000000000000000000000000000000000000000000008152fd5b9060406003198301126104f25760043561ffff811681036104f257916024359067ffffffffffffffff82116104f25761059a91600401610508565b346104f257602061ffff610ec1610e8a36610e39565b9390911660005260028452610eac610eb360406000206040519283809261164d565b03826111d9565b848151910120923691611226565b82815191012014604051908152f35b346104f25760203660031901126104f25761ffff610eec6104e1565b1660005260046020526020604060002054604051908152f35b346104f25760203660031901126104f257610637600435336150b9565b346104f2576001600160a01b03610f3836610e39565b610f40614567565b6001549160009485931690813b15610f9f5783610f8d95604051968795869485937f42d65a8d000000000000000000000000000000000000000000000000000000008552600485016134a1565b03925af1801561091457610908575080f35b8380fd5b346104f25760003660031901126104f257602060405160008152f35b346104f25760003660031901126104f2574365ffffffffffff610fe143615e8d565b160361103457610806604051610ff681611131565b601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c740000006020820152604051918291602083526020830190610770565b60046040517fd50637bf000000000000000000000000000000000000000000000000000000008152fd5b346104f25760203660031901126104f257602060043561107d8161091d565b6001600160a01b038091166000526012825260406000205416604051908152f35b346104f2577f8f3675e5a31b083483e5a782db4130316da1e3c5fca72fc2398f59692286d8a56110cd36610a86565b906110d6614567565b6001600160a01b0381166000526017602052610b0f8260406000209060ff801983541691151516179055565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff811161112c57604052565b611102565b6040810190811067ffffffffffffffff82111761112c57604052565b6020810190811067ffffffffffffffff82111761112c57604052565b6080810190811067ffffffffffffffff82111761112c57604052565b60a0810190811067ffffffffffffffff82111761112c57604052565b60e0810190811067ffffffffffffffff82111761112c57604052565b60c0810190811067ffffffffffffffff82111761112c57604052565b90601f8019910116810190811067ffffffffffffffff82111761112c57604052565b6040519061120882611131565b565b67ffffffffffffffff811161112c57601f01601f191660200190565b9291926112328261120a565b9161124060405193846111d9565b8294818452818301116104f2578281602093846000960137010152565b60606003198201126104f25760043561ffff811681036104f2579160243567ffffffffffffffff928382116104f257806023830112156104f2578160246112a993600401359101611226565b9160443590811681036104f25790565b6020906112d392826040519483868095519384920161074d565b82019081520301902090565b346104f257602061133e61ffff61131c836112f93661125d565b94909116600052600682526040600020826040519483868095519384920161074d565b8201908152030190209067ffffffffffffffff16600052602052604060002090565b54604051908152f35b346104f25760203660031901126104f2576106376004356113678161091d565b33615170565b346104f2577f271a6c83d2d471fc3b7e0785e77e48c25259853378b45972025bdfa21af522f361139c36610a86565b906113a5614567565b6001600160a01b0381166000526018602052610b0f8260406000209060ff801983541691151516179055565b346104f2576113df36610536565b9192949390303303610690576106296113fd92610637973691611226565b926138e2565b908160609103126104f25790565b60a03660031901126104f2576004356114298161091d565b6114316104f7565b6044359160843567ffffffffffffffff81116104f257611455903690600401611403565b908135916114628361091d565b611481610bb66020830135926114778461091d565b604081019061369e565b9261148c8486613eee565b6114a161149a60643561400a565b50846141fa565b938415611505577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a936114f861ffff936001600160a01b03936020966114ef6114e98b613fa2565b8d614041565b9234938c613a7b565b60405195865216941692a4005b60046040517fca69cd3c000000000000000000000000000000000000000000000000000000008152fd5b346104f25760203660031901126104f2576001600160a01b036004356115548161091d565b166000526013602052602061156d604060002054615f0b565b63ffffffff60405191168152f35b346104f25760203660031901126104f2576001600160a01b036004356115a08161091d565b1660005260096020526020604060002054604051908152f35b346104f257600080600319360112610885576115d3614567565b806001600160a01b0381546001600160a01b031981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90600182811c92168015611643575b602083101461162d57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611622565b80546000939261165c82611613565b9182825260209360019182811690816000146116c35750600114611682575b5050505050565b90939495506000929192528360002092846000945b8386106116af5750505050010190388080808061167b565b805485870183015294019385908201611697565b60ff19168685015250505090151560051b01019150388080808061167b565b906112086116f6926040519384809261164d565b03836111d9565b346104f25760203660031901126104f25761ffff6117196104e1565b166000526002602052610806610eac61173c60406000206040519283809261164d565b604051918291602083526020830190610770565b60e03660031901126104f2576004356117688161091d565b6117706104f7565b6044359167ffffffffffffffff906084358281116104f257611796903690600401610508565b9160a435848116948582036104f25760c4359081116104f2576117bd903690600401611403565b936117ff6117f78635926117d08461091d565b6117ef6117e560208a0135996114778b61091d565b9890923691611226565b963691611226565b968789613de4565b61180d61149a60643561400a565b958615611505577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a9561185661185f946001600160a01b039761184f8b613fa2565b8d33614097565b9234938a613a7b565b604051938452169261ffff1691602090a4005b346104f25760403660031901126104f2576106376004356118928161091d565b602435906118a1823383614dde565b6150b9565b346104f25760203660031901126104f2576106376004356118c681610a7c565b6118ce614567565b61327e565b346104f25760203660031901126104f2576001600160a01b036004356118f88161091d565b1660005260106020526020604060002054604051908152f35b346104f25760203660031901126104f25761063760043561193181610a7c565b611939614567565b613205565b346104f257600080600319360112610885576119db9061197d7f42454e0000000000000000000000000000000000000000000000000000000003615ad8565b906119a77f3100000000000000000000000000000000000000000000000000000000000001615bea565b90604051916119b58361114d565b8183526119e9602091604051968796600f60f81b885260e08589015260e0880190610770565b908682036040880152610770565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b828110611a2057505050500390f35b835185528695509381019392810192600101611a11565b346104f25760003660031901126104f257602060405160ff7f0000000000000000000000000000000000000000000000000000000000000008168152f35b346104f25760403660031901126104f257602061133e611a936104e1565b61ffff611a9e6104f7565b91166000526003835260406000209061ffff16600052602052604060002090565b346104f25760003660031901126104f25760206001600160a01b0360005416604051908152f35b346104f25760203660031901126104f25760043565ffffffffffff611b0a43615e8d565b16811015610e0f576014549060008260058111611be4575b50905b828210611b81578280611b495750602060005b6001600160e01b0360405191168152f35b6014600052602090611b7c907fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb01610d61565b611b38565b9091611b8d8184615ca7565b6014600052908263ffffffff611bc47fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610d94565b161115611bd45750915b90611b25565b9250611bdf90613f54565b611bce565b80610dce611bf492959395615cbc565b6014600052908263ffffffff611c2b7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610d94565b161115611c3b5750915b38611b22565b9250611c4690613f54565b611c35565b346104f25760003660031901126104f2576020611c6743615e8d565b65ffffffffffff60405191168152f35b346104f25760003660031901126104f25760206001600160a01b0360055416604051908152f35b346104f2576000806003193601126108855760405181600d54611cc081611613565b9081845260209260019182811690816000146108635750600114611cee57610806856107fa818903826111d9565b929450600d83527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb55b828410611d345750505081610806936107fa9282010193386107ea565b8054858501870152928501928101611d17565b346104f25760203660031901126104f2576001600160a01b03600435611d6c8161091d565b166000526013602052604060002080548015600014611d9357505060405160008152602090f35b602091611da4916000190190614e5e565b5054811c611b38565b346104f257602060ff611dec61ffff61131c84611dc93661125d565b94909116600052600882526040600020826040519483868095519384920161074d565b54166040519015158152f35b346104f2576020806003193601126104f257611e359061ffff611e196104e1565b16600052600281526040611e3c8160002082519485809261164d565b03846111d9565b825115611ee55782516013199384820190828211610cb857611e6882611e6181613f46565b1015614343565b611e75828251101561438f565b81611e9857505050610806925080519160008352820181525b5191829182610795565b839594955194601f8316801560051b91828289010195860101920101905b808410611ed45750508352601f01601f191681526108069250611e8e565b815184529286019290860190611eb6565b600490517f6897706a000000000000000000000000000000000000000000000000000000008152fd5b346104f25760403660031901126104f257600435611f2b8161091d565b6024359033600052600a602052611f59816040600020906001600160a01b0316600052602052604060002090565b5491808310611f6e5761095892039033614d15565b60046040517f9703dd42000000000000000000000000000000000000000000000000000000008152fd5b346104f25760e03660031901126104f257611fb16104e1565b67ffffffffffffffff906064358281116104f257611fd3903690600401610508565b60849291923584811681036104f25760a43591611fef83610a7c565b60c4359586116104f25761200a61201a963690600401610508565b95909460443590602435906136d1565b60408051928352602083019190915290f35b346104f25761203a36610e39565b9190612044614567565b60405191602084838286013761206f6034858781013060601b858201520360148101875201856111d9565b60009361ffff8316855260028252604085209181519167ffffffffffffffff831161112c576120a8836120a28654611613565b866134bc565b81601f841160011461211f57508287989361210e95936120ff937f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a92612114575b50508160011b916000199060031b1c19161790565b90555b604051938493846134a1565b0390a180f35b0151905038806120ea565b9190601f19841661213586600052602060002090565b9389905b82821061219d5750509260019285927f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a9b9661210e989610612184575b505050811b019055612102565b015160001960f88460031b161c19169055388080612177565b80600186978294978701518155019601940190612139565b346104f25760403660031901126104f2576109586004356121d58161091d565b60243590336145a5565b346104f25760203660031901126104f2576106376004356121ff8161091d565b612207614567565b613319565b346104f25760403660031901126104f2576004356122298161091d565b612231614567565b6001600160a01b03906122f760009280845416848060405193602096878601947fa9059cbb000000000000000000000000000000000000000000000000000000008652602487015260243560448701526044865261228e86611169565b16926040519461229d86611131565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af13d15612341573d916122dc8361120a565b926122ea60405194856111d9565b83523d878785013e61572e565b908151918215159182612321575b505090506123105780f35b60405162a4546b60e21b8152600490fd5b6123359250806123399483010191016132f8565b1590565b803880612305565b60609161572e565b346104f25760003660031901126104f25760206001600160a01b0360015416604051908152f35b346104f25760203660031901126104f2577f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b60206001600160a01b036004356123b88161091d565b6123c0614567565b16806001600160a01b03196005541617600555604051908152a1005b6064359060ff821682036104f257565b6084359060ff821682036104f257565b346104f25760c03660031901126104f2576004356124198161091d565b602435906044356124286123dc565b908042116124fe5761249f916040519060208201927fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf84526001600160a01b038616604084015286606084015260808301526080825261248782611185565b61249a60a4359360843593519020615ab2565b6157bf565b916124c6836001600160a01b03166000526010602052604060002090815491600183019055565b036124d45761063791615170565b60046040517f713f9ea1000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd52e1db5000000000000000000000000000000000000000000000000000000008152fd5b346104f25760003660031901126104f25760206040516127108152f35b346104f25760803660031901126104f25761255e6104e1565b6125666104f7565b60643567ffffffffffffffff81116104f257612586903690600401610508565b9092612590614567565b6001600160a01b036001541690813b156104f25760008094612602604051978896879586947fcbed8b9c00000000000000000000000000000000000000000000000000000000865261ffff80921660048701521660248501526044356044850152608060648501526084840191613480565b03925af180156109145761261257005b8061261f61063792611118565b80610742565b61262e36610536565b90612671836126586126518997989961ffff166000526006602052604060002090565b888a613685565b9067ffffffffffffffff16600052602052604060002090565b549182156106395782612685368385611226565b602081519101200361273b577fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e59661ffff9661271061272a938761270967ffffffffffffffff9760006126f5846126588f6126ee9061ffff166000526006602052604060002090565b8a8c613685565b55612701368789611226565b933691611226565b918a6138e2565b604051978897168752608060208801526080870191613480565b9216604084015260608301520390a1005b60046040517f1bcbd8e4000000000000000000000000000000000000000000000000000000008152fd5b346104f25760e03660031901126104f2576004356127828161091d565b60243561278e8161091d565b6044359060643561279d6123ec565b9080421161287e576128456127ce866001600160a01b03166000526010602052604060002090815491600183019055565b9260405160208101917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983526001600160a01b0394858a1696876040850152868916606085015289608085015260a084015260c083015260c08252612832826111a1565b61249a60c4359360a43593519020615ab2565b16036128545761063792614d15565b60046040517f822a64c8000000000000000000000000000000000000000000000000000000008152fd5b60046040517fc77deac2000000000000000000000000000000000000000000000000000000008152fd5b346104f25760403660031901126104f257602061133e6004356128ca8161091d565b6001600160a01b03602435916128df8361091d565b16600052600a83526040600020906001600160a01b0316600052602052604060002090565b346104f25760603660031901126104f25761291d6104e1565b6129256104f7565b9060443591612932614567565b821561299f577f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09260609261ffff809116928360005260036020528261298a8260406000209061ffff16600052602052604060002090565b556040519384521660208301526040820152a1005b60046040517f73157870000000000000000000000000000000000000000000000000000000008152fd5b346104f2576101403660031901126104f2576004356129e78161091d565b602435906129f48261091d565b60443591612a018361091d565b60643592612a0e8461091d565b60e43590612a1b82610a7c565b6101043592612a2984610a7c565b6101243594612a3786610a7c565b60ff60155460d81c16612a615761063796612a50614567565b60c4359360a4359360843593612f5c565b60405162dc149f60e41b8152600490fd5b346104f25760003660031901126104f257602060405160018152f35b346104f25760603660031901126104f257610637604435612aae81610a7c565b612ab6614567565b6024356004356130c9565b346104f25760203660031901126104f2577f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a46020600435612b0181610a7c565b612b09614567565b151560ff196007541660ff821617600755604051908152a1005b346104f2576101003660031901126104f257612b3d6104e1565b67ffffffffffffffff906024358281116104f257612b5f903690600401610508565b91906044359084821682036104f257608435612b7a8161091d565b60c4359586116104f257612b95610637963690600401610508565b94909360e4359660a4359460643593613766565b346104f257612bb736610e39565b9190612bc1614567565b60009161ffff81168352602060028152604084209067ffffffffffffffff861161112c57612bf986612bf38454611613565b846134bc565b8490601f8711600114612c5a57509461210e916120ff828088997ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab9991612c4f575b508160011b916000199060031b1c19161790565b905087013538612c3b565b90601f198716612c6f84600052602060002090565b9287905b828210612cd65750509161210e9391887ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab98999410612cbc575b5050600182811b019055612102565b860135600019600385901b60f8161c191690553880612cad565b80600185968294968b01358155019501930190612c73565b346104f25760003660031901126104f257602060ff600754166040519015158152f35b346104f25760403660031901126104f257600435612d2e8161091d565b63ffffffff60243581811681036104f2576020612d85612d7f6001600160e01b03936001600160a01b036040976000868a51612d6981611131565b8281520152166000526013845286600020614e5e565b50614e8c565b84519381511684520151166020820152f35b346104f25760203660031901126104f257600435612db48161091d565b612dbc614567565b6001600160a01b038091168015612e09576000918254826001600160a01b03198216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60046040517f7448fbae000000000000000000000000000000000000000000000000000000008152fd5b346104f25760803660031901126104f257612e4c6104e1565b6000612e566104f7565b91612e6260443561091d565b60846001600160a01b03600154169360405194859384927ff5ecbdbc00000000000000000000000000000000000000000000000000000000845261ffff809216600485015216602483015230604483015260643560648301525afa80156109145761080691600091612edc575b5060405191829182610795565b612ef7913d8091833e612eef81836111d9565b810190613421565b38612ecf565b346104f25760203660031901126104f2576001600160a01b03600435612f228161091d565b612f2a614567565b166001600160a01b03196019541617601955600080f35b346104f25760003660031901126104f2576020604051308152f35b9596919397986118ce612f9492949a611939856001600160a01b039b8c9a8b6001600160a01b03199d168d60015416176001556130c9565b613059575b5016906019541617601955612fef7b010000000000000000000000000000000000000000000000000000007fffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffff6015541617601555565b8216612ff9575050565b60014614158061304d575b80613041575b6130175761120891614eae565b60046040517f606ab29e000000000000000000000000000000000000000000000000000000008152fd5b50617a6946141561300a565b50610539461415613004565b61306290613319565b38612f99565b8161307291614ff8565b6001600160e01b03600b541161308f5761308b906154ce565b5050565b60405162b2ad6d60e71b8152600490fd5b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715610cb857565b600a8102818104600a1482151715610cb8576127108091119081156131ea575b506131c0576015805478ff00000000000000000000000000000000000000000000000094151560c081901b959095167fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff90911675ffff000000000000000000000000000000000000000060a085901b161777ffff0000000000000000000000000000000000000000000060b086901b1617179055604080519182526020820192909252908101919091527f7294b4c7617e41cb925ae9440310fb23923aff0612102e0dbc68dab1b5b86c659080606081015b0390a1565b60046040517f0421d1aa000000000000000000000000000000000000000000000000000000008152fd5b9050600a8302838104600a1484151715610cb85711386130e9565b60207f12dcaec55ae8add66312d9a3feb1c94658903c007d895c262ce36355111ed1589115156015547fffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffff79ff000000000000000000000000000000000000000000000000008360c81b16911617601555604051908152a1565b60207f4afb66c9bb6da7f9e6cbb478337238477302fef1901949e5cbc037b2db7cd3429115156015547fffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffff7aff00000000000000000000000000000000000000000000000000008360d01b16911617601555604051908152a1565b908160209103126104f257516107a681610a7c565b6040513d6000823e3d90fd5b803b1580156133b0575b613386576131bb8161336c7f063dfd21e2b799ca4cb66556e57c360c6abc46f21805029c971f7475a96bd69a936001600160a01b03166001600160a01b03196015541617601555565b6040516001600160a01b0390911681529081906020820190565b60046040517f9dcd44a3000000000000000000000000000000000000000000000000000000008152fd5b506040516301ffc9a760e01b8152630d4d18e360e31b60048201526020816024816001600160a01b0386165afa908115610914576000916133f3575b5015613323565b613414915060203d811161341a575b61340c81836111d9565b8101906132f8565b386133ec565b503d613402565b6020818303126104f25780519067ffffffffffffffff82116104f2570181601f820112156104f25780516134548161120a565b9261346260405194856111d9565b818452602082840101116104f2576107a6916020808501910161074d565b908060209392818452848401376000828201840152601f01601f1916010190565b60409061ffff6107a695931681528160208201520191613480565b90601f81116134ca57505050565b600091825260208220906020601f850160051c83019410613506575b601f0160051c01915b8281106134fb57505050565b8181556001016134ef565b90925082906134e6565b605019810191908211610cb857565b91908203918211610cb857565b9290916135b85a604051907f66ad5c8a00000000000000000000000000000000000000000000000000000000602083015261ffff87166024830152608060448301526135b2826135a461358260a483018a610770565b67ffffffffffffffff8816606484015282810360231901608484015288610770565b03601f1981018452836111d9565b3061451c565b9390156135c6575050505050565b6135cf946135d9565b388080808061167b565b91936136777fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c956131bb939561ffff8151602083012096169586600052600660205261363d8361131c60208b6040600020826040519483868095519384920161074d565b5567ffffffffffffffff613663604051988998895260a060208a015260a0890190610770565b921660408701528582036060870152610770565b908382036080850152610770565b6020919283604051948593843782019081520301902090565b903590601e19813603018212156104f2570180359067ffffffffffffffff82116104f2576020019181360383136104f257565b94926136f76040986136ef6136fd93613704989d9c969d3691611226565b943691611226565b99613fa2565b9033614097565b6001600160a01b03600154169161373285519788958694859463040a7bb160e41b865230906004870161389d565b03915afa91821561091457600090819361374b57509190565b905061059a91925060403d8111610c5357610c4481836111d9565b9895939096979894919430330361385d5761ffff6001600160a01b039161378e8786306145a5565b1692169283837fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf6020604051898152a3833b156104f25761381e996000998a966138409467ffffffffffffffff6040519e8f9d8e9c8d9a7f7fcf35da000000000000000000000000000000000000000000000000000000008c5260048c015260c060248c015260c48b0191613480565b95166044880152606487015260848601528483036003190160a4860152613480565b0393f18015610914576138505750565b8061261f61120892611118565b60046040517fb9984ab5000000000000000000000000000000000000000000000000000000008152fd5b91908260409103126104f2576020825192015190565b91926001600160a01b036107a6969461ffff6138cd9416855216602084015260a0604084015260a0830190610770565b92151560608201526080818403910152610770565b92919060ff6138f0846144b7565b16806139ea5750505060ff613904826144b7565b16158015906139de575b6139b45761392461391e8261445f565b9161450c565b906001600160a01b03808216156139aa575b6139966139907fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf939467ffffffffffffffff7f00000000000000000000000000000000000000000000000000000002540be40091166130b6565b84614320565b60405190815292169261ffff1691602090a3565b61dead9150613936565b60046040517fc20e59c6000000000000000000000000000000000000000000000000000000008152fd5b5060298151141561390e565b6001036139fa5761120893613c12565b60046040517fa0e89db1000000000000000000000000000000000000000000000000000000008152fd5b92613a496107a697959361ffff613a579416865260c0602087015260c0860190610770565b908482036040860152610770565b936001600160a01b03809216606084015216608082015260a0818403910152610770565b94611e3591939295613aaa613a9e8261ffff166000526002602052604060002090565b6040519485809261164d565b825115613b5857845161ffff82166000526004602052604060002054908115613b4e575b11613b2457613ae86105c96001546001600160a01b031690565b93843b156104f257600096613b1391604051998a988997889662c5803160e81b885260048801613a24565b03925af18015610914576138505750565b60046040517fbba53260000000000000000000000000000000000000000000000000000000008152fd5b6127109150613ace565b60046040517f7af198bf000000000000000000000000000000000000000000000000000000008152fd5b989796929394613be19567ffffffffffffffff613bbd60e099956001600160a01b03958e61ffff610100921681528160208201520190610770565b961660408c015260608b015216608089015260a088015286820360c0880152610770565b930152565b67ffffffffffffffff613c0760409396959496606084526060840190610770565b951660208201520152565b9091613c1d84614114565b9091613c4e613c4787612658613c418b61ffff166000526008602052604060002090565b8c6112b9565b5460ff1690565b91613c8567ffffffffffffffff92837f00000000000000000000000000000000000000000000000000000002540be40091166130b6565b9288888b8315613d9a575b505050853b15613d4f5794613cf096946135b2948a946135a4948d99600014613d485750505a925b5a978b6040519a8b987feaffd49a0000000000000000000000000000000000000000000000000000000060208b015260248a01613b82565b9015613d3d575090613d3861ffff928560207fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd88496975191012090604051948594169684613be6565b0390a2565b9261120894926135d9565b1692613cb8565b50506040516001600160a01b039094168452507f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9750919550859450506020840192506131bb915050565b90612658613dcf92613dc989613db4613ddc979b30613068565b9961ffff166000526008602052604060002090565b906112b9565b805460ff19166001179055565b88888b613c90565b9160ff60075416600014613eba576022825110613e905761ffff6022613e2e93015193166000526003602052613e2860406000206001600052602052604060002090565b54613f70565b908115613e665710613e3c57565b60046040517f918e5cfa000000000000000000000000000000000000000000000000000000008152fd5b60046040517ff39d7eda000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6db89b3e000000000000000000000000000000000000000000000000000000008152fd5b50905051613ec457565b60046040517f1beaad3f000000000000000000000000000000000000000000000000000000008152fd5b9060ff60075416600014613f3d576022815110613e9057602261ffff91015191166000526003602052613f2e604060002060008052602052604060002090565b54908115613e665710613e3c57565b905051613ec457565b90601f8201809211610cb857565b9060018201809211610cb857565b6051019081605111610cb857565b91908201809211610cb857565b634e487b7160e01b600052601260045260246000fd5b8115613f9d570490565b613f7d565b7f00000000000000000000000000000000000000000000000000000002540be400908115613f9d570467ffffffffffffffff90818111613fe0571690565b60046040517f70049130000000000000000000000000000000000000000000000000000000008152fd5b7f00000000000000000000000000000000000000000000000000000002540be4008015613f9d57810690818103908111610cb85791565b9077ffffffffffffffffffffffffffffffffffffffffffffffff19906040519260006020850152602184015260c01b166041820152602981526060810181811067ffffffffffffffff82111761112c5760405290565b93926071926107a6946001600160a01b03604051978895600160f81b6020880152602187015277ffffffffffffffffffffffffffffffffffffffffffffffff19809460c01b16604187015216604985015260c01b166069830152614104815180926020868601910161074d565b81010360518101845201826111d9565b90600160ff614122846144b7565b16036139b4576141318261445f565b9061413b8361450c565b9060498451106141b55760498401519360518151106141705761416d6051820151916141678151613510565b906143db565b91565b60405162461bcd60e51b815260206004820152601460248201527f746f55696e7436345f6f75744f66426f756e64730000000000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601560248201527f746f427974657333325f6f75744f66426f756e647300000000000000000000006044820152606490fd5b6001600160a01b03811690338203614310575b81156142c157600081816142b3946142268780966146ea565b84614244846001600160a01b03166000526009602052604060002090565b54614251828210156150e5565b0361426f846001600160a01b03166000526009602052604060002090565b5561427d85600b5403600b55565b6040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081015b0390a3614b3e565b6142bc816155fe565b505090565b60405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b61431b833383614dde565b61420d565b8161432a91614ff8565b6001600160e01b03600b541161308f576142bc816154ce565b1561434a57565b60405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606490fd5b1561439657565b60405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152606490fd5b6143e882611e6181613f46565b6143fd81516143f684613f62565b111561438f565b81614415575050604051600081526020810160405290565b60405191601f8116916051831560051b80858701019484860193010101905b80841061444c5750508252601f01601f191660405290565b9092835181526020809101930190614434565b602181511061447257602d015160601c90565b60405162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e647300000000000000000000006044820152606490fd5b60018151106144c7576001015190565b60405162461bcd60e51b815260206004820152601360248201527f746f55696e74385f6f75744f66426f756e6473000000000000000000000000006044820152606490fd5b6029815110614170576029015190565b9092916000809160405195614530876111bd565b6096875282602088019560a036883760208451940192f1903d906096821161455e575b6000908286523e9190565b60969150614553565b6001600160a01b0360005416330361457b57565b60046040517f5fc483c5000000000000000000000000000000000000000000000000000000008152fd5b91906001600160a01b03928381169384156146c05782168015614696576145cd848484614778565b6145ea826001600160a01b03166000526009602052604060002090565b549484861061466c57846112089603614616846001600160a01b03166000526009602052604060002090565b55614634846001600160a01b03166000526009602052604060002090565b8054860190556040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081016142ab565b60046040517fd01849fe000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0359c55e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f27903dcf000000000000000000000000000000000000000000000000000000008152fd5b6015549160ff8360c81c16614705575b50611208915061498f565b6001600160a01b03908160195416803b156104f25760009283608492600260ff604051998a978896632163733b60e21b88528b166004880152856024880152604487015260e01c161460648401525af19182156109145761120892156146fa578061261f61477292611118565b386146fa565b6015549260ff8460c81c16614793575b506112089250614a85565b6001600160a01b03908160195416803b156104f25760009283608492600260ff6040519a8b978896632163733b60e21b8852808c1660048901528c166024880152604487015260e01c161460648401525af1928315610914576112089315614788578061261f61480292611118565b38614788565b6015549060ff8260d01c1680614957575b61493a5760ff8260c01c169182614929575b5081614901575b50806148c6575b61483f57565b614857600160e11b60ff60e01b196015541617601555565b61486f6105c96105c96015546001600160a01b031690565b803b156104f25760008091600460405180948193630d4d18e360e31b83525af18015610914576148b3575b50611208600160e01b60ff60e01b196015541617601555565b8061261f6148c092611118565b3861489a565b506000805260176020526148fc6123357fd840e16649f6b9a295d95876f4633d3a6b10b55e8162971cf78afd886d5ec89b613c47565b614839565b6149239150613c47906001600160a01b03166000526016602052604060002090565b38614832565b60e01c60ff1660011491503861482b565b604051635504bc0760e01b815260006004820152602490fd5b0390fd5b5060008052601860205261498a7f999d26de3473317ead3eeaf34ca78057f1439db67b6953469c3c96ce9caf6bd7613c47565b614819565b6015549060ff8260d01c1680614a5f575b614a3c5760ff8260c01c169182614a2b575b50816149f1575b816149c6575b5061483f57565b6149eb9150613c47612335916001600160a01b03166000526017602052604060002090565b386149bf565b6000805260166020529050614a257f0263c2b778d062355049effc2dece97bc6547ff8a88a3258daa512061c2153dd613c47565b906149b9565b60e01c60ff166001149150386149b2565b604051635504bc0760e01b81526001600160a01b03919091166004820152602490fd5b50614a80613c47826001600160a01b03166000526018602052604060002090565b6149a0565b6015549160ff8360d01c1680614b18575b614af75760ff8360c01c169283614ae6575b5082614abc575b50816149c6575061483f57565b614adf919250613c47906001600160a01b03166000526016602052604060002090565b9038614aaf565b60e01c60ff16600114925038614aa8565b604051635504bc0760e01b81526001600160a01b0383166004820152602490fd5b50614b39613c47836001600160a01b03166000526018602052604060002090565b614a96565b91614b4a81838561513c565b6015549260ff8460c01c1680614cf4575b614b66575b50505050565b614b86613c47826001600160a01b03166000526016602052604060002090565b80614ccb575b15614c085750614be79250614bbb90614bb6614baf60155461ffff9060a01c1690565b61ffff1690565b614d04565b90614bd4600160e11b60ff60e01b196015541617601555565b6015546001600160a01b03165b906145a5565b614bff600160e01b60ff60e01b196015541617601555565b38808080614b60565b614c28613c47846001600160a01b03166000526016602052604060002090565b9081614ca0575b50614c3d575b505050614bff565b614c556127109161ffff614c809560b01c16906130b6565b0490614c6f600160e11b60ff60e01b196015541617601555565b6000546001600160a01b0316614be1565b614c98600160e01b60ff60e01b196015541617601555565b388080614c35565b614cc59150613c47612335916001600160a01b03166000526017602052604060002090565b38614c2f565b50614cef612335613c47856001600160a01b03166000526017602052604060002090565b614b8c565b50600160ff8560e01c1614614b5b565b614d1190612710926130b6565b0490565b90916001600160a01b03809216918215614db4578316928315614d8a57817f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592614d8060209386600052600a85526040600020906001600160a01b0316600052602052604060002090565b55604051908152a3565b60046040517fd8aedff6000000000000000000000000000000000000000000000000000000008152fd5b60046040517fbec36d8f000000000000000000000000000000000000000000000000000000008152fd5b906001600160a01b038216600052600a602052614e12816040600020906001600160a01b0316600052602052604060002090565b549260018401614e225750505050565b808410614e3457614bff930391614d15565b60046040517fb9788773000000000000000000000000000000000000000000000000000000008152fd5b8054821015614e765760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b90604051614e9981611131565b602081935463ffffffff81168352811c910152565b6001600160a01b0390818116908115614fce5783916015549360ff8560c81c16614f4f575b506130729350614ee282614808565b614ef6614ef184600b54613f70565b600b55565b614f13826001600160a01b03166000526009602052604060002090565b8054840190556040518381526000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602090a36000614b3e565b90925060195416803b156104f257604051632163733b60e21b81526000600482018190526001600160a01b03841660248301526044820187905260e09590951c60ff166002146064820152939084908183816084810103925af19182156109145761307293859315614ed3578061261f614fc892611118565b38614ed3565b60046040517fd1bb5a3e000000000000000000000000000000000000000000000000000000008152fd5b906001600160a01b038216918215614fce576015549260ff8460c81c16615028575b6112089350614ee282614808565b61503d6105c96019546001600160a01b031690565b803b156104f257604051632163733b60e21b81526000600482018190526001600160a01b03851660248301526044820186905260e09690961c60ff166002146064820152949085908183816084810103925af193841561091457611208946150a6575b5061501a565b8061261f6150b392611118565b386150a0565b906001600160a01b03821680156142c15781600084816150e0946142268561308b996146ea565b6155fe565b156150ec57565b60405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608490fd5b9061120892916001600160a01b038091166000526012602052808060406000205416921660005260406000205416906151df565b611208916001600160a01b03809216600092818452601260205280604085205416809260096020527f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60408720549660126020526040812094871694856001600160a01b031982541617905580a45b91906001600160a01b03808216931683811415806153fa575b6152025750505050565b80615275575b5082615215575b80614b60565b7fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7249161525761525c926001600160a01b03166000526013602052604060002090565b615676565b60408051928352602083019190915290a238808061520f565b8060005260136020527fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72460406000208054801591826000146153d7576152b96111fb565b6000815260006020820152915b6152e96152dd60208501516001600160e01b031690565b6001600160e01b031690565b926152f48985615f87565b941590816153b4575b50156153525761532561533c9261531386615e0e565b92600019019060005260206000200190565b9063ffffffff82549181199060201b169116179055565b604080519182526020820192909252a238615208565b506153af9061537661537161536643615e8d565b65ffffffffffff1690565b615f0b565b906153aa61538386615e0e565b61539a61538e6111fb565b63ffffffff9095168552565b6001600160e01b03166020840152565b61546f565b61533c565b5163ffffffff16905063ffffffff6153ce61536643615e8d565b911614386152fd565b6153f46153ef60001984018360005260206000200190565b614e8c565b916152c6565b508215156151f8565b601454906801000000000000000082101561112c576001820180601455821015614e76576014600052805160209182015190911b63ffffffff191663ffffffff91909116177fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec90910155565b80546801000000000000000081101561112c5761549191600182018155614e5e565b6154b857815160209283015190921b63ffffffff191663ffffffff92909216919091179055565b634e487b7160e01b600052600060045260246000fd5b601454909181159182156155c9576154e46111fb565b60008152600060208201525b61551161550a6152dd60208401516001600160e01b031690565b9586615f94565b931590816155a6575b501561555b576112089061532561553085615e0e565b6014600052917fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb0190565b5061120861556e61537161536643615e8d565b6155a161557a85615e0e565b6155916155856111fb565b63ffffffff9094168452565b6001600160e01b03166020830152565b615403565b5163ffffffff16905063ffffffff6155c061536643615e8d565b9116143861551a565b60146000526155f97fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614e8c565b6154f0565b60145490918115918215615641576156146111fb565b60008152600060208201525b61551161563a6152dd60208401516001600160e01b031690565b9586615f87565b60146000526156717fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614e8c565b615620565b9091815491821592836000146157115761568e6111fb565b60008152600060208201525b6156bb6156b46152dd60208401516001600160e01b031690565b9687615f94565b941590816156ee575b50156156da576153256112089261531386615e0e565b506112089061537661537161536643615e8d565b5163ffffffff16905063ffffffff61570861536643615e8d565b911614386156c4565b6157296153ef60001983018460005260206000200190565b61569a565b919290156157905750815115615742575090565b3b1561574b5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156157a35750805190602001fd5b60405162461bcd60e51b81529081906149539060048301610795565b916107a693916157ce93615916565b9190916157f6565b600511156157e057565b634e487b7160e01b600052602160045260246000fd5b6157ff816157d6565b806158075750565b615810816157d6565b6001810361585d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b615866816157d6565b600281036158b35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b806158bf6003926157d6565b146158c657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831161598c5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156109145781516001600160a01b03811615615986579190565b50600190565b50505050600090600390565b6001600160a01b037f0000000000000000000000000b76f1456a4e44d11cf32b8c6398d68f94c578d616301480615a89575b156159f3577f9b9e3646d0840be66f00eae36ea3a082f79af9225cf5473675499e07316e95a090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f969358f228c31987c2aa64ac7467c0145d93342c868ef4d324132ff7dbe6da9b60408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a08152615a83816111bd565b51902090565b507f000000000000000000000000000000000000000000000000000000000000000146146159ca565b604290615abd615998565b906040519161190160f01b8352600283015260228201522090565b60ff8114615b2e5760ff811690601f8211615b045760405191615afa83611131565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600e54816000615b4183611613565b808352602093600190818116908115615bca5750600114615b6b575b50506107a6925003826111d9565b90939150600e6000527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd936000915b818310615bb25750506107a693508201013880615b5d565b85548784018501529485019486945091830191615b9a565b9150506107a694925060ff191682840152151560051b8201013880615b5d565b60ff8114615c0c5760ff811690601f8211615b045760405191615afa83611131565b50604051600f54816000615c1f83611613565b808352602093600190818116908115615bca5750600114615c485750506107a6925003826111d9565b90939150600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802936000915b818310615c8f5750506107a693508201013880615b5d565b85548784018501529485019486945091830191615c77565b90808216911860011c8101809111610cb85790565b8015615df65780615d8f615d88615d7e615d74615d6a615d60615d56615d4c60016107a69a6000908b60801c80615dea575b508060401c80615ddd575b508060201c80615dd0575b508060101c80615dc3575b508060081c80615db6575b508060041c80615da9575b508060021c80615d9c575b50821c615d95575b811c1b615d45818b613f93565b0160011c90565b615d45818a613f93565b615d458189613f93565b615d458188613f93565b615d458187613f93565b615d458186613f93565b615d458185613f93565b8092613f93565b90615dfc565b8101615d38565b6002915091019038615d30565b6004915091019038615d25565b6008915091019038615d1a565b6010915091019038615d0f565b6020915091019038615d04565b6040915091019038615cf9565b91505060809038615cee565b50600090565b9080821015615e09575090565b905090565b6001600160e01b0390818111615e22571690565b60405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f32342062697473000000000000000000000000000000000000000000000000006064820152608490fd5b65ffffffffffff90818111615ea0571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201527f38206269747300000000000000000000000000000000000000000000000000006064820152608490fd5b63ffffffff90818111615f1c571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f32206269747300000000000000000000000000000000000000000000000000006064820152608490fd5b908103908111610cb85790565b908101809111610cb8579056fea2646970667358221220ad8aa43a92bcd576362f8628a448b8e6178756dffd4abd69878d463233019fa864736f6c63430008150033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.