ERC-20
Overview
Max Total Supply
888,000,000,000 BENTEST
Holders
8
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
29,551,451,667.335092348284960422 BENTESTValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
BenCoinV2
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 320 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 {IERC165} from "./oz/utils/introspection/IERC165.sol"; import {SafeERC20} from "./oz/token/ERC20/utils/SafeERC20.sol"; import {OFTV2} from "./lz/token/oft/v2/OFTV2.sol"; import {IBuyTaxReceiver} from "./interfaces/IBuyTaxReceiver.sol"; import {IAntiMevStrategy} from "./interfaces/IAntiMevStrategy.sol"; 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 SetMEVWhitelist(address whitelist, bool isWhitelisted); event SetIsTransferBlacklisting(bool isBlacklisting); event SetTransferBlacklist(address blacklist, bool isBlacklisted); error OnlyMigrator(); error MaxTaxExceeded(); error BothAddressesAreContracts(); error TransferBlacklisted(address); error InvalidBuyTaxReceiver(); error InvalidArrayLength(); error AlreadyInitialized(); address private migrator; // Only used on Ethereum for the initial migration from BenV1 to BenV2 uint16 private buyTax; uint16 private sellTax; bool private isTaxingEnabled; bool private isAntiMEV; bool private isBlacklisting; bool private isInitialized; uint8 private taxFlag = NOT_TAXING; address private buyTaxReceiver; // Using 1 & 2 instead of 0 to save gas when resetting uint96 private minimumBenToSwapReached; mapping(address contractAddress => bool isTaxable) private taxableContracts; mapping(address whitelist => bool isWhitelisted) private taxWhitelist; // For certain addresses to be exempt from tax like exchanges mapping(address whitelist => bool isWhitelisted) private MEVWhitelist; // For certain addresses to be exempt from MEV like exchanges mapping(address blacklist => bool isBlacklisted) private transferBlacklist; IAntiMevStrategy private antiMEVStrategy; uint256 private constant MAX_TAX = 10; // 10% uint8 private constant NOT_TAXING = 1; uint8 private constant TAXING = 2; uint256 private constant FEE_DENOMINATOR = 10000; uint8 private constant SHARED_DECIMALS = 8; constructor() OFTV2("BEN TEST", "BENTEST", SHARED_DECIMALS) ERC20Permit("BEN TEST") { _setTax(100, 300, true); // 1% buy, 3% sell _setIsAntiMEV(true); _setIsTransferBlacklisting(true); } function initialize( address _lzEndpoint, address _buyTaxReceiver, address _antiMEVStrategy, address _migrator ) external notInitialized onlyOwner { __OFTV2_init(_lzEndpoint); _setBuyTaxReceiver(_buyTaxReceiver); antiMEVStrategy = IAntiMevStrategy(_antiMEVStrategy); migrator = _migrator; isInitialized = true; } modifier notInitialized() { if (isInitialized) { revert AlreadyInitialized(); } _; } modifier antiMEV( address _from, address _to, uint256 _amount ) { if (isAntiMEV) { bool fromIsWhitelisted = MEVWhitelist[_from]; bool toIsWhitelisted = MEVWhitelist[_to]; antiMEVStrategy.onTransfer(_from, _to, fromIsWhitelisted, toIsWhitelisted, _amount, taxFlag == TAXING); } _; } modifier onlyMigrator() { if (_msgSender() != migrator) { revert OnlyMigrator(); } _; } function burn(uint256 _amount) external { _burn(_msgSender(), _amount); } function burnFrom(address _account, uint256 _amount) external { _spendAllowance(_account, _msgSender(), _amount); _burn(_account, _amount); } function _mint(address _account, uint256 _amount) internal override(ERC20, ERC20Votes) { super._mint(_account, _amount); } function _burn(address _account, uint256 _amount) internal override(ERC20, ERC20Votes) { super._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 && taxableContracts[_to] && !taxWhitelist[_from] && balanceOf(buyTaxReceiver) >= minimumBenToSwapReached ) { taxFlag = TAXING; // Set this so no further taxing is done 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 (taxableContracts[_from] && !taxWhitelist[_to]) { uint 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 (taxableContracts[_to] && !taxWhitelist[_from]) { uint fee = _calcTax(sellTax, _amount); // Transfers from taxable contracts (like LPs) to the admin directly taxFlag = TAXING; _transfer(_to, owner(), fee); taxFlag = NOT_TAXING; } } } function _calcTax(uint _tax, uint _amount) private pure returns (uint 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 (!IERC165(_buyTaxReceiver).supportsInterface(type(IBuyTaxReceiver).interfaceId)) { revert InvalidBuyTaxReceiver(); } // Remove previous tax receiveer from the whitelist if (MEVWhitelist[buyTaxReceiver]) { _setMEVWhitelist(buyTaxReceiver, false); } buyTaxReceiver = _buyTaxReceiver; if (!MEVWhitelist[_buyTaxReceiver]) { _setMEVWhitelist(_buyTaxReceiver, true); } emit SetBuyTaxReceiver(_buyTaxReceiver); } function _setMEVWhitelist(address _whitelist, bool _isWhitelisted) private { MEVWhitelist[_whitelist] = _isWhitelisted; emit SetMEVWhitelist(_whitelist, _isWhitelisted); } function setTax(uint256 _buyTax, uint256 _sellTax, bool _isTaxingEnabled) external onlyOwner { _setTax(_buyTax, _sellTax, _isTaxingEnabled); } function setIsAntiMEV(bool _isAntiMEV) external onlyOwner { _setIsAntiMEV(_isAntiMEV); } function recoverToken(IERC20 _token, uint _amount) external onlyOwner { _token.safeTransfer(owner(), _amount); } function setTaxableContract(address _taxableContract, bool _isTaxable) external onlyOwner { taxableContracts[_taxableContract] = _isTaxable; emit SetTaxableContract(_taxableContract, _isTaxable); } function setTaxWhitelist(address _whitelist, bool _isWhitelisted) external onlyOwner { taxWhitelist[_whitelist] = _isWhitelisted; emit SetTaxWhitelist(_whitelist, _isWhitelisted); } function setMEVWhitelist(address _whitelist, bool _isWhitelisted) external onlyOwner { _setMEVWhitelist(_whitelist, _isWhitelisted); } function setBuyTaxReceiver(address _buyTaxReceiver) external onlyOwner { _setBuyTaxReceiver(_buyTaxReceiver); } function setIsTransferBlacklisting(bool _isBlacklisting) external onlyOwner { _setIsTransferBlacklisting(_isBlacklisting); } function setTransferBlacklist(address _blacklist, bool _isBlacklisted) external onlyOwner { transferBlacklist[_blacklist] = _isBlacklisted; emit SetTransferBlacklist(_blacklist, _isBlacklisted); } function setAntiMevStrategy(IAntiMevStrategy _antiMEVStrategy) external onlyOwner { antiMEVStrategy = _antiMEVStrategy; } function setMinimumBenToSwapReached(uint88 _minimumBenToSwapReached) external onlyOwner { minimumBenToSwapReached = _minimumBenToSwapReached; } // Only used on Ethereum for the initial migration from BenV1 to BenV2 function mint(address _to, uint _amount) external onlyMigrator { _mint(_to, _amount); } // TODO: Make sure to remove!! function testMint(uint _amount) external { _mint(msg.sender, _amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; interface IAntiMevStrategy { function onTransfer( address from, address to, bool fromIsWhitelisted, bool toIsWhitelisted, 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": 320, "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":"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":"address","name":"whitelist","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"SetMEVWhitelist","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"}],"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":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","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":"address","name":"_whitelist","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setMEVWhitelist","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":"uint88","name":"_minimumBenToSwapReached","type":"uint88"}],"name":"setMinimumBenToSwapReached","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":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"testMint","outputs":[],"stateMutability":"nonpayable","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
6101a060409080825234620005375762000019816200053c565b600881526020908181016710915388151154d560c21b9384825280519462000041866200053c565b600886528486015280519062000057826200053c565b6007825266109153951154d560ca1b8583015280519462000078866200053c565b6001808752603160f81b82880190815260008054336001600160a01b0319821681178355919691906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08880a3600860805289516001600160401b039a908b81116200045257600c54918583811c931680156200052c575b8784101462000433578190601f93848111620004d8575b50879084831160011462000472578a9262000466575b5050600019600383901b1c191690851b17600c555b8151918b83116200045257600d548581811c9116801562000447575b87821014620004335790818385949311620003dd575b5086918311600114620003775788926200036b575b5050600019600383901b1c191690831b17600d555b6402540be40060a052620001aa876200056e565b95610160968752620001bc896200074b565b976101809889525190209061012098828a5251902090610140958287524660e052855192858401927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f84528785015260608401524660808401523060a084015260a0835260c083019a838c10908c1117620003575750907f4afb66c9bb6da7f9e6cbb478337238477302fef1901949e5cbc037b2db7cd3429392918a86528151902060c0527f7294b4c7617e41cb925ae9440310fb23923aff0612102e0dbc68dab1b5b86c6560606101009b308d52848d601554956064845261012c60e08201520152a17f12dcaec55ae8add66312d9a3feb1c94658903c007d895c262ce36355111ed158838651848152a1600160a01b61ff0160d81b0319166740004040404b001960a21b176015558351908152a15193615dc8958662000904873960805186611b80015260a05186818161382701528181613ab201528181613d7e0152613dcd015260c0518661581e015260e051866158d9015251856157ef0152518461586d0152518361589301525182611a8801525181611ab20152f35b634e487b7160e01b81526041600452602490fd5b01519050388062000181565b600d89528689208694509190601f1984168a5b89828210620003c65750508411620003ac575b505050811b01600d5562000196565b015160001960f88460031b161c191690553880806200039d565b83850151865589979095019493840193016200038a565b90919250600d89528689208380860160051c82019289871062000429575b91869589929594930160051c01915b8281106200041a5750506200016c565b8b81558695508891016200040a565b92508192620003fb565b634e487b7160e01b89526022600452602489fd5b90607f169062000156565b634e487b7160e01b88526041600452602488fd5b01519050388062000125565b600c8b52888b208894509190601f1984168c5b8b828210620004c15750508411620004a7575b505050811b01600c556200013a565b015160001960f88460031b161c1916905538808062000498565b8385015186558b9790950194938401930162000485565b909150600c8a52878a208480850160051c8201928a861062000522575b918991869594930160051c01915b828110620005135750506200010f565b8c815585945089910162000503565b92508192620004f5565b92607f1692620000f8565b600080fd5b604081019081106001600160401b038211176200055857604052565b634e487b7160e01b600052604160045260246000fd5b8051602090818110156200060b5750601f825111620005aa57808251920151908083106200059b57501790565b82600019910360031b1b161790565b90604051809263305a27a960e01b82528060048301528251908160248401526000935b828510620005f1575050604492506000838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350620005cd565b906001600160401b0382116200055857600e54926001938481811c9116801562000740575b838210146200072a57601f8111620006f0575b5081601f841160011462000684575092829391839260009462000678575b50501b916000199060031b1c191617600e5560ff90565b01519250388062000661565b919083601f198116600e60005284600020946000905b88838310620006d55750505010620006bb575b505050811b01600e5560ff90565b015160001960f88460031b161c19169055388080620006ad565b8587015188559096019594850194879350908101906200069a565b600e60005284601f84600020920160051c820191601f860160051c015b8281106200071d57505062000643565b600081550185906200070d565b634e487b7160e01b600052602260045260246000fd5b90607f169062000630565b805160209081811015620007d95750601f8251116200077857808251920151908083106200059b57501790565b90604051809263305a27a960e01b82528060048301528251908160248401526000935b828510620007bf575050604492506000838284010152601f80199101168101030190fd5b84810182015186860160440152938101938593506200079b565b906001600160401b0382116200055857600f54926001938481811c91168015620008f8575b838210146200072a57601f8111620008be575b5081601f841160011462000852575092829391839260009462000846575b50501b916000199060031b1c191617600f5560ff90565b0151925038806200082f565b919083601f198116600f60005284600020946000905b88838310620008a3575050501062000889575b505050811b01600f5560ff90565b015160001960f88460031b161c191690553880806200087b565b85870151885590960195948501948793509081019062000868565b600f60005284601f84600020920160051c820191601f860160051c015b828110620008eb57505062000811565b60008155018590620008db565b90607f1690620007fe56fe6080604052600436101561001257600080fd5b60003560e01c80621d35671461051c57806301ffc9a71461051757806306fdde031461051257806307e0db171461050d578063095ea7b3146105085780630df374831461050357806310ddb137146104fe57806318160ddd1461043657806323b872dd146104f95780632518d450146104f45780632f3f94ae146104ef578063313ce567146104ea5780633644e515146104e5578063365260b4146104e057806339509351146104db5780633a46b1a8146104d65780633d8b38f6146104d15780633f1f4fa4146104cc57806340c10f19146104c757806342966c68146104c257806342d65a8d146104bd57806343bdcf21146104b857806344770515146104ae5780634bf5d7e9146104b35780634c42899a146104ae578063587cde1e146104a95780635afde063146104a45780635b8c41e61461049f5780635c19a95c1461049a57806363cd3c691461049557806366ad5c8a14610490578063695ef6bf1461048b5780636fcfff451461048657806370a0823114610481578063715018a61461047c5780637533d7881461047757806376203b481461047257806379cc67901461046d5780637c9242e8146104685780637ecebe001461046357806384761dbb1461045e57806384b0196e14610459578063857749b0146104545780638cfd8f5c1461044f5780638da5cb5b1461044a5780638e539e8c14610445578063916b0dae1461044057806391ddadf41461043b5780639358928b14610436578063950c8a741461043157806395d89b411461042c5780639ab24eb0146104275780639bdb9812146104225780639f38369a1461041d578063a457c2d714610418578063a4c51df514610413578063a6c3d1651461040e578063a9059cbb14610409578063ac8da3c414610404578063b29a8140146103ff578063b353aaa7146103fa578063baf3292d146103f5578063c3cda520146103f0578063c4461834146103eb578063cbed8b9c146103e6578063d1deba1f146103e1578063d505accf146103dc578063dd62ed3e146103d7578063df2a5b3b146103d2578063e6a20ae6146103cd578063e9c80e63146103c8578063eab45d9c146103c3578063eaffd49a146103be578063eb8d72b7146103b9578063ed629c5c146103b4578063f1127ed8146103af578063f2fde38b146103aa578063f5ecbdbc146103a5578063f840edfd146103a0578063f8c8765e1461039b5763fc0c546a1461039657600080fd5b613099565b612fd5565b612f8f565b612ede565b612e59565b612dcf565b612dac565b612c68565b612be3565b612b81565b612a83565b612a67565b6129ba565b61295e565b61284b565b612725565b61265f565b612642565b612546565b6124b8565b612491565b61236d565b612340565b612316565b61218e565b6120fb565b612089565b611f8c565b611f41565b611edb565b611e32565b611e0b565b6109c8565b611ddf565b611d7b565b611c15565b611bee565b611ba4565b611b66565b611a6d565b611a01565b6119c3565b611957565b611923565b611802565b6117af565b61166a565b61162e565b6115e2565b6114dd565b61149d565b611439565b611413565b6113ac565b611175565b611135565b611092565b6110ae565b611037565b610fcf565b610fb2565b610f64565b610f2f565b610ed3565b610d2d565b610cca565b610bdc565b610bb9565b610b9d565b610add565b610a55565b6109e6565b610961565b610926565b6108f1565b610864565b610785565b6106c8565b6105dc565b6004359061ffff8216820361053257565b600080fd5b6024359061ffff8216820361053257565b9181601f84011215610532578235916001600160401b038311610532576020838186019501011161053257565b9060806003198301126105325760043561ffff8116810361053257916001600160401b039060243582811161053257816105b191600401610548565b9390939260443581811681036105325792606435918211610532576105d891600401610548565b9091565b34610532576105ea36610575565b91929493906106136106076106076001546001600160a01b031690565b6001600160a01b031690565b33036106b6576106396106348661ffff166000526002602052604060002090565b611794565b805190818814918215926106ad575b508115610689575b506106775761066761066f926106759736916112f4565b9236916112f4565b92613438565b005b604051634e2fa73d60e11b8152600490fd5b90506106963688856112f4565b602081519101209060208151910120141538610650565b15915038610648565b6040516313deb67160e21b8152600490fd5b346105325760203660031901126105325760043563ffffffff60e01b811680910361053257602090631f7ecdf760e01b811490811561070d575b506040519015158152f35b6301ffc9a760e01b14905038610702565b600091031261053257565b60005b83811061073c5750506000910152565b818101518382015260200161072c565b9060209161076581518092818552858086019101610729565b601f01601f1916010190565b90602061078292818152019061074c565b90565b34610532576000806003193601126108615760405181600c546107a7816116c5565b90818452602092600191828116908160001461083f57506001146107e6575b6107e2856107d6818903826112a9565b60405191829182610771565b0390f35b929450600c83527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c75b82841061082c57505050816107e2936107d69282010193386107c6565b805485850187015292850192810161080f565b60ff191686860152505050151560051b82010191506107d6816107e2386107c6565b80fd5b3461053257600060203660031901126108615761087f610521565b6108876142e4565b816001600160a01b036001541691823b156108dc57602461ffff918360405195869485936307e0db1760e01b85521660048401525af180156108d7576108cb575080f35b6108d4906111ef565b80f35b6130c9565b5080fd5b6001600160a01b0381160361053257565b346105325760403660031901126105325761091b600435610911816108e0565b6024359033614c32565b602060405160018152f35b346105325760403660031901126105325761ffff610942610521565b61094a6142e4565b166000526004602052602435604060002055600080f35b3461053257600060203660031901126108615761097c610521565b6109846142e4565b816001600160a01b036001541691823b156108dc57602461ffff918360405195869485936310ddb13760e01b85521660048401525af180156108d7576108cb575080f35b34610532576000366003190112610532576020600b54604051908152f35b346105325760603660031901126105325761091b600435610a06816108e0565b602435610a12816108e0565b60443591610a21833383614ccb565b61430a565b8015150361053257565b604090600319011261053257600435610a48816108e0565b9060243561078281610a26565b34610532577ffd7f6d25e7487e01d60c54f215c3a81bb6f973034cb26cf98baa0355fcc05f19610a8436610a30565b90610a8d6142e4565b6001600160a01b0381166000526017602052610ab98260406000209060ff801983541691151516179055565b604080516001600160a01b039092168252911515602082015290819081015b0390a1005b34610532576020366003190112610532576004353315610b8b57610b018133614407565b610b15610b1082600b54613d4a565b600b55565b336000818152600960209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a3610b6181336000614a6e565b600b546001600160e01b0310610b7a5761067590615318565b60405162b2ad6d60e71b8152600490fd5b6040516368ddad1f60e11b8152600490fd5b3461053257600036600319011261053257602060405160128152f35b34610532576000366003190112610532576020610bd46157e5565b604051908152f35b346105325760a036600319011261053257610bf5610521565b606435610c0181610a26565b608435906001600160401b03821161053257610c2d610c266040933690600401610548565b36916112f4565b92610c44610c3c604435613d7c565b602435613e02565b6001600160a01b036001541691610c7285519687958694859463040a7bb160e41b865230906004870161375b565b03915afa9081156108d7576000908192610c99575b50604080519182526020820192909252f35b9050610cbc915060403d8111610cc3575b610cb481836112a9565b810190613745565b9038610c87565b503d610caa565b3461053257604036600319011261053257600435610ce7816108e0565b33600052600a602052610d11816040600020906001600160a01b0316600052602052604060002090565b546024358101809111610d285761091b9133614c32565b6132de565b3461053257604036600319011261053257600435610d4a816108e0565b6024359065ffffffffffff610d5e43615cac565b16821015610e87576001600160a01b03166000526013602052604060002080549160008360058111610e36575b50905b838210610de157505081610dbe5750506107e260005b6040516001600160e01b0390911681529081906020820190565b6000908152602090206107e291610ddc9101600019015b5460201c90565b610da4565b9092610ded8185615adc565b90818363ffffffff610e13610e09848960005260206000200190565b5463ffffffff1690565b161115610e24575050925b90610d8e565b909450610e319150613d2e565b610e1e565b80610e46610e4c92969396615af1565b9061342b565b908263ffffffff610e67610e09858860005260206000200190565b161115610e775750925b38610d8b565b9350610e8290613d2e565b610e71565b60405163b95f42c360e01b8152600490fd5b9060406003198301126105325760043561ffff811681036105325791602435906001600160401b038211610532576105d891600401610548565b3461053257602061ffff610f20610ee936610e99565b9390911660005260028452610f0b610f126040600020604051928380926116ff565b03826112a9565b8481519101209236916112f4565b82815191012014604051908152f35b346105325760203660031901126105325761ffff610f4b610521565b1660005260046020526020604060002054604051908152f35b3461053257604036600319011261053257600435610f81816108e0565b6001600160a01b03601554163303610fa0576106759060243590613307565b604051638020644960e01b8152600490fd5b346105325760203660031901126105325761067560043533614f0f565b34610532576001600160a01b03610fe536610e99565b610fed6142e4565b6001549160009485931690813b15611033578361102195604051968795869485936342d65a8d60e01b8552600485016133ad565b03925af180156108d7576108cb575080f35b8380fd5b34610532576020366003190112610532576004356affffffffffffffffffffff81168103610532576110676142e4565b6001600160a01b03601654916affffffffffffffffffffff60a01b9060a01b16911617601655600080f35b3461053257600036600319011261053257602060405160008152f35b34610532576000366003190112610532574365ffffffffffff6110d043615cac565b1603611123576107e26040516110e581611207565b601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c74000000602082015260405191829160208352602083019061074c565b60405163d50637bf60e01b8152600490fd5b34610532576020366003190112610532576020600435611154816108e0565b6001600160a01b038091166000526012825260406000205416604051908152f35b34610532577f8f3675e5a31b083483e5a782db4130316da1e3c5fca72fc2398f59692286d8a56111a436610a30565b906111ad6142e4565b6001600160a01b0381166000526018602052610ab98260406000209060ff801983541691151516179055565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161120257604052565b6111d9565b604081019081106001600160401b0382111761120257604052565b602081019081106001600160401b0382111761120257604052565b608081019081106001600160401b0382111761120257604052565b60a081019081106001600160401b0382111761120257604052565b60e081019081106001600160401b0382111761120257604052565b60c081019081106001600160401b0382111761120257604052565b90601f801991011681019081106001600160401b0382111761120257604052565b604051906112d782611207565b565b6001600160401b03811161120257601f01601f191660200190565b929192611300826112d9565b9161130e60405193846112a9565b829481845281830111610532578281602093846000960137010152565b60606003198201126105325760043561ffff8116810361053257916024356001600160401b0392838211610532578060238301121561053257816024611376936004013591016112f4565b9160443590811681036105325790565b6020906113a0928260405194838680955193849201610729565b82019081520301902090565b3461053257602061140a61ffff6113e9836113c63661132b565b949091166000526006825260406000208260405194838680955193849201610729565b820190815203019020906001600160401b0316600052602052604060002090565b54604051908152f35b3461053257602036600319011261053257610675600435611433816108e0565b33614fc6565b34610532577f271a6c83d2d471fc3b7e0785e77e48c25259853378b45972025bdfa21af522f361146836610a30565b906114716142e4565b6001600160a01b038116600052601a602052610ab98260406000209060ff801983541691151516179055565b34610532576114ab36610575565b91929493903033036106b6576106676114c9926106759736916112f4565b926137a0565b908160609103126105325790565b60a0366003190112610532576004356114f5816108e0565b6114fd610537565b604435916084356001600160401b038111610532576115209036906004016114cf565b9081359161152d836108e0565b61154c610c26602083013592611542846108e0565b604081019061358f565b926115578486613cc8565b61156c611565606435613dcb565b5084613f9c565b9384156115d0577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a936115c361ffff936001600160a01b03936020966115ba6115b48b613d7c565b8d613e02565b9234938c613908565b60405195865216941692a4005b60405163329a734f60e21b8152600490fd5b34610532576020366003190112610532576001600160a01b03600435611607816108e0565b1660005260136020526020611620604060002054615d13565b63ffffffff60405191168152f35b34610532576020366003190112610532576020610bd4600435611650816108e0565b6001600160a01b0316600052600960205260406000205490565b3461053257600080600319360112610861576116846142e4565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90600182811c921680156116f5575b60208310146116df57565b634e487b7160e01b600052602260045260246000fd5b91607f16916116d4565b80546000939261170e826116c5565b9182825260209360019182811690816000146117755750600114611734575b5050505050565b90939495506000929192528360002092846000945b8386106117615750505050010190388080808061172d565b805485870183015294019385908201611749565b60ff19168685015250505090151560051b01019150388080808061172d565b906112d76117a892604051938480926116ff565b03836112a9565b346105325760203660031901126105325761ffff6117cb610521565b1660005260026020526107e2610f0b6117ee6040600020604051928380926116ff565b60405191829160208352602083019061074c565b60e03660031901126105325760043561181a816108e0565b611822610537565b604435916001600160401b039060843582811161053257611847903690600401610548565b9160a435848116948582036105325760c4359081116105325761186e9036906004016114cf565b936118b06118a8863592611881846108e0565b6118a061189660208a0135996115428b6108e0565b98909236916112f4565b9636916112f4565b968789613c1e565b6118be611565606435613dcb565b9586156115d0577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a95611907611910946001600160a01b03976119008b613d7c565b8d33613e48565b9234938a613908565b604051938452169261ffff1691602090a4005b3461053257604036600319011261053257610675600435611943816108e0565b60243590611952823383614ccb565b614f0f565b34610532576020366003190112610532577f4afb66c9bb6da7f9e6cbb478337238477302fef1901949e5cbc037b2db7cd342602060043561199781610a26565b61199f6142e4565b151560155460ff60d01b8260d01b169060ff60d01b191617601555604051908152a1005b34610532576020366003190112610532576001600160a01b036004356119e8816108e0565b1660005260106020526020604060002054604051908152f35b34610532576020366003190112610532577f12dcaec55ae8add66312d9a3feb1c94658903c007d895c262ce36355111ed1586020600435611a4181610a26565b611a496142e4565b151560155460ff60c81b8260c81b169060ff60c81b191617601555604051908152a1005b346105325760008060031936011261086157611b0a90611aac7f0000000000000000000000000000000000000000000000000000000000000000615925565b90611ad67f0000000000000000000000000000000000000000000000000000000000000000615a1f565b9060405191611ae483611222565b818352611b18602091604051968796600f60f81b885260e08589015260e088019061074c565b90868203604088015261074c565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b828110611b4f57505050500390f35b835185528695509381019392810192600101611b40565b3461053257600036600319011261053257602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461053257604036600319011261053257602061140a611bc2610521565b61ffff611bcd610537565b91166000526003835260406000209061ffff16600052602052604060002090565b346105325760003660031901126105325760206001600160a01b0360005416604051908152f35b346105325760203660031901126105325760043565ffffffffffff611c3943615cac565b16811015610e87576014549060008260058111611d14575b50905b828210611cb1578280611c795750602060005b6040516001600160e01b039091168152f35b6014600052602090611cac907fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb01610dd5565b611c67565b9091611cbd8184615adc565b6014600052908263ffffffff611cf47fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610e09565b161115611d045750915b90611c54565b9250611d0f90613d2e565b611cfe565b80610e46611d2492959395615af1565b6014600052908263ffffffff611d5b7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610e09565b161115611d6b5750915b38611c51565b9250611d7690613d2e565b611d65565b34610532577febb4f87eb9202a817f9b6c9e7a0231dd4c8ac2717748763dd76852e2053b877d611daa36610a30565b90611db36142e4565b6001600160a01b0381166000526019602052610ab98260406000209060ff801983541691151516179055565b34610532576000366003190112610532576020611dfb43615cac565b65ffffffffffff60405191168152f35b346105325760003660031901126105325760206001600160a01b0360055416604051908152f35b34610532576000806003193601126108615760405181600d54611e54816116c5565b90818452602092600191828116908160001461083f5750600114611e82576107e2856107d6818903826112a9565b929450600d83527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb55b828410611ec857505050816107e2936107d69282010193386107c6565b8054858501870152928501928101611eab565b34610532576020366003190112610532576001600160a01b03600435611f00816108e0565b166000526013602052604060002080548015600014611f2757505060405160008152602090f35b602091611f38916000190190614d33565b5054811c611c67565b3461053257602060ff611f8061ffff6113e984611f5d3661132b565b949091166000526008825260406000208260405194838680955193849201610729565b54166040519015158152f35b346105325760208060031936011261053257611fc99061ffff611fad610521565b16600052600281526040611fd0816000208251948580926116ff565b03846112a9565b8251156120795782516013199384820190828211610d2857611ffc82611ff581613d20565b10156140e5565b6120098282511015614122565b8161202c575050506107e2925080519160008352820181525b5191829182610771565b839594955194601f8316801560051b91828289010195860101920101905b8084106120685750508352601f01601f191681526107e29250612022565b81518452928601929086019061204a565b5163344bb83560e11b8152600490fd5b34610532576040366003190112610532576004356120a6816108e0565b6024359033600052600a6020526120d4816040600020906001600160a01b0316600052602052604060002090565b54918083106120e95761091b92039033614c32565b604051634b81eea160e11b8152600490fd5b346105325760e036600319011261053257612114610521565b6001600160401b039060643582811161053257612135903690600401610548565b60849291923584811681036105325760a4359161215183610a26565b60c4359586116105325761216c61217c963690600401610548565b95909460443590602435906135c1565b60408051928352602083019190915290f35b346105325761219c36610e99565b91906121a66142e4565b6040519160208483828601376121d16034858781013060601b858201520360148101875201856112a9565b60009361ffff831685526002825260408520918151916001600160401b038311611202576122098361220386546116c5565b866133c8565b81601f841160011461228057508287989361226f9593612260937f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a92612275575b50508160011b916000199060031b1c19161790565b90555b604051938493846133ad565b0390a180f35b01519050388061224b565b9190601f19841661229686600052602060002090565b9389905b8282106122fe5750509260019285927f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a9b9661226f9896106122e5575b505050811b019055612263565b015160001960f88460031b161c191690553880806122d8565b8060018697829497870151815501960194019061229a565b346105325760403660031901126105325761091b600435612336816108e0565b602435903361430a565b3461053257602036600319011261053257610675600435612360816108e0565b6123686142e4565b6130d5565b346105325760403660031901126105325760043561238a816108e0565b6123926142e4565b6001600160a01b039061243f600092808454168480604051936020968786019463a9059cbb60e01b865260248701526024356044870152604486526123d68661123d565b1692604051946123e586611207565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af13d15612489573d91612424836112d9565b9261243260405194856112a9565b83523d878785013e61557b565b908151918215159182612469575b505090506124585780f35b60405162a4546b60e21b8152600490fd5b61247d9250806124819483010191016130b4565b1590565b80388061244d565b60609161557b565b346105325760003660031901126105325760206001600160a01b0360015416604051908152f35b34610532576020366003190112610532577f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b60206001600160a01b03600435612500816108e0565b6125086142e4565b16806001600160601b0360a01b6005541617600555604051908152a1005b6064359060ff8216820361053257565b6084359060ff8216820361053257565b346105325760c036600319011261053257600435612563816108e0565b60243590604435612572612526565b90804211612630576125e9916040519060208201927fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf84526001600160a01b03861660408401528660608401526080830152608082526125d182611258565b6125e460a43593608435935190206158ff565b61560c565b91612610836001600160a01b03166000526010602052604060002090815491600183019055565b0361261e5761067591614fc6565b60405163713f9ea160e01b8152600490fd5b60405163d52e1db560e01b8152600490fd5b346105325760003660031901126105325760206040516127108152f35b3461053257608036600319011261053257612678610521565b612680610537565b6064356001600160401b0381116105325761269f903690600401610548565b90926126a96142e4565b6001600160a01b036001541690813b156105325760008094612702604051978896879586946332fb62e760e21b865261ffff8092166004870152166024850152604435604485015260806064850152608484019161338c565b03925af180156108d75761271257005b8061271f610675926111ef565b8061071e565b61272e36610575565b90612770836127586127518997989961ffff166000526006602052604060002090565b888a613576565b906001600160401b0316600052602052604060002090565b5491821561067757826127843683856112f4565b6020815191012003612839577fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e59661ffff9661280e61282893876128076001600160401b039760006127f3846127588f6127ec9061ffff166000526006602052604060002090565b8a8c613576565b556127ff3687896112f4565b9336916112f4565b918a6137a0565b60405197889716875260806020880152608087019161338c565b9216604084015260608301520390a1005b6040516306f2f63960e21b8152600490fd5b346105325760e036600319011261053257600435612868816108e0565b602435612874816108e0565b60443590606435612883612536565b9080421161294c5761292b6128b4866001600160a01b03166000526010602052604060002090815491600183019055565b9260405160208101917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983526001600160a01b0394858a1696876040850152868916606085015289608085015260a084015260c083015260c0825261291882611273565b6125e460c4359360a435935190206158ff565b160361293a5761067592614c32565b6040516310454c9960e31b8152600490fd5b6040516363bef56160e11b8152600490fd5b3461053257604036600319011261053257602061140a600435612980816108e0565b6001600160a01b0360243591612995836108e0565b16600052600a83526040600020906001600160a01b0316600052602052604060002090565b34610532576060366003190112610532576129d3610521565b6129db610537565b90604435916129e86142e4565b8215612a55577f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09260609261ffff8091169283600052600360205282612a408260406000209061ffff16600052602052604060002090565b556040519384521660208301526040820152a1005b604051630731578760e41b8152600490fd5b3461053257600036600319011261053257602060405160018152f35b3461053257606036600319011261053257604435602435600435612aa683610a26565b612aae6142e4565b600a8102818104600a1482151715610d2857612710809111908115612b66575b50612b54576015805460ff60c01b94151560c081901b9590951664ffffffffff60a01b1990911660a084901b61ffff60a01b161760b085901b61ffff60b01b1617179055604080519182526020820192909252908101919091527f7294b4c7617e41cb925ae9440310fb23923aff0612102e0dbc68dab1b5b86c65908060608101610ad8565b604051630210e8d560e11b8152600490fd5b9050600a8302838104600a1484151715610d28571138612ace565b34610532576020366003190112610532577f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a46020600435612bc181610a26565b612bc96142e4565b151560ff196007541660ff821617600755604051908152a1005b346105325761010036600319011261053257612bfd610521565b6001600160401b039060243582811161053257612c1e903690600401610548565b919060443590848216820361053257608435612c39816108e0565b60c43595861161053257612c54610675963690600401610548565b94909360e4359660a4359460643593613656565b3461053257612c7636610e99565b9190612c806142e4565b60009161ffff8116835260206002815260408420906001600160401b03861161120257612cb786612cb184546116c5565b846133c8565b8490601f8711600114612d1857509461226f91612260828088997ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab9991612d0d575b508160011b916000199060031b1c19161790565b905087013538612cf9565b90601f198716612d2d84600052602060002090565b9287905b828210612d945750509161226f9391887ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab98999410612d7a575b5050600182811b019055612263565b860135600019600385901b60f8161c191690553880612d6b565b80600185968294968b01358155019501930190612d31565b3461053257600036600319011261053257602060ff600754166040519015158152f35b3461053257604036600319011261053257600435612dec816108e0565b63ffffffff602435818116810361053257612e35612e3b916001600160a01b03604095600060208851612e1e81611207565b828152015216600052601360205284600020614d33565b50614d61565b8251815190921682526020908101516001600160e01b031690820152f35b3461053257602036600319011261053257600435612e76816108e0565b612e7e6142e4565b6001600160a01b038091168015612ecc57600080546001600160a01b03198116831782559092167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b604051633a247dd760e11b8152600490fd5b3461053257608036600319011261053257612ef7610521565b6000612f01610537565b91612f0d6044356108e0565b60846001600160a01b0360015416936040519485938492633d7b2f6f60e21b845261ffff809216600485015216602483015230604483015260643560648301525afa80156108d7576107e291600091612f6e575b5060405191829182610771565b612f89913d8091833e612f8181836112a9565b81019061332e565b38612f61565b34610532576020366003190112610532576001600160a01b03600435612fb4816108e0565b612fbc6142e4565b166001600160601b0360a01b601b541617601b55600080f35b3461053257608036600319011261053257600435612ff2816108e0565b60243590612fff826108e0565b6044359061300c826108e0565b60643592613019846108e0565b60ff60155460d81c1661308857613059926130326142e4565b6001600160a01b03938492836001600160601b0360a01b95168560015416176001556130d5565b1690601b541617601b55600160d81b91166bffffffff00ffffffffffffff60a01b601554161717601555600080f35b60405162dc149f60e41b8152600490fd5b34610532576000366003190112610532576020604051308152f35b90816020910312610532575161078281610a26565b6040513d6000823e3d90fd5b6040516301ffc9a760e01b8152630d4d18e360e31b60048201526020816024816001600160a01b0386165afa9081156108d75760009161320b575b50156131f9576131d77f063dfd21e2b799ca4cb66556e57c360c6abc46f21805029c971f7475a96bd69a9161314d6016546001600160a01b031690565b61317461316d826001600160a01b03166000526019602052604060002090565b5460ff1690565b6131ea575b50601680546001600160a01b0319166001600160a01b0383161790556131b861247d61316d836001600160a01b03166000526019602052604060002090565b6131dc575b6040516001600160a01b0390911681529081906020820190565b0390a1565b6131e58161328a565b6131bd565b6131f390613239565b38613179565b604051639dcd44a360e01b8152600490fd5b61322c915060203d8111613232575b61322481836112a9565b8101906130b4565b38613110565b503d61321a565b60406001600160a01b037febb4f87eb9202a817f9b6c9e7a0231dd4c8ac2717748763dd76852e2053b877d92168060005260196020528160002060ff198154169055815190815260006020820152a1565b60406001600160a01b037febb4f87eb9202a817f9b6c9e7a0231dd4c8ac2717748763dd76852e2053b877d921680600052601960205281600020600160ff19825416179055815190815260016020820152a1565b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715610d2857565b8161331191614d83565b600b546001600160e01b0310610b7a5761332a90615318565b5050565b602081830312610532578051906001600160401b038211610532570181601f82011215610532578051613360816112d9565b9261336e60405194856112a9565b81845260208284010111610532576107829160208085019101610729565b908060209392818452848401376000828201840152601f01601f1916010190565b60409061ffff6107829593168152816020820152019161338c565b90601f81116133d657505050565b600091825260208220906020601f850160051c83019410613412575b601f0160051c01915b82811061340757505050565b8181556001016133fb565b90925082906133f2565b605019810191908211610d2857565b91908203918211610d2857565b9290916134aa5a604051633356ae4560e11b602082015261ffff8716602482015260806044820152906134a48261349661347560a483018a61074c565b6001600160401b03881660648401528281036023190160848401528861074c565b03601f1981018452836112a9565b30614299565b9390156134b8575050505050565b6134c1946134cb565b388080808061172d565b91936135687fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c956131d7939561ffff8151602083012096169586600052600660205261352f836113e960208b60406000208260405194838680955193849201610729565b556001600160401b03613554604051988998895260a060208a015260a089019061074c565b92166040870152858203606087015261074c565b90838203608085015261074c565b6020919283604051948593843782019081520301902090565b903590601e198136030182121561053257018035906001600160401b0382116105325760200191813603831361053257565b94926135e76040986135df6135ed936135f4989d9c969d36916112f4565b9436916112f4565b99613d7c565b9033613e48565b6001600160a01b03600154169161362285519788958694859463040a7bb160e41b865230906004870161375b565b03915afa9182156108d757600090819361363b57509190565b90506105d891925060403d8111610cc357610cb481836112a9565b989593909697989491943033036137335761ffff6001600160a01b039161367e87863061430a565b1692169283837fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf6020604051898152a3833b15610532576136f4996000998a96613716946001600160401b036040519e8f9d8e9c8d9a633fe79aed60e11b8c5260048c015260c060248c015260c48b019161338c565b95166044880152606487015260848601528483036003190160a486015261338c565b0393f180156108d7576137265750565b8061271f6112d7926111ef565b60405163b9984ab560e01b8152600490fd5b9190826040910312610532576020825192015190565b91926001600160a01b03610782969461ffff61378b9416855216602084015260a0604084015260a083019061074c565b9215156060820152608081840391015261074c565b92919060ff6137ae8461423e565b168061388f5750505060ff6137c28261423e565b1615801590613883575b613871576137e26137dc826141e6565b91614289565b906001600160a01b0380821615613867575b61385361384d7fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf93946001600160401b037f000000000000000000000000000000000000000000000000000000000000000091166132f4565b846140c2565b60405190815292169261ffff1691602090a3565b61dead91506137f4565b6040516361072ce360e11b8152600490fd5b506029815114156137cc565b60010361389f576112d793613a6d565b60405163a0e89db160e01b8152600490fd5b926138d661078297959361ffff6138e49416865260c0602087015260c086019061074c565b90848203604086015261074c565b936001600160a01b03809216606084015216608082015260a081840391015261074c565b94611fc99193929561393761392b8261ffff166000526002602052604060002090565b604051948580926116ff565b8251156139cd57845161ffff821660005260046020526040600020549081156139c3575b116139b1576139756106076001546001600160a01b031690565b93843b15610532576000966139a091604051998a988997889662c5803160e81b8852600488016138b1565b03925af180156108d7576137265750565b6040516305dd299360e51b8152600490fd5b612710915061395b565b604051637af198bf60e01b8152600490fd5b989796929394613a3d956001600160401b03613a1960e099956001600160a01b03958e61ffff61010092168152816020820152019061074c565b961660408c015260608b015216608089015260a088015286820360c088015261074c565b930152565b6001600160401b03613a626040939695949660608452606084019061074c565b951660208201520152565b9091613a7884613eb6565b9091613aa261316d87612758613a9c8b61ffff166000526008602052604060002090565b8c611386565b91613ad86001600160401b0392837f000000000000000000000000000000000000000000000000000000000000000091166132f4565b9288888b8315613bd4575b505050853b15613b895794613b2a96946134a4948a94613496948d99600014613b825750505a925b5a978b6040519a8b9863757fea4d60e11b60208b015260248a016139df565b9015613b77575090613b7261ffff928560207fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd88496975191012090604051948594169684613a42565b0390a2565b926112d794926134cb565b1692613b0b565b50506040516001600160a01b039094168452507f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9750919550859450506020840192506131d7915050565b90612758613c0992613c0389613bee613c16979b30613307565b9961ffff166000526008602052604060002090565b90611386565b805460ff19166001179055565b88888b613ae3565b9160ff60075416600014613cac576022825110613c9a5761ffff6022613c6893015193166000526003602052613c6260406000206001600052602052604060002090565b54613d4a565b908115613c885710613c7657565b6040516348c72e7d60e11b8152600490fd5b6040516379cebf6d60e11b8152600490fd5b6040516336dc4d9f60e11b8152600490fd5b50905051613cb657565b604051631beaad3f60e01b8152600490fd5b9060ff60075416600014613d17576022815110613c9a57602261ffff91015191166000526003602052613d08604060002060008052602052604060002090565b54908115613c885710613c7657565b905051613cb657565b90601f8201809211610d2857565b9060018201809211610d2857565b6051019081605111610d2857565b91908201809211610d2857565b634e487b7160e01b600052601260045260246000fd5b8115613d77570490565b613d57565b7f0000000000000000000000000000000000000000000000000000000000000000908115613d7757046001600160401b0390818111613db9571690565b604051630700491360e41b8152600490fd5b7f00000000000000000000000000000000000000000000000000000000000000008015613d7757810690818103908111610d285791565b90604051916000602084015260218301526001600160401b0360c01b9060c01b16604182015260298152606081018181106001600160401b038211176112025760405290565b9392607192610782946001600160a01b03604051978895600160f81b602088015260218701526001600160401b0360c01b809460c01b16604187015216604985015260c01b166069830152613ea68151809260208686019101610729565b81010360518101845201826112a9565b90600160ff613ec48461423e565b160361387157613ed3826141e6565b90613edd83614289565b906049845110613f57576049840151936051815110613f1257613f0f605182015191613f09815161341c565b90614162565b91565b60405162461bcd60e51b815260206004820152601460248201527f746f55696e7436345f6f75744f66426f756e64730000000000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601560248201527f746f427974657333325f6f75744f66426f756e647300000000000000000000006044820152606490fd5b6001600160a01b038116903382036140b2575b8115614063576000818161405594613fc8878096614509565b84613fe6846001600160a01b03166000526009602052604060002090565b54613ff382821015614f3b565b03614011846001600160a01b03166000526009602052604060002090565b5561401f85600b5403600b55565b6040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081015b0390a3614a6e565b61405e81615449565b505090565b60405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b6140bd833383614ccb565b613faf565b816140cc91614d83565b600b546001600160e01b0310610b7a5761405e81615318565b156140ec57565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b1561412957565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b61416f82611ff581613d20565b614184815161417d84613d3c565b1115614122565b8161419c575050604051600081526020810160405290565b60405191601f8116916051831560051b80858701019484860193010101905b8084106141d35750508252601f01601f191660405290565b90928351815260208091019301906141bb565b60218151106141f957602d015160601c90565b60405162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e647300000000000000000000006044820152606490fd5b600181511061424e576001015190565b60405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606490fd5b6029815110613f12576029015190565b90929160008091604051956142ad8761128e565b6096875282602088019560a036883760208451940192f1903d90609682116142db575b6000908286523e9190565b609691506142d0565b6001600160a01b036000541633036142f857565b604051635fc483c560e01b8152600490fd5b91906001600160a01b03928381169384156143f557821680156143e357614332848484614610565b61434f826001600160a01b03166000526009602052604060002090565b54948486106143d157846112d7960361437b846001600160a01b03166000526009602052604060002090565b55614399846001600160a01b03166000526009602052604060002090565b8054860190556040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90806020810161404d565b60405163680c24ff60e11b8152600490fd5b6040516301ace2af60e11b8152600490fd5b6040516327903dcf60e01b8152600490fd5b60155460ff8160c81c16614421575b506112d79150614708565b60008052601960205260ff7fd2ac945fcc0096878c763e37d6929b78378c1a2defabde8ba7ee5ed1d6e7a5b254169061447061316d846001600160a01b03166000526019602052604060002090565b93614486610607601b546001600160a01b031690565b90813b156105325760405163019a898b60e01b81526000600482018190526001600160a01b038716602483015294151560448201529515156064870152608486015260e09190911c60ff1660021460a4850152839081838160c4810103925af19182156108d7576112d79215614416578061271f614503926111ef565b38614416565b60155460ff8160c81c16614523575b506112d791506148b5565b60ff614542836001600160a01b03166000526019602052604060002090565b5460008052601960205216906145777fd2ac945fcc0096878c763e37d6929b78378c1a2defabde8ba7ee5ed1d6e7a5b261316d565b9361458d610607601b546001600160a01b031690565b90813b156105325760405163019a898b60e01b81526001600160a01b038616600482015260006024820181905294151560448201529515156064870152608486015260e09190911c60ff1660021460a4850152839081838160c4810103925af19182156108d7576112d79215614518578061271f61460a926111ef565b38614518565b60155460ff8160c81c1661462a575b506112d792506149b0565b60ff614649836001600160a01b03166000526019602052604060002090565b54169061466c61316d856001600160a01b03166000526019602052604060002090565b94614682610607601b546001600160a01b031690565b90813b156105325760405163019a898b60e01b81526001600160a01b0380871660048301528716602482015293151560448501529515156064840152608483019590955260e01c60ff1660021460a482015292600090849081838160c4810103925af19283156108d7576112d7931561461f578061271f614702926111ef565b3861461f565b6015549060ff8260d01c168061487d575b6148605760ff8260c01c16918261484f575b5081614827575b50806147ec575b806147c4575b61474557565b6015805460ff60e01b1916600160e11b1790556147706106076106076016546001600160a01b031690565b803b156105325760008091600460405180948193630d4d18e360e31b83525af180156108d7576147b1575b506015805460ff60e01b1916600160e01b179055565b8061271f6147be926111ef565b3861479b565b506016546001600160a01b0381166000908152600960205260409020549060a01c111561473f565b5060008052601860205261482261247d7f999d26de3473317ead3eeaf34ca78057f1439db67b6953469c3c96ce9caf6bd761316d565b614739565b614849915061316d906001600160a01b03166000526017602052604060002090565b38614732565b60e01c60ff1660011491503861472b565b604051635504bc0760e01b815260006004820152602490fd5b0390fd5b5060008052601a6020526148b07fb75ecc04ed35f89790e98640e901bda41eceff0cb896cf2765fb69768025375061316d565b614719565b6015549060ff8260d01c168061498a575b6149675760ff8260c01c169182614956575b508161491c575b816148f1575b50806147c45761474557565b614916915061316d61247d916001600160a01b03166000526018602052604060002090565b386148e5565b60008052601760205290506149507fd840e16649f6b9a295d95876f4633d3a6b10b55e8162971cf78afd886d5ec89b61316d565b906148df565b60e01c60ff166001149150386148d8565b604051635504bc0760e01b81526001600160a01b03919091166004820152602490fd5b506149ab61316d826001600160a01b0316600052601a602052604060002090565b6148c6565b6015549160ff8360d01c1680614a48575b614a275760ff8360c01c169283614a16575b50826149ec575b50816148f15750806147c45761474557565b614a0f91925061316d906001600160a01b03166000526017602052604060002090565b90386149da565b60e01c60ff166001149250386149d3565b604051635504bc0760e01b81526001600160a01b0383166004820152602490fd5b50614a6961316d836001600160a01b0316600052601a602052604060002090565b6149c1565b91614a7a818385614f92565b6015549260ff8460c01c1680614c11575b614a96575b50505050565b614ab661316d826001600160a01b03166000526017602052604060002090565b80614be8575b15614b2f5750614b129250614aeb90614ae6614adf60155461ffff9060a01c1690565b61ffff1690565b614c21565b6015805460ff60e01b1916600160e11b179055906016546001600160a01b03165b9061430a565b6015805460ff60e01b1916600160e01b1790555b38808080614a90565b614b4f61316d846001600160a01b03166000526017602052604060002090565b9081614bbd575b50614b64575b505050614b26565b614b7c6127109161ffff614ba29560b01c16906132f4565b6015805460ff60e01b1916600160e11b17905504906000546001600160a01b0316614b0c565b6015805460ff60e01b1916600160e01b179055388080614b5c565b614be2915061316d61247d916001600160a01b03166000526018602052604060002090565b38614b56565b50614c0c61247d61316d856001600160a01b03166000526018602052604060002090565b614abc565b50600160ff8560e01c1614614a8b565b614c2e90612710926132f4565b0490565b90916001600160a01b03809216918215614cb9578316928315614ca757817f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592614c9d60209386600052600a85526040600020906001600160a01b0316600052602052604060002090565b55604051908152a3565b604051636c576ffb60e11b8152600490fd5b60405163bec36d8f60e01b8152600490fd5b906001600160a01b038216600052600a602052614cff816040600020906001600160a01b0316600052602052604060002090565b549260018401614d0f5750505050565b808410614d2157614b26930391614c32565b60405163b978877360e01b8152600490fd5b8054821015614d4b5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b90604051614d6e81611207565b602081935463ffffffff81168352811c910152565b906001600160a01b038216918215610b8b576015549260ff8460c81c16614e1b575b6112d79350614db382614708565b614dc2610b1084600b54613d4a565b614ddf826001600160a01b03166000526009602052604060002090565b8054840190556040518381526000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602090a36000614a6e565b600080526019602052614e4d7fd2ac945fcc0096878c763e37d6929b78378c1a2defabde8ba7ee5ed1d6e7a5b261316d565b93614e6e61316d846001600160a01b03166000526019602052604060002090565b94614e84610607601b546001600160a01b031690565b803b156105325760405163019a898b60e01b81526000600482018190526001600160a01b0387166024830152921515604482015296151560648801526084870186905260e09290921c60ff1660021460a487015290859081838160c4810103925af19384156108d7576112d794614efc575b50614da5565b8061271f614f09926111ef565b38614ef6565b906001600160a01b0382168015614063578160008481614f3694613fc88561332a99614509565b615449565b15614f4257565b60405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608490fd5b906112d792916001600160a01b03809116600052601260205280806040600020541692166000526040600020541690615037565b6112d7916001600160a01b03809216600092818452601260205280604085205416809260096020527f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60408720549660126020526040812094871694856001600160601b0360a01b82541617905580a45b91906001600160a01b038082169316838114158061524e575b61505a5750505050565b806150cd575b508261506d575b80614a90565b7fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724916150af6150b4926001600160a01b03166000526013602052604060002090565b6154c2565b60408051928352602083019190915290a2388080615067565b8060005260136020527fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724604060002080548015918260001461522b576151116112ca565b6000815260006020820152915b602083015161513d906001600160e01b03165b6001600160e01b031690565b926151488985615d78565b94159081615208575b50156151a6576151796151909261516786615c43565b92600019019060005260206000200190565b9063ffffffff82549181199060201b169116179055565b604080519182526020820192909252a238615060565b50615203906151ca6151c56151ba43615cac565b65ffffffffffff1690565b615d13565b906151fe6151d786615c43565b6151ee6151e26112ca565b63ffffffff9095168552565b6001600160e01b03166020840152565b6152be565b615190565b5163ffffffff16905063ffffffff6152226151ba43615cac565b91161438615151565b61524861524360001984018360005260206000200190565b614d61565b9161511e565b50821515615050565b60145490600160401b821015611202576001820180601455821015614d4b576014600052805160209182015190911b63ffffffff191663ffffffff91909116177fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec90910155565b8054600160401b811015611202576152db91600182018155614d33565b61530257815160209283015190921b63ffffffff191663ffffffff92909216919091179055565b634e487b7160e01b600052600060045260246000fd5b601454909181159182156154145761532e6112ca565b60008152600060208201525b602081015161535c90615355906001600160e01b0316615131565b9586615d85565b931590816153f1575b50156153a6576112d79061517961537b85615c43565b6014600052917fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb0190565b506112d76153b96151c56151ba43615cac565b6153ec6153c585615c43565b6153dc6153d06112ca565b63ffffffff9094168452565b6001600160e01b03166020830152565b615257565b5163ffffffff16905063ffffffff61540b6151ba43615cac565b91161438615365565b60146000526154447fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614d61565b61533a565b6014549091811591821561548d5761545f6112ca565b60008152600060208201525b602081015161535c90615486906001600160e01b0316615131565b9586615d78565b60146000526154bd7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614d61565b61546b565b90918154918215928360001461555e576154da6112ca565b60008152600060208201525b602081015161550890615501906001600160e01b0316615131565b9687615d85565b9415908161553b575b5015615527576151796112d79261516786615c43565b506112d7906151ca6151c56151ba43615cac565b5163ffffffff16905063ffffffff6155556151ba43615cac565b91161438615511565b61557661524360001983018460005260206000200190565b6154e6565b919290156155dd575081511561558f575090565b3b156155985790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156155f05750805190602001fd5b60405162461bcd60e51b81529081906148799060048301610771565b91610782939161561b93615763565b919091615643565b6005111561562d57565b634e487b7160e01b600052602160045260246000fd5b61564c81615623565b806156545750565b61565d81615623565b600181036156aa5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6156b381615623565b600281036157005760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b8061570c600392615623565b1461571357565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116157d95791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156108d75781516001600160a01b038116156157d3579190565b50600190565b50505050600090600390565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163014806158d6575b15615840577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a081526158d08161128e565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000004614615817565b60429061590a6157e5565b906040519161190160f01b8352600283015260228201522090565b60ff81146159635760ff811690601f8211615951576040519161594783611207565b8252602082015290565b604051632cd44ac360e21b8152600490fd5b50604051600e54816000615976836116c5565b8083526020936001908181169081156159ff57506001146159a0575b5050610782925003826112a9565b90939150600e6000527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd936000915b8183106159e757505061078293508201013880615992565b855487840185015294850194869450918301916159cf565b91505061078294925060ff191682840152151560051b8201013880615992565b60ff8114615a415760ff811690601f8211615951576040519161594783611207565b50604051600f54816000615a54836116c5565b8083526020936001908181169081156159ff5750600114615a7d575050610782925003826112a9565b90939150600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802936000915b818310615ac457505061078293508201013880615992565b85548784018501529485019486945091830191615aac565b90808216911860011c8101809111610d285790565b8015615c2b5780615bc4615bbd615bb3615ba9615b9f615b95615b8b615b8160016107829a6000908b60801c80615c1f575b508060401c80615c12575b508060201c80615c05575b508060101c80615bf8575b508060081c80615beb575b508060041c80615bde575b508060021c80615bd1575b50821c615bca575b811c1b615b7a818b613d6d565b0160011c90565b615b7a818a613d6d565b615b7a8189613d6d565b615b7a8188613d6d565b615b7a8187613d6d565b615b7a8186613d6d565b615b7a8185613d6d565b8092613d6d565b90615c31565b8101615b6d565b6002915091019038615b65565b6004915091019038615b5a565b6008915091019038615b4f565b6010915091019038615b44565b6020915091019038615b39565b6040915091019038615b2e565b91505060809038615b23565b50600090565b9080821015615c3e575090565b905090565b6001600160e01b0390818111615c57571690565b60405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b6064820152608490fd5b65ffffffffffff90818111615cbf571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201526538206269747360d01b6064820152608490fd5b63ffffffff90818111615d24571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608490fd5b908103908111610d285790565b908101809111610d28579056fea2646970667358221220c913c0ad6c73dfc106df13cb46d9f1a7d463f6c66c767e2d67fa088f72ee323964736f6c63430008150033
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80621d35671461051c57806301ffc9a71461051757806306fdde031461051257806307e0db171461050d578063095ea7b3146105085780630df374831461050357806310ddb137146104fe57806318160ddd1461043657806323b872dd146104f95780632518d450146104f45780632f3f94ae146104ef578063313ce567146104ea5780633644e515146104e5578063365260b4146104e057806339509351146104db5780633a46b1a8146104d65780633d8b38f6146104d15780633f1f4fa4146104cc57806340c10f19146104c757806342966c68146104c257806342d65a8d146104bd57806343bdcf21146104b857806344770515146104ae5780634bf5d7e9146104b35780634c42899a146104ae578063587cde1e146104a95780635afde063146104a45780635b8c41e61461049f5780635c19a95c1461049a57806363cd3c691461049557806366ad5c8a14610490578063695ef6bf1461048b5780636fcfff451461048657806370a0823114610481578063715018a61461047c5780637533d7881461047757806376203b481461047257806379cc67901461046d5780637c9242e8146104685780637ecebe001461046357806384761dbb1461045e57806384b0196e14610459578063857749b0146104545780638cfd8f5c1461044f5780638da5cb5b1461044a5780638e539e8c14610445578063916b0dae1461044057806391ddadf41461043b5780639358928b14610436578063950c8a741461043157806395d89b411461042c5780639ab24eb0146104275780639bdb9812146104225780639f38369a1461041d578063a457c2d714610418578063a4c51df514610413578063a6c3d1651461040e578063a9059cbb14610409578063ac8da3c414610404578063b29a8140146103ff578063b353aaa7146103fa578063baf3292d146103f5578063c3cda520146103f0578063c4461834146103eb578063cbed8b9c146103e6578063d1deba1f146103e1578063d505accf146103dc578063dd62ed3e146103d7578063df2a5b3b146103d2578063e6a20ae6146103cd578063e9c80e63146103c8578063eab45d9c146103c3578063eaffd49a146103be578063eb8d72b7146103b9578063ed629c5c146103b4578063f1127ed8146103af578063f2fde38b146103aa578063f5ecbdbc146103a5578063f840edfd146103a0578063f8c8765e1461039b5763fc0c546a1461039657600080fd5b613099565b612fd5565b612f8f565b612ede565b612e59565b612dcf565b612dac565b612c68565b612be3565b612b81565b612a83565b612a67565b6129ba565b61295e565b61284b565b612725565b61265f565b612642565b612546565b6124b8565b612491565b61236d565b612340565b612316565b61218e565b6120fb565b612089565b611f8c565b611f41565b611edb565b611e32565b611e0b565b6109c8565b611ddf565b611d7b565b611c15565b611bee565b611ba4565b611b66565b611a6d565b611a01565b6119c3565b611957565b611923565b611802565b6117af565b61166a565b61162e565b6115e2565b6114dd565b61149d565b611439565b611413565b6113ac565b611175565b611135565b611092565b6110ae565b611037565b610fcf565b610fb2565b610f64565b610f2f565b610ed3565b610d2d565b610cca565b610bdc565b610bb9565b610b9d565b610add565b610a55565b6109e6565b610961565b610926565b6108f1565b610864565b610785565b6106c8565b6105dc565b6004359061ffff8216820361053257565b600080fd5b6024359061ffff8216820361053257565b9181601f84011215610532578235916001600160401b038311610532576020838186019501011161053257565b9060806003198301126105325760043561ffff8116810361053257916001600160401b039060243582811161053257816105b191600401610548565b9390939260443581811681036105325792606435918211610532576105d891600401610548565b9091565b34610532576105ea36610575565b91929493906106136106076106076001546001600160a01b031690565b6001600160a01b031690565b33036106b6576106396106348661ffff166000526002602052604060002090565b611794565b805190818814918215926106ad575b508115610689575b506106775761066761066f926106759736916112f4565b9236916112f4565b92613438565b005b604051634e2fa73d60e11b8152600490fd5b90506106963688856112f4565b602081519101209060208151910120141538610650565b15915038610648565b6040516313deb67160e21b8152600490fd5b346105325760203660031901126105325760043563ffffffff60e01b811680910361053257602090631f7ecdf760e01b811490811561070d575b506040519015158152f35b6301ffc9a760e01b14905038610702565b600091031261053257565b60005b83811061073c5750506000910152565b818101518382015260200161072c565b9060209161076581518092818552858086019101610729565b601f01601f1916010190565b90602061078292818152019061074c565b90565b34610532576000806003193601126108615760405181600c546107a7816116c5565b90818452602092600191828116908160001461083f57506001146107e6575b6107e2856107d6818903826112a9565b60405191829182610771565b0390f35b929450600c83527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c75b82841061082c57505050816107e2936107d69282010193386107c6565b805485850187015292850192810161080f565b60ff191686860152505050151560051b82010191506107d6816107e2386107c6565b80fd5b3461053257600060203660031901126108615761087f610521565b6108876142e4565b816001600160a01b036001541691823b156108dc57602461ffff918360405195869485936307e0db1760e01b85521660048401525af180156108d7576108cb575080f35b6108d4906111ef565b80f35b6130c9565b5080fd5b6001600160a01b0381160361053257565b346105325760403660031901126105325761091b600435610911816108e0565b6024359033614c32565b602060405160018152f35b346105325760403660031901126105325761ffff610942610521565b61094a6142e4565b166000526004602052602435604060002055600080f35b3461053257600060203660031901126108615761097c610521565b6109846142e4565b816001600160a01b036001541691823b156108dc57602461ffff918360405195869485936310ddb13760e01b85521660048401525af180156108d7576108cb575080f35b34610532576000366003190112610532576020600b54604051908152f35b346105325760603660031901126105325761091b600435610a06816108e0565b602435610a12816108e0565b60443591610a21833383614ccb565b61430a565b8015150361053257565b604090600319011261053257600435610a48816108e0565b9060243561078281610a26565b34610532577ffd7f6d25e7487e01d60c54f215c3a81bb6f973034cb26cf98baa0355fcc05f19610a8436610a30565b90610a8d6142e4565b6001600160a01b0381166000526017602052610ab98260406000209060ff801983541691151516179055565b604080516001600160a01b039092168252911515602082015290819081015b0390a1005b34610532576020366003190112610532576004353315610b8b57610b018133614407565b610b15610b1082600b54613d4a565b600b55565b336000818152600960209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a3610b6181336000614a6e565b600b546001600160e01b0310610b7a5761067590615318565b60405162b2ad6d60e71b8152600490fd5b6040516368ddad1f60e11b8152600490fd5b3461053257600036600319011261053257602060405160128152f35b34610532576000366003190112610532576020610bd46157e5565b604051908152f35b346105325760a036600319011261053257610bf5610521565b606435610c0181610a26565b608435906001600160401b03821161053257610c2d610c266040933690600401610548565b36916112f4565b92610c44610c3c604435613d7c565b602435613e02565b6001600160a01b036001541691610c7285519687958694859463040a7bb160e41b865230906004870161375b565b03915afa9081156108d7576000908192610c99575b50604080519182526020820192909252f35b9050610cbc915060403d8111610cc3575b610cb481836112a9565b810190613745565b9038610c87565b503d610caa565b3461053257604036600319011261053257600435610ce7816108e0565b33600052600a602052610d11816040600020906001600160a01b0316600052602052604060002090565b546024358101809111610d285761091b9133614c32565b6132de565b3461053257604036600319011261053257600435610d4a816108e0565b6024359065ffffffffffff610d5e43615cac565b16821015610e87576001600160a01b03166000526013602052604060002080549160008360058111610e36575b50905b838210610de157505081610dbe5750506107e260005b6040516001600160e01b0390911681529081906020820190565b6000908152602090206107e291610ddc9101600019015b5460201c90565b610da4565b9092610ded8185615adc565b90818363ffffffff610e13610e09848960005260206000200190565b5463ffffffff1690565b161115610e24575050925b90610d8e565b909450610e319150613d2e565b610e1e565b80610e46610e4c92969396615af1565b9061342b565b908263ffffffff610e67610e09858860005260206000200190565b161115610e775750925b38610d8b565b9350610e8290613d2e565b610e71565b60405163b95f42c360e01b8152600490fd5b9060406003198301126105325760043561ffff811681036105325791602435906001600160401b038211610532576105d891600401610548565b3461053257602061ffff610f20610ee936610e99565b9390911660005260028452610f0b610f126040600020604051928380926116ff565b03826112a9565b8481519101209236916112f4565b82815191012014604051908152f35b346105325760203660031901126105325761ffff610f4b610521565b1660005260046020526020604060002054604051908152f35b3461053257604036600319011261053257600435610f81816108e0565b6001600160a01b03601554163303610fa0576106759060243590613307565b604051638020644960e01b8152600490fd5b346105325760203660031901126105325761067560043533614f0f565b34610532576001600160a01b03610fe536610e99565b610fed6142e4565b6001549160009485931690813b15611033578361102195604051968795869485936342d65a8d60e01b8552600485016133ad565b03925af180156108d7576108cb575080f35b8380fd5b34610532576020366003190112610532576004356affffffffffffffffffffff81168103610532576110676142e4565b6001600160a01b03601654916affffffffffffffffffffff60a01b9060a01b16911617601655600080f35b3461053257600036600319011261053257602060405160008152f35b34610532576000366003190112610532574365ffffffffffff6110d043615cac565b1603611123576107e26040516110e581611207565b601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c74000000602082015260405191829160208352602083019061074c565b60405163d50637bf60e01b8152600490fd5b34610532576020366003190112610532576020600435611154816108e0565b6001600160a01b038091166000526012825260406000205416604051908152f35b34610532577f8f3675e5a31b083483e5a782db4130316da1e3c5fca72fc2398f59692286d8a56111a436610a30565b906111ad6142e4565b6001600160a01b0381166000526018602052610ab98260406000209060ff801983541691151516179055565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161120257604052565b6111d9565b604081019081106001600160401b0382111761120257604052565b602081019081106001600160401b0382111761120257604052565b608081019081106001600160401b0382111761120257604052565b60a081019081106001600160401b0382111761120257604052565b60e081019081106001600160401b0382111761120257604052565b60c081019081106001600160401b0382111761120257604052565b90601f801991011681019081106001600160401b0382111761120257604052565b604051906112d782611207565b565b6001600160401b03811161120257601f01601f191660200190565b929192611300826112d9565b9161130e60405193846112a9565b829481845281830111610532578281602093846000960137010152565b60606003198201126105325760043561ffff8116810361053257916024356001600160401b0392838211610532578060238301121561053257816024611376936004013591016112f4565b9160443590811681036105325790565b6020906113a0928260405194838680955193849201610729565b82019081520301902090565b3461053257602061140a61ffff6113e9836113c63661132b565b949091166000526006825260406000208260405194838680955193849201610729565b820190815203019020906001600160401b0316600052602052604060002090565b54604051908152f35b3461053257602036600319011261053257610675600435611433816108e0565b33614fc6565b34610532577f271a6c83d2d471fc3b7e0785e77e48c25259853378b45972025bdfa21af522f361146836610a30565b906114716142e4565b6001600160a01b038116600052601a602052610ab98260406000209060ff801983541691151516179055565b34610532576114ab36610575565b91929493903033036106b6576106676114c9926106759736916112f4565b926137a0565b908160609103126105325790565b60a0366003190112610532576004356114f5816108e0565b6114fd610537565b604435916084356001600160401b038111610532576115209036906004016114cf565b9081359161152d836108e0565b61154c610c26602083013592611542846108e0565b604081019061358f565b926115578486613cc8565b61156c611565606435613dcb565b5084613f9c565b9384156115d0577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a936115c361ffff936001600160a01b03936020966115ba6115b48b613d7c565b8d613e02565b9234938c613908565b60405195865216941692a4005b60405163329a734f60e21b8152600490fd5b34610532576020366003190112610532576001600160a01b03600435611607816108e0565b1660005260136020526020611620604060002054615d13565b63ffffffff60405191168152f35b34610532576020366003190112610532576020610bd4600435611650816108e0565b6001600160a01b0316600052600960205260406000205490565b3461053257600080600319360112610861576116846142e4565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90600182811c921680156116f5575b60208310146116df57565b634e487b7160e01b600052602260045260246000fd5b91607f16916116d4565b80546000939261170e826116c5565b9182825260209360019182811690816000146117755750600114611734575b5050505050565b90939495506000929192528360002092846000945b8386106117615750505050010190388080808061172d565b805485870183015294019385908201611749565b60ff19168685015250505090151560051b01019150388080808061172d565b906112d76117a892604051938480926116ff565b03836112a9565b346105325760203660031901126105325761ffff6117cb610521565b1660005260026020526107e2610f0b6117ee6040600020604051928380926116ff565b60405191829160208352602083019061074c565b60e03660031901126105325760043561181a816108e0565b611822610537565b604435916001600160401b039060843582811161053257611847903690600401610548565b9160a435848116948582036105325760c4359081116105325761186e9036906004016114cf565b936118b06118a8863592611881846108e0565b6118a061189660208a0135996115428b6108e0565b98909236916112f4565b9636916112f4565b968789613c1e565b6118be611565606435613dcb565b9586156115d0577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a95611907611910946001600160a01b03976119008b613d7c565b8d33613e48565b9234938a613908565b604051938452169261ffff1691602090a4005b3461053257604036600319011261053257610675600435611943816108e0565b60243590611952823383614ccb565b614f0f565b34610532576020366003190112610532577f4afb66c9bb6da7f9e6cbb478337238477302fef1901949e5cbc037b2db7cd342602060043561199781610a26565b61199f6142e4565b151560155460ff60d01b8260d01b169060ff60d01b191617601555604051908152a1005b34610532576020366003190112610532576001600160a01b036004356119e8816108e0565b1660005260106020526020604060002054604051908152f35b34610532576020366003190112610532577f12dcaec55ae8add66312d9a3feb1c94658903c007d895c262ce36355111ed1586020600435611a4181610a26565b611a496142e4565b151560155460ff60c81b8260c81b169060ff60c81b191617601555604051908152a1005b346105325760008060031936011261086157611b0a90611aac7f42454e2054455354000000000000000000000000000000000000000000000008615925565b90611ad67f3100000000000000000000000000000000000000000000000000000000000001615a1f565b9060405191611ae483611222565b818352611b18602091604051968796600f60f81b885260e08589015260e088019061074c565b90868203604088015261074c565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b828110611b4f57505050500390f35b835185528695509381019392810192600101611b40565b3461053257600036600319011261053257602060405160ff7f0000000000000000000000000000000000000000000000000000000000000008168152f35b3461053257604036600319011261053257602061140a611bc2610521565b61ffff611bcd610537565b91166000526003835260406000209061ffff16600052602052604060002090565b346105325760003660031901126105325760206001600160a01b0360005416604051908152f35b346105325760203660031901126105325760043565ffffffffffff611c3943615cac565b16811015610e87576014549060008260058111611d14575b50905b828210611cb1578280611c795750602060005b6040516001600160e01b039091168152f35b6014600052602090611cac907fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb01610dd5565b611c67565b9091611cbd8184615adc565b6014600052908263ffffffff611cf47fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610e09565b161115611d045750915b90611c54565b9250611d0f90613d2e565b611cfe565b80610e46611d2492959395615af1565b6014600052908263ffffffff611d5b7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610e09565b161115611d6b5750915b38611c51565b9250611d7690613d2e565b611d65565b34610532577febb4f87eb9202a817f9b6c9e7a0231dd4c8ac2717748763dd76852e2053b877d611daa36610a30565b90611db36142e4565b6001600160a01b0381166000526019602052610ab98260406000209060ff801983541691151516179055565b34610532576000366003190112610532576020611dfb43615cac565b65ffffffffffff60405191168152f35b346105325760003660031901126105325760206001600160a01b0360055416604051908152f35b34610532576000806003193601126108615760405181600d54611e54816116c5565b90818452602092600191828116908160001461083f5750600114611e82576107e2856107d6818903826112a9565b929450600d83527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb55b828410611ec857505050816107e2936107d69282010193386107c6565b8054858501870152928501928101611eab565b34610532576020366003190112610532576001600160a01b03600435611f00816108e0565b166000526013602052604060002080548015600014611f2757505060405160008152602090f35b602091611f38916000190190614d33565b5054811c611c67565b3461053257602060ff611f8061ffff6113e984611f5d3661132b565b949091166000526008825260406000208260405194838680955193849201610729565b54166040519015158152f35b346105325760208060031936011261053257611fc99061ffff611fad610521565b16600052600281526040611fd0816000208251948580926116ff565b03846112a9565b8251156120795782516013199384820190828211610d2857611ffc82611ff581613d20565b10156140e5565b6120098282511015614122565b8161202c575050506107e2925080519160008352820181525b5191829182610771565b839594955194601f8316801560051b91828289010195860101920101905b8084106120685750508352601f01601f191681526107e29250612022565b81518452928601929086019061204a565b5163344bb83560e11b8152600490fd5b34610532576040366003190112610532576004356120a6816108e0565b6024359033600052600a6020526120d4816040600020906001600160a01b0316600052602052604060002090565b54918083106120e95761091b92039033614c32565b604051634b81eea160e11b8152600490fd5b346105325760e036600319011261053257612114610521565b6001600160401b039060643582811161053257612135903690600401610548565b60849291923584811681036105325760a4359161215183610a26565b60c4359586116105325761216c61217c963690600401610548565b95909460443590602435906135c1565b60408051928352602083019190915290f35b346105325761219c36610e99565b91906121a66142e4565b6040519160208483828601376121d16034858781013060601b858201520360148101875201856112a9565b60009361ffff831685526002825260408520918151916001600160401b038311611202576122098361220386546116c5565b866133c8565b81601f841160011461228057508287989361226f9593612260937f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a92612275575b50508160011b916000199060031b1c19161790565b90555b604051938493846133ad565b0390a180f35b01519050388061224b565b9190601f19841661229686600052602060002090565b9389905b8282106122fe5750509260019285927f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a9b9661226f9896106122e5575b505050811b019055612263565b015160001960f88460031b161c191690553880806122d8565b8060018697829497870151815501960194019061229a565b346105325760403660031901126105325761091b600435612336816108e0565b602435903361430a565b3461053257602036600319011261053257610675600435612360816108e0565b6123686142e4565b6130d5565b346105325760403660031901126105325760043561238a816108e0565b6123926142e4565b6001600160a01b039061243f600092808454168480604051936020968786019463a9059cbb60e01b865260248701526024356044870152604486526123d68661123d565b1692604051946123e586611207565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af13d15612489573d91612424836112d9565b9261243260405194856112a9565b83523d878785013e61557b565b908151918215159182612469575b505090506124585780f35b60405162a4546b60e21b8152600490fd5b61247d9250806124819483010191016130b4565b1590565b80388061244d565b60609161557b565b346105325760003660031901126105325760206001600160a01b0360015416604051908152f35b34610532576020366003190112610532577f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b60206001600160a01b03600435612500816108e0565b6125086142e4565b16806001600160601b0360a01b6005541617600555604051908152a1005b6064359060ff8216820361053257565b6084359060ff8216820361053257565b346105325760c036600319011261053257600435612563816108e0565b60243590604435612572612526565b90804211612630576125e9916040519060208201927fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf84526001600160a01b03861660408401528660608401526080830152608082526125d182611258565b6125e460a43593608435935190206158ff565b61560c565b91612610836001600160a01b03166000526010602052604060002090815491600183019055565b0361261e5761067591614fc6565b60405163713f9ea160e01b8152600490fd5b60405163d52e1db560e01b8152600490fd5b346105325760003660031901126105325760206040516127108152f35b3461053257608036600319011261053257612678610521565b612680610537565b6064356001600160401b0381116105325761269f903690600401610548565b90926126a96142e4565b6001600160a01b036001541690813b156105325760008094612702604051978896879586946332fb62e760e21b865261ffff8092166004870152166024850152604435604485015260806064850152608484019161338c565b03925af180156108d75761271257005b8061271f610675926111ef565b8061071e565b61272e36610575565b90612770836127586127518997989961ffff166000526006602052604060002090565b888a613576565b906001600160401b0316600052602052604060002090565b5491821561067757826127843683856112f4565b6020815191012003612839577fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e59661ffff9661280e61282893876128076001600160401b039760006127f3846127588f6127ec9061ffff166000526006602052604060002090565b8a8c613576565b556127ff3687896112f4565b9336916112f4565b918a6137a0565b60405197889716875260806020880152608087019161338c565b9216604084015260608301520390a1005b6040516306f2f63960e21b8152600490fd5b346105325760e036600319011261053257600435612868816108e0565b602435612874816108e0565b60443590606435612883612536565b9080421161294c5761292b6128b4866001600160a01b03166000526010602052604060002090815491600183019055565b9260405160208101917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983526001600160a01b0394858a1696876040850152868916606085015289608085015260a084015260c083015260c0825261291882611273565b6125e460c4359360a435935190206158ff565b160361293a5761067592614c32565b6040516310454c9960e31b8152600490fd5b6040516363bef56160e11b8152600490fd5b3461053257604036600319011261053257602061140a600435612980816108e0565b6001600160a01b0360243591612995836108e0565b16600052600a83526040600020906001600160a01b0316600052602052604060002090565b34610532576060366003190112610532576129d3610521565b6129db610537565b90604435916129e86142e4565b8215612a55577f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09260609261ffff8091169283600052600360205282612a408260406000209061ffff16600052602052604060002090565b556040519384521660208301526040820152a1005b604051630731578760e41b8152600490fd5b3461053257600036600319011261053257602060405160018152f35b3461053257606036600319011261053257604435602435600435612aa683610a26565b612aae6142e4565b600a8102818104600a1482151715610d2857612710809111908115612b66575b50612b54576015805460ff60c01b94151560c081901b9590951664ffffffffff60a01b1990911660a084901b61ffff60a01b161760b085901b61ffff60b01b1617179055604080519182526020820192909252908101919091527f7294b4c7617e41cb925ae9440310fb23923aff0612102e0dbc68dab1b5b86c65908060608101610ad8565b604051630210e8d560e11b8152600490fd5b9050600a8302838104600a1484151715610d28571138612ace565b34610532576020366003190112610532577f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a46020600435612bc181610a26565b612bc96142e4565b151560ff196007541660ff821617600755604051908152a1005b346105325761010036600319011261053257612bfd610521565b6001600160401b039060243582811161053257612c1e903690600401610548565b919060443590848216820361053257608435612c39816108e0565b60c43595861161053257612c54610675963690600401610548565b94909360e4359660a4359460643593613656565b3461053257612c7636610e99565b9190612c806142e4565b60009161ffff8116835260206002815260408420906001600160401b03861161120257612cb786612cb184546116c5565b846133c8565b8490601f8711600114612d1857509461226f91612260828088997ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab9991612d0d575b508160011b916000199060031b1c19161790565b905087013538612cf9565b90601f198716612d2d84600052602060002090565b9287905b828210612d945750509161226f9391887ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab98999410612d7a575b5050600182811b019055612263565b860135600019600385901b60f8161c191690553880612d6b565b80600185968294968b01358155019501930190612d31565b3461053257600036600319011261053257602060ff600754166040519015158152f35b3461053257604036600319011261053257600435612dec816108e0565b63ffffffff602435818116810361053257612e35612e3b916001600160a01b03604095600060208851612e1e81611207565b828152015216600052601360205284600020614d33565b50614d61565b8251815190921682526020908101516001600160e01b031690820152f35b3461053257602036600319011261053257600435612e76816108e0565b612e7e6142e4565b6001600160a01b038091168015612ecc57600080546001600160a01b03198116831782559092167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b604051633a247dd760e11b8152600490fd5b3461053257608036600319011261053257612ef7610521565b6000612f01610537565b91612f0d6044356108e0565b60846001600160a01b0360015416936040519485938492633d7b2f6f60e21b845261ffff809216600485015216602483015230604483015260643560648301525afa80156108d7576107e291600091612f6e575b5060405191829182610771565b612f89913d8091833e612f8181836112a9565b81019061332e565b38612f61565b34610532576020366003190112610532576001600160a01b03600435612fb4816108e0565b612fbc6142e4565b166001600160601b0360a01b601b541617601b55600080f35b3461053257608036600319011261053257600435612ff2816108e0565b60243590612fff826108e0565b6044359061300c826108e0565b60643592613019846108e0565b60ff60155460d81c1661308857613059926130326142e4565b6001600160a01b03938492836001600160601b0360a01b95168560015416176001556130d5565b1690601b541617601b55600160d81b91166bffffffff00ffffffffffffff60a01b601554161717601555600080f35b60405162dc149f60e41b8152600490fd5b34610532576000366003190112610532576020604051308152f35b90816020910312610532575161078281610a26565b6040513d6000823e3d90fd5b6040516301ffc9a760e01b8152630d4d18e360e31b60048201526020816024816001600160a01b0386165afa9081156108d75760009161320b575b50156131f9576131d77f063dfd21e2b799ca4cb66556e57c360c6abc46f21805029c971f7475a96bd69a9161314d6016546001600160a01b031690565b61317461316d826001600160a01b03166000526019602052604060002090565b5460ff1690565b6131ea575b50601680546001600160a01b0319166001600160a01b0383161790556131b861247d61316d836001600160a01b03166000526019602052604060002090565b6131dc575b6040516001600160a01b0390911681529081906020820190565b0390a1565b6131e58161328a565b6131bd565b6131f390613239565b38613179565b604051639dcd44a360e01b8152600490fd5b61322c915060203d8111613232575b61322481836112a9565b8101906130b4565b38613110565b503d61321a565b60406001600160a01b037febb4f87eb9202a817f9b6c9e7a0231dd4c8ac2717748763dd76852e2053b877d92168060005260196020528160002060ff198154169055815190815260006020820152a1565b60406001600160a01b037febb4f87eb9202a817f9b6c9e7a0231dd4c8ac2717748763dd76852e2053b877d921680600052601960205281600020600160ff19825416179055815190815260016020820152a1565b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715610d2857565b8161331191614d83565b600b546001600160e01b0310610b7a5761332a90615318565b5050565b602081830312610532578051906001600160401b038211610532570181601f82011215610532578051613360816112d9565b9261336e60405194856112a9565b81845260208284010111610532576107829160208085019101610729565b908060209392818452848401376000828201840152601f01601f1916010190565b60409061ffff6107829593168152816020820152019161338c565b90601f81116133d657505050565b600091825260208220906020601f850160051c83019410613412575b601f0160051c01915b82811061340757505050565b8181556001016133fb565b90925082906133f2565b605019810191908211610d2857565b91908203918211610d2857565b9290916134aa5a604051633356ae4560e11b602082015261ffff8716602482015260806044820152906134a48261349661347560a483018a61074c565b6001600160401b03881660648401528281036023190160848401528861074c565b03601f1981018452836112a9565b30614299565b9390156134b8575050505050565b6134c1946134cb565b388080808061172d565b91936135687fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c956131d7939561ffff8151602083012096169586600052600660205261352f836113e960208b60406000208260405194838680955193849201610729565b556001600160401b03613554604051988998895260a060208a015260a089019061074c565b92166040870152858203606087015261074c565b90838203608085015261074c565b6020919283604051948593843782019081520301902090565b903590601e198136030182121561053257018035906001600160401b0382116105325760200191813603831361053257565b94926135e76040986135df6135ed936135f4989d9c969d36916112f4565b9436916112f4565b99613d7c565b9033613e48565b6001600160a01b03600154169161362285519788958694859463040a7bb160e41b865230906004870161375b565b03915afa9182156108d757600090819361363b57509190565b90506105d891925060403d8111610cc357610cb481836112a9565b989593909697989491943033036137335761ffff6001600160a01b039161367e87863061430a565b1692169283837fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf6020604051898152a3833b15610532576136f4996000998a96613716946001600160401b036040519e8f9d8e9c8d9a633fe79aed60e11b8c5260048c015260c060248c015260c48b019161338c565b95166044880152606487015260848601528483036003190160a486015261338c565b0393f180156108d7576137265750565b8061271f6112d7926111ef565b60405163b9984ab560e01b8152600490fd5b9190826040910312610532576020825192015190565b91926001600160a01b03610782969461ffff61378b9416855216602084015260a0604084015260a083019061074c565b9215156060820152608081840391015261074c565b92919060ff6137ae8461423e565b168061388f5750505060ff6137c28261423e565b1615801590613883575b613871576137e26137dc826141e6565b91614289565b906001600160a01b0380821615613867575b61385361384d7fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf93946001600160401b037f00000000000000000000000000000000000000000000000000000002540be40091166132f4565b846140c2565b60405190815292169261ffff1691602090a3565b61dead91506137f4565b6040516361072ce360e11b8152600490fd5b506029815114156137cc565b60010361389f576112d793613a6d565b60405163a0e89db160e01b8152600490fd5b926138d661078297959361ffff6138e49416865260c0602087015260c086019061074c565b90848203604086015261074c565b936001600160a01b03809216606084015216608082015260a081840391015261074c565b94611fc99193929561393761392b8261ffff166000526002602052604060002090565b604051948580926116ff565b8251156139cd57845161ffff821660005260046020526040600020549081156139c3575b116139b1576139756106076001546001600160a01b031690565b93843b15610532576000966139a091604051998a988997889662c5803160e81b8852600488016138b1565b03925af180156108d7576137265750565b6040516305dd299360e51b8152600490fd5b612710915061395b565b604051637af198bf60e01b8152600490fd5b989796929394613a3d956001600160401b03613a1960e099956001600160a01b03958e61ffff61010092168152816020820152019061074c565b961660408c015260608b015216608089015260a088015286820360c088015261074c565b930152565b6001600160401b03613a626040939695949660608452606084019061074c565b951660208201520152565b9091613a7884613eb6565b9091613aa261316d87612758613a9c8b61ffff166000526008602052604060002090565b8c611386565b91613ad86001600160401b0392837f00000000000000000000000000000000000000000000000000000002540be40091166132f4565b9288888b8315613bd4575b505050853b15613b895794613b2a96946134a4948a94613496948d99600014613b825750505a925b5a978b6040519a8b9863757fea4d60e11b60208b015260248a016139df565b9015613b77575090613b7261ffff928560207fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd88496975191012090604051948594169684613a42565b0390a2565b926112d794926134cb565b1692613b0b565b50506040516001600160a01b039094168452507f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9750919550859450506020840192506131d7915050565b90612758613c0992613c0389613bee613c16979b30613307565b9961ffff166000526008602052604060002090565b90611386565b805460ff19166001179055565b88888b613ae3565b9160ff60075416600014613cac576022825110613c9a5761ffff6022613c6893015193166000526003602052613c6260406000206001600052602052604060002090565b54613d4a565b908115613c885710613c7657565b6040516348c72e7d60e11b8152600490fd5b6040516379cebf6d60e11b8152600490fd5b6040516336dc4d9f60e11b8152600490fd5b50905051613cb657565b604051631beaad3f60e01b8152600490fd5b9060ff60075416600014613d17576022815110613c9a57602261ffff91015191166000526003602052613d08604060002060008052602052604060002090565b54908115613c885710613c7657565b905051613cb657565b90601f8201809211610d2857565b9060018201809211610d2857565b6051019081605111610d2857565b91908201809211610d2857565b634e487b7160e01b600052601260045260246000fd5b8115613d77570490565b613d57565b7f00000000000000000000000000000000000000000000000000000002540be400908115613d7757046001600160401b0390818111613db9571690565b604051630700491360e41b8152600490fd5b7f00000000000000000000000000000000000000000000000000000002540be4008015613d7757810690818103908111610d285791565b90604051916000602084015260218301526001600160401b0360c01b9060c01b16604182015260298152606081018181106001600160401b038211176112025760405290565b9392607192610782946001600160a01b03604051978895600160f81b602088015260218701526001600160401b0360c01b809460c01b16604187015216604985015260c01b166069830152613ea68151809260208686019101610729565b81010360518101845201826112a9565b90600160ff613ec48461423e565b160361387157613ed3826141e6565b90613edd83614289565b906049845110613f57576049840151936051815110613f1257613f0f605182015191613f09815161341c565b90614162565b91565b60405162461bcd60e51b815260206004820152601460248201527f746f55696e7436345f6f75744f66426f756e64730000000000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601560248201527f746f427974657333325f6f75744f66426f756e647300000000000000000000006044820152606490fd5b6001600160a01b038116903382036140b2575b8115614063576000818161405594613fc8878096614509565b84613fe6846001600160a01b03166000526009602052604060002090565b54613ff382821015614f3b565b03614011846001600160a01b03166000526009602052604060002090565b5561401f85600b5403600b55565b6040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081015b0390a3614a6e565b61405e81615449565b505090565b60405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b6140bd833383614ccb565b613faf565b816140cc91614d83565b600b546001600160e01b0310610b7a5761405e81615318565b156140ec57565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b1561412957565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b61416f82611ff581613d20565b614184815161417d84613d3c565b1115614122565b8161419c575050604051600081526020810160405290565b60405191601f8116916051831560051b80858701019484860193010101905b8084106141d35750508252601f01601f191660405290565b90928351815260208091019301906141bb565b60218151106141f957602d015160601c90565b60405162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e647300000000000000000000006044820152606490fd5b600181511061424e576001015190565b60405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606490fd5b6029815110613f12576029015190565b90929160008091604051956142ad8761128e565b6096875282602088019560a036883760208451940192f1903d90609682116142db575b6000908286523e9190565b609691506142d0565b6001600160a01b036000541633036142f857565b604051635fc483c560e01b8152600490fd5b91906001600160a01b03928381169384156143f557821680156143e357614332848484614610565b61434f826001600160a01b03166000526009602052604060002090565b54948486106143d157846112d7960361437b846001600160a01b03166000526009602052604060002090565b55614399846001600160a01b03166000526009602052604060002090565b8054860190556040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90806020810161404d565b60405163680c24ff60e11b8152600490fd5b6040516301ace2af60e11b8152600490fd5b6040516327903dcf60e01b8152600490fd5b60155460ff8160c81c16614421575b506112d79150614708565b60008052601960205260ff7fd2ac945fcc0096878c763e37d6929b78378c1a2defabde8ba7ee5ed1d6e7a5b254169061447061316d846001600160a01b03166000526019602052604060002090565b93614486610607601b546001600160a01b031690565b90813b156105325760405163019a898b60e01b81526000600482018190526001600160a01b038716602483015294151560448201529515156064870152608486015260e09190911c60ff1660021460a4850152839081838160c4810103925af19182156108d7576112d79215614416578061271f614503926111ef565b38614416565b60155460ff8160c81c16614523575b506112d791506148b5565b60ff614542836001600160a01b03166000526019602052604060002090565b5460008052601960205216906145777fd2ac945fcc0096878c763e37d6929b78378c1a2defabde8ba7ee5ed1d6e7a5b261316d565b9361458d610607601b546001600160a01b031690565b90813b156105325760405163019a898b60e01b81526001600160a01b038616600482015260006024820181905294151560448201529515156064870152608486015260e09190911c60ff1660021460a4850152839081838160c4810103925af19182156108d7576112d79215614518578061271f61460a926111ef565b38614518565b60155460ff8160c81c1661462a575b506112d792506149b0565b60ff614649836001600160a01b03166000526019602052604060002090565b54169061466c61316d856001600160a01b03166000526019602052604060002090565b94614682610607601b546001600160a01b031690565b90813b156105325760405163019a898b60e01b81526001600160a01b0380871660048301528716602482015293151560448501529515156064840152608483019590955260e01c60ff1660021460a482015292600090849081838160c4810103925af19283156108d7576112d7931561461f578061271f614702926111ef565b3861461f565b6015549060ff8260d01c168061487d575b6148605760ff8260c01c16918261484f575b5081614827575b50806147ec575b806147c4575b61474557565b6015805460ff60e01b1916600160e11b1790556147706106076106076016546001600160a01b031690565b803b156105325760008091600460405180948193630d4d18e360e31b83525af180156108d7576147b1575b506015805460ff60e01b1916600160e01b179055565b8061271f6147be926111ef565b3861479b565b506016546001600160a01b0381166000908152600960205260409020549060a01c111561473f565b5060008052601860205261482261247d7f999d26de3473317ead3eeaf34ca78057f1439db67b6953469c3c96ce9caf6bd761316d565b614739565b614849915061316d906001600160a01b03166000526017602052604060002090565b38614732565b60e01c60ff1660011491503861472b565b604051635504bc0760e01b815260006004820152602490fd5b0390fd5b5060008052601a6020526148b07fb75ecc04ed35f89790e98640e901bda41eceff0cb896cf2765fb69768025375061316d565b614719565b6015549060ff8260d01c168061498a575b6149675760ff8260c01c169182614956575b508161491c575b816148f1575b50806147c45761474557565b614916915061316d61247d916001600160a01b03166000526018602052604060002090565b386148e5565b60008052601760205290506149507fd840e16649f6b9a295d95876f4633d3a6b10b55e8162971cf78afd886d5ec89b61316d565b906148df565b60e01c60ff166001149150386148d8565b604051635504bc0760e01b81526001600160a01b03919091166004820152602490fd5b506149ab61316d826001600160a01b0316600052601a602052604060002090565b6148c6565b6015549160ff8360d01c1680614a48575b614a275760ff8360c01c169283614a16575b50826149ec575b50816148f15750806147c45761474557565b614a0f91925061316d906001600160a01b03166000526017602052604060002090565b90386149da565b60e01c60ff166001149250386149d3565b604051635504bc0760e01b81526001600160a01b0383166004820152602490fd5b50614a6961316d836001600160a01b0316600052601a602052604060002090565b6149c1565b91614a7a818385614f92565b6015549260ff8460c01c1680614c11575b614a96575b50505050565b614ab661316d826001600160a01b03166000526017602052604060002090565b80614be8575b15614b2f5750614b129250614aeb90614ae6614adf60155461ffff9060a01c1690565b61ffff1690565b614c21565b6015805460ff60e01b1916600160e11b179055906016546001600160a01b03165b9061430a565b6015805460ff60e01b1916600160e01b1790555b38808080614a90565b614b4f61316d846001600160a01b03166000526017602052604060002090565b9081614bbd575b50614b64575b505050614b26565b614b7c6127109161ffff614ba29560b01c16906132f4565b6015805460ff60e01b1916600160e11b17905504906000546001600160a01b0316614b0c565b6015805460ff60e01b1916600160e01b179055388080614b5c565b614be2915061316d61247d916001600160a01b03166000526018602052604060002090565b38614b56565b50614c0c61247d61316d856001600160a01b03166000526018602052604060002090565b614abc565b50600160ff8560e01c1614614a8b565b614c2e90612710926132f4565b0490565b90916001600160a01b03809216918215614cb9578316928315614ca757817f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592614c9d60209386600052600a85526040600020906001600160a01b0316600052602052604060002090565b55604051908152a3565b604051636c576ffb60e11b8152600490fd5b60405163bec36d8f60e01b8152600490fd5b906001600160a01b038216600052600a602052614cff816040600020906001600160a01b0316600052602052604060002090565b549260018401614d0f5750505050565b808410614d2157614b26930391614c32565b60405163b978877360e01b8152600490fd5b8054821015614d4b5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b90604051614d6e81611207565b602081935463ffffffff81168352811c910152565b906001600160a01b038216918215610b8b576015549260ff8460c81c16614e1b575b6112d79350614db382614708565b614dc2610b1084600b54613d4a565b614ddf826001600160a01b03166000526009602052604060002090565b8054840190556040518381526000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602090a36000614a6e565b600080526019602052614e4d7fd2ac945fcc0096878c763e37d6929b78378c1a2defabde8ba7ee5ed1d6e7a5b261316d565b93614e6e61316d846001600160a01b03166000526019602052604060002090565b94614e84610607601b546001600160a01b031690565b803b156105325760405163019a898b60e01b81526000600482018190526001600160a01b0387166024830152921515604482015296151560648801526084870186905260e09290921c60ff1660021460a487015290859081838160c4810103925af19384156108d7576112d794614efc575b50614da5565b8061271f614f09926111ef565b38614ef6565b906001600160a01b0382168015614063578160008481614f3694613fc88561332a99614509565b615449565b15614f4257565b60405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608490fd5b906112d792916001600160a01b03809116600052601260205280806040600020541692166000526040600020541690615037565b6112d7916001600160a01b03809216600092818452601260205280604085205416809260096020527f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60408720549660126020526040812094871694856001600160601b0360a01b82541617905580a45b91906001600160a01b038082169316838114158061524e575b61505a5750505050565b806150cd575b508261506d575b80614a90565b7fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724916150af6150b4926001600160a01b03166000526013602052604060002090565b6154c2565b60408051928352602083019190915290a2388080615067565b8060005260136020527fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724604060002080548015918260001461522b576151116112ca565b6000815260006020820152915b602083015161513d906001600160e01b03165b6001600160e01b031690565b926151488985615d78565b94159081615208575b50156151a6576151796151909261516786615c43565b92600019019060005260206000200190565b9063ffffffff82549181199060201b169116179055565b604080519182526020820192909252a238615060565b50615203906151ca6151c56151ba43615cac565b65ffffffffffff1690565b615d13565b906151fe6151d786615c43565b6151ee6151e26112ca565b63ffffffff9095168552565b6001600160e01b03166020840152565b6152be565b615190565b5163ffffffff16905063ffffffff6152226151ba43615cac565b91161438615151565b61524861524360001984018360005260206000200190565b614d61565b9161511e565b50821515615050565b60145490600160401b821015611202576001820180601455821015614d4b576014600052805160209182015190911b63ffffffff191663ffffffff91909116177fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec90910155565b8054600160401b811015611202576152db91600182018155614d33565b61530257815160209283015190921b63ffffffff191663ffffffff92909216919091179055565b634e487b7160e01b600052600060045260246000fd5b601454909181159182156154145761532e6112ca565b60008152600060208201525b602081015161535c90615355906001600160e01b0316615131565b9586615d85565b931590816153f1575b50156153a6576112d79061517961537b85615c43565b6014600052917fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb0190565b506112d76153b96151c56151ba43615cac565b6153ec6153c585615c43565b6153dc6153d06112ca565b63ffffffff9094168452565b6001600160e01b03166020830152565b615257565b5163ffffffff16905063ffffffff61540b6151ba43615cac565b91161438615365565b60146000526154447fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614d61565b61533a565b6014549091811591821561548d5761545f6112ca565b60008152600060208201525b602081015161535c90615486906001600160e01b0316615131565b9586615d78565b60146000526154bd7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614d61565b61546b565b90918154918215928360001461555e576154da6112ca565b60008152600060208201525b602081015161550890615501906001600160e01b0316615131565b9687615d85565b9415908161553b575b5015615527576151796112d79261516786615c43565b506112d7906151ca6151c56151ba43615cac565b5163ffffffff16905063ffffffff6155556151ba43615cac565b91161438615511565b61557661524360001983018460005260206000200190565b6154e6565b919290156155dd575081511561558f575090565b3b156155985790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156155f05750805190602001fd5b60405162461bcd60e51b81529081906148799060048301610771565b91610782939161561b93615763565b919091615643565b6005111561562d57565b634e487b7160e01b600052602160045260246000fd5b61564c81615623565b806156545750565b61565d81615623565b600181036156aa5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6156b381615623565b600281036157005760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b8061570c600392615623565b1461571357565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116157d95791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156108d75781516001600160a01b038116156157d3579190565b50600190565b50505050600090600390565b6001600160a01b037f000000000000000000000000a816136281aaccd541a39572914b8ae4164bd4db163014806158d6575b15615840577f77fd40eeeb8919d9d788a56b8536b0d74a4df608a0dc332b40d292165052286290565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f99150fbeb9fb882ed57616ff9bfef8992335a70b22e757956e2de5ceb8b8b74f60408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a081526158d08161128e565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000014614615817565b60429061590a6157e5565b906040519161190160f01b8352600283015260228201522090565b60ff81146159635760ff811690601f8211615951576040519161594783611207565b8252602082015290565b604051632cd44ac360e21b8152600490fd5b50604051600e54816000615976836116c5565b8083526020936001908181169081156159ff57506001146159a0575b5050610782925003826112a9565b90939150600e6000527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd936000915b8183106159e757505061078293508201013880615992565b855487840185015294850194869450918301916159cf565b91505061078294925060ff191682840152151560051b8201013880615992565b60ff8114615a415760ff811690601f8211615951576040519161594783611207565b50604051600f54816000615a54836116c5565b8083526020936001908181169081156159ff5750600114615a7d575050610782925003826112a9565b90939150600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802936000915b818310615ac457505061078293508201013880615992565b85548784018501529485019486945091830191615aac565b90808216911860011c8101809111610d285790565b8015615c2b5780615bc4615bbd615bb3615ba9615b9f615b95615b8b615b8160016107829a6000908b60801c80615c1f575b508060401c80615c12575b508060201c80615c05575b508060101c80615bf8575b508060081c80615beb575b508060041c80615bde575b508060021c80615bd1575b50821c615bca575b811c1b615b7a818b613d6d565b0160011c90565b615b7a818a613d6d565b615b7a8189613d6d565b615b7a8188613d6d565b615b7a8187613d6d565b615b7a8186613d6d565b615b7a8185613d6d565b8092613d6d565b90615c31565b8101615b6d565b6002915091019038615b65565b6004915091019038615b5a565b6008915091019038615b4f565b6010915091019038615b44565b6020915091019038615b39565b6040915091019038615b2e565b91505060809038615b23565b50600090565b9080821015615c3e575090565b905090565b6001600160e01b0390818111615c57571690565b60405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b6064820152608490fd5b65ffffffffffff90818111615cbf571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201526538206269747360d01b6064820152608490fd5b63ffffffff90818111615d24571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608490fd5b908103908111610d285790565b908101809111610d28579056fea2646970667358221220c913c0ad6c73dfc106df13cb46d9f1a7d463f6c66c767e2d67fa088f72ee323964736f6c63430008150033
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.