ERC-20
Overview
Max Total Supply
888,000,000,000 BEN TEST
Holders
12
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
29,551,460,721.201721523163479388 BEN TESTValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
BenCoinV2
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 900 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 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; // Using 1 & 2 instead of 0 to save gas when resetting uint8 private taxFlag = NOT_TAXING; address private buyTaxReceiver; 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 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", "BEN TEST", SHARED_DECIMALS) ERC20Permit("BEN TEST") {} function initialize( address _lzEndpoint, address _buyTaxReceiver, address _antiMEVStrategy, address _migrator, uint256 _buyTax, uint256 _sellTax, bool _isTaxingEnabled, bool _isAntiMEV, bool _isTransferBlacklisting ) external notInitialized onlyOwner { __OFTV2_init(_lzEndpoint); _setTax(_buyTax, _sellTax, _isTaxingEnabled); _setIsAntiMEV(_isAntiMEV); _setIsTransferBlacklisting(_isTransferBlacklisting); _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) { antiMEVStrategy.onTransfer(_from, _to, _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]) { 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]) { uint256 fee = _calcTax(buyTax, _amount); // Transfers from the receiver to the buy tax receiver for later selling taxFlag = TAXING; _transfer(_to, buyTaxReceiver, fee); taxFlag = NOT_TAXING; } else if (taxableContracts[_to] && !taxWhitelist[_from]) { uint256 fee = _calcTax(sellTax, _amount); // Transfers from taxable contracts (like LPs) to the admin directly taxFlag = TAXING; _transfer(_to, owner(), fee); taxFlag = NOT_TAXING; } } } function _calcTax(uint256 _tax, uint256 _amount) private pure returns (uint256 fees) { fees = (_amount * _tax) / FEE_DENOMINATOR; } function _setTax(uint256 _buyTax, uint256 _sellTax, bool _isTaxingEnabled) internal { // Cannot set tax higher than MAX_TAX (10%) if ((_buyTax * MAX_TAX > FEE_DENOMINATOR) || (_sellTax * MAX_TAX > FEE_DENOMINATOR)) { revert MaxTaxExceeded(); } buyTax = uint16(_buyTax); sellTax = uint16(_sellTax); isTaxingEnabled = _isTaxingEnabled; emit SetTax(_buyTax, _sellTax, _isTaxingEnabled); } function _setIsAntiMEV(bool _isAntiMEV) private { isAntiMEV = _isAntiMEV; emit SetIsAntiMEV(_isAntiMEV); } function _setIsTransferBlacklisting(bool _isBlacklisting) private { isBlacklisting = _isBlacklisting; emit SetIsTransferBlacklisting(_isBlacklisting); } function _setBuyTaxReceiver(address _buyTaxReceiver) private { if (!IERC165(_buyTaxReceiver).supportsInterface(type(IBuyTaxReceiver).interfaceId)) { revert InvalidBuyTaxReceiver(); } buyTaxReceiver = _buyTaxReceiver; emit SetBuyTaxReceiver(_buyTaxReceiver); } 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 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; } // Only used on Ethereum for the initial migration from BenV1 to BenV2 function mint(address _to, uint _amount) external onlyMigrator { _mint(_to, _amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; interface IAntiMevStrategy { function onTransfer(address from, address to, uint256 amount, bool isTaxingInProgress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; interface IBuyTaxReceiver { function swapCallback() external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ILayerZeroUserApplicationConfig.sol"; interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig { // @notice send a LayerZero message to the specified address at a LayerZero endpoint. // @param _dstChainId - the destination chain identifier // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains // @param _payload - a custom bytes payload to send to the destination contract // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // @notice used by the messaging library to publish verified payload // @param _srcChainId - the source chain identifier // @param _srcAddress - the source contract (as bytes) at the source chain // @param _dstAddress - the address on destination chain // @param _nonce - the unbound message ordering nonce // @param _gasLimit - the gas limit for external contract execution // @param _payload - verified payload to send to the destination contract function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external; // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64); // @notice get the outboundNonce from this source chain which, consequently, is always an EVM // @param _srcAddress - the source chain contract address function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64); // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery // @param _dstChainId - the destination chain identifier // @param _userApplication - the user app address on this EVM chain // @param _payload - the custom message to send over LayerZero // @param _payInZRO - if false, user app pays the protocol fee in native token // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee); // @notice get this Endpoint's immutable source identifier function getChainId() external view returns (uint16); // @notice the interface to retry failed message on this Endpoint destination // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address // @param _payload - the payload to be retried function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external; // @notice query if any STORED payload (message blocking) at the endpoint. // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool); // @notice query if the _libraryAddress is valid for sending msgs. // @param _userApplication - the user app address on this EVM chain function getSendLibraryAddress(address _userApplication) external view returns (address); // @notice query if the _libraryAddress is valid for receiving msgs. // @param _userApplication - the user app address on this EVM chain function getReceiveLibraryAddress(address _userApplication) external view returns (address); // @notice query if the non-reentrancy guard for send() is on // @return true if the guard is on. false otherwise function isSendingPayload() external view returns (bool); // @notice query if the non-reentrancy guard for receive() is on // @return true if the guard is on. false otherwise function isReceivingPayload() external view returns (bool); // @notice get the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _userApplication - the contract address of the user application // @param _configType - type of configuration. every messaging library has its own convention. function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory); // @notice get the send() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getSendVersion(address _userApplication) external view returns (uint16); // @notice get the lzReceive() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getReceiveVersion(address _userApplication) external view returns (uint16); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroReceiver { // @notice LayerZero endpoint will invoke this function to deliver the message on the destination // @param _srcChainId - the source endpoint identifier // @param _srcAddress - the source sending contract address from the source chain // @param _nonce - the ordered message nonce // @param _payload - the signed payload is the UA bytes has encoded to be sent function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _configType - type of configuration. every messaging library has its own convention. // @param _config - configuration in the bytes. can encode arbitrary content. function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external; // @notice set the send() LayerZero messaging library version to _version // @param _version - new messaging library version function setSendVersion(uint16 _version) external; // @notice set the lzReceive() LayerZero messaging library version to _version // @param _version - new messaging library version function setReceiveVersion(uint16 _version) external; // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload // @param _srcChainId - the chainId of the source chain // @param _srcAddress - the contract address of the source contract at the source chain function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../oz/access/Ownable.sol"; import "../interfaces/ILayerZeroReceiver.sol"; import "../interfaces/ILayerZeroUserApplicationConfig.sol"; import "../interfaces/ILayerZeroEndpoint.sol"; import "../util/BytesLib.sol"; /* * a generic LzReceiver implementation */ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig { using BytesLib for bytes; error LZAPPInvalidEndpointCaller(); error LZAPPInvalidSourceSendingContract(); error LZAPPInvalidDestinationChain(); error LZAPPInvalidMinGasLimit(); error LZAPPInvalidGasLimit(); error LZAPPInvalidAdapterParams(); error LZAPPInvalidPayloadSize(); error LZAPPNoTrustedPathRecord(); error LZAPPInvalidMinGas(); // ua can not send payload larger than this by default, but it can be changed by the ua owner uint constant public DEFAULT_PAYLOAD_SIZE_LIMIT = 10000; ILayerZeroEndpoint public lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup; mapping(uint16 => uint) public payloadSizeLimitLookup; address public precrime; event SetPrecrime(address precrime); event SetTrustedRemote(uint16 _remoteChainId, bytes _path); event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress); event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas); function __LzApp_init(address _endpoint) internal { lzEndpoint = ILayerZeroEndpoint(_endpoint); } function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override { // lzReceive must be called by the endpoint for security if (_msgSender() != address(lzEndpoint)) { revert LZAPPInvalidEndpointCaller(); } bytes memory trustedRemote = trustedRemoteLookup[_srcChainId]; // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. if ((_srcAddress.length != trustedRemote.length) || trustedRemote.length == 0 || keccak256(_srcAddress) != keccak256(trustedRemote)) { revert LZAPPInvalidSourceSendingContract(); } _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; if (trustedRemote.length == 0) { revert LZAPPInvalidDestinationChain(); } _checkPayloadSize(_dstChainId, _payload.length); lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams); } function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual { uint providedGasLimit = _getGasLimit(_adapterParams); uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas; if (minGasLimit == 0) { revert LZAPPInvalidMinGasLimit(); } if (providedGasLimit < minGasLimit) { revert LZAPPInvalidGasLimit(); } } function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) { if (_adapterParams.length < 34) { revert LZAPPInvalidAdapterParams(); } assembly { gasLimit := mload(add(_adapterParams, 34)) } } function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual { uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId]; if (payloadSizeLimit == 0) { // use default if not set payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT; } if (_payloadSize > payloadSizeLimit) { revert LZAPPInvalidPayloadSize(); } } //---------------------------UserApplication config---------------------------------------- function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) { return lzEndpoint.getConfig(_version, _chainId, address(this), _configType); } // generic config for LayerZero user Application function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner { lzEndpoint.setConfig(_version, _chainId, _configType, _config); } function setSendVersion(uint16 _version) external override onlyOwner { lzEndpoint.setSendVersion(_version); } function setReceiveVersion(uint16 _version) external override onlyOwner { lzEndpoint.setReceiveVersion(_version); } function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // _path = abi.encodePacked(remoteAddress, localAddress) // this function set the trusted path for the cross-chain communication function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner { trustedRemoteLookup[_remoteChainId] = _path; emit SetTrustedRemote(_remoteChainId, _path); } function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner { trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this)); emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress); } function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) { bytes memory path = trustedRemoteLookup[_remoteChainId]; if (path.length == 0) { revert LZAPPNoTrustedPathRecord(); } return path.slice(0, path.length - 20); // the last 20 bytes should be address(this) } function setPrecrime(address _precrime) external onlyOwner { precrime = _precrime; emit SetPrecrime(_precrime); } function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner { if (_minGas == 0) { revert LZAPPInvalidMinGas(); } minDstGasLookup[_dstChainId][_packetType] = _minGas; emit SetMinDstGas(_dstChainId, _packetType, _minGas); } // if the size is 0, it means default size limit function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner { payloadSizeLimitLookup[_dstChainId] = _size; } //--------------------------- VIEW FUNCTION ---------------------------------------- function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { bytes memory trustedSource = trustedRemoteLookup[_srcChainId]; return keccak256(trustedSource) == keccak256(_srcAddress); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LzApp.sol"; import "../util/ExcessivelySafeCall.sol"; /* * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress) */ abstract contract NonblockingLzApp is LzApp { using ExcessivelySafeCall for address; error LZAPPInvalidPayload(); function __NonblockingLzApp_init(address _endpoint) internal { __LzApp_init(_endpoint); } mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason); event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash); // overriding the virtual function in LzReceiver function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)); // try-catch all errors/exceptions if (!success) { _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason); } } function _storeFailedMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason) internal virtual { failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason); } function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual { // only internal transaction if (_msgSender() != address(this)) { revert LZAPPInvalidEndpointCaller(); } _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } //@notice override this function function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual { // assert there is message to retry bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce]; if (payloadHash == bytes32(0)) { revert LZAPPInvalidSourceSendingContract(); } if (keccak256(_payload) != payloadHash) { revert LZAPPInvalidPayload(); } // clear the stored message failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0); // execute the message. revert if it fails again _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./OFTCoreV2.sol"; import "./IOFTV2.sol"; import "../../../../oz/utils/introspection/ERC165.sol"; abstract contract BaseOFTV2 is OFTCoreV2, ERC165, IOFTV2 { constructor(uint8 _sharedDecimals) OFTCoreV2(_sharedDecimals) { } function __BaseOFTV2_init(address _lzEndpoint) internal { __OFTCoreV2_init(_lzEndpoint); } /************************************************************************ * public functions ************************************************************************/ function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) public payable virtual override { _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams); } function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) public payable virtual override { _sendAndCall(_from, _dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams); } /************************************************************************ * public view functions ************************************************************************/ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IOFTV2).interfaceId || super.supportsInterface(interfaceId); } function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams); } function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams); } function circulatingSupply() public view virtual override returns (uint); function token() public view virtual override returns (address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "../../../../oz/utils/introspection/IERC165.sol"; /** * @dev Interface of the IOFT core standard */ interface ICommonOFT is IERC165 { struct LzCallParams { address payable refundAddress; address zroPaymentAddress; bytes adapterParams; } /** * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) * _dstChainId - L0 defined chain id to send tokens too * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain * _amount - amount of the tokens to transfer * _useZro - indicates to use zro to pay L0 fees * _adapterParam - flexible bytes array to indicate messaging adapter services in L0 */ function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); /** * @dev returns the circulating amount of tokens on current chain */ function circulatingSupply() external view returns (uint); /** * @dev returns the address of the ERC20 token */ function token() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; interface IOFTReceiverV2 { /** * @dev Called by the OFT contract when tokens are received from source chain. * @param _srcChainId The chain id of the source chain. * @param _srcAddress The address of the OFT token contract on the source chain. * @param _nonce The nonce of the transaction on the source chain. * @param _from The address of the account who calls the sendAndCall() on the source chain. * @param _amount The amount of tokens to transfer. * @param _payload Additional data with no specified format. */ function onOFTReceived(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes32 _from, uint _amount, bytes calldata _payload) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ICommonOFT.sol"; /** * @dev Interface of the IOFT core standard */ interface IOFTV2 is ICommonOFT { /** * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` * `_from` the owner of token * `_dstChainId` the destination chain identifier * `_toAddress` can be any size depending on the `dstChainId`. * `_amount` the quantity of tokens in wei * `_refundAddress` the address LayerZero refunds if too much message fee is sent * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) * `_adapterParams` is a flexible bytes array to indicate messaging adapter services */ function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) external payable; function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../../lzApp/NonblockingLzApp.sol"; import "../../../util/ExcessivelySafeCall.sol"; import "./ICommonOFT.sol"; import "./IOFTReceiverV2.sol"; abstract contract OFTCoreV2 is NonblockingLzApp { using BytesLib for bytes; using ExcessivelySafeCall for address; error OFTCoreCallerMustBeOFTCore(); error OFTCoreUnknownPacketType(); error OFTCoreAmountZero(); error OFTCoreAdapterParamsNotAllowed(); error OFTCoreAmountSDOverflow(); error OFTCoreInvalidPayload(); uint public constant NO_EXTRA_GAS = 0; // packet type uint8 public constant PT_SEND = 0; uint8 public constant PT_SEND_AND_CALL = 1; uint8 public immutable sharedDecimals; bool public useCustomAdapterParams; mapping(uint16 => mapping(bytes => mapping(uint64 => bool))) public creditedPackets; /** * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`) * `_nonce` is the outbound nonce */ event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes32 indexed _toAddress, uint _amount); /** * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain. * `_nonce` is the inbound nonce. */ event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount); event SetUseCustomAdapterParams(bool _useCustomAdapterParams); event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash); event NonContractAddress(address _address); // _sharedDecimals should be the minimum decimals on all chains constructor(uint8 _sharedDecimals) { sharedDecimals = _sharedDecimals; } function __OFTCoreV2_init(address _lzEndpoint) internal { __NonblockingLzApp_init(_lzEndpoint); } /************************************************************************ * public functions ************************************************************************/ function callOnOFTReceived(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes32 _from, address _to, uint _amount, bytes calldata _payload, uint _gasForCall) public virtual { if (_msgSender() != address(this)) { revert OFTCoreCallerMustBeOFTCore(); } // send _amount = _transferFrom(address(this), _to, _amount); emit ReceiveFromChain(_srcChainId, _to, _amount); // call IOFTReceiverV2(_to).onOFTReceived{gas: _gasForCall}(_srcChainId, _srcAddress, _nonce, _from, _amount, _payload); } function setUseCustomAdapterParams(bool _useCustomAdapterParams) public virtual onlyOwner { useCustomAdapterParams = _useCustomAdapterParams; emit SetUseCustomAdapterParams(_useCustomAdapterParams); } /************************************************************************ * internal functions ************************************************************************/ function _estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes memory _adapterParams) internal view virtual returns (uint nativeFee, uint zroFee) { // mock the payload for sendFrom() bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount)); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function _estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes memory _payload, uint64 _dstGasForCall, bool _useZro, bytes memory _adapterParams) internal view virtual returns (uint nativeFee, uint zroFee) { // mock the payload for sendAndCall() bytes memory payload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(_amount), _payload, _dstGasForCall); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { uint8 packetType = _payload.toUint8(0); if (packetType == PT_SEND) { _sendAck(_srcChainId, _srcAddress, _nonce, _payload); } else if (packetType == PT_SEND_AND_CALL) { _sendAndCallAck(_srcChainId, _srcAddress, _nonce, _payload); } else { revert OFTCoreUnknownPacketType(); } } function _send(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual returns (uint amount) { _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS); (amount,) = _removeDust(_amount); amount = _debitFrom(_from, _dstChainId, _toAddress, amount); // amount returned should not have dust if (amount == 0) { revert OFTCoreAmountZero(); } bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount)); _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendToChain(_dstChainId, _from, _toAddress, amount); } function _sendAck(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual { (address to, uint64 amountSD) = _decodeSendPayload(_payload); if (to == address(0)) { to = address(0xdead); } uint amount = _sd2ld(amountSD); amount = _creditTo(_srcChainId, to, amount); emit ReceiveFromChain(_srcChainId, to, amount); } function _sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes memory _payload, uint64 _dstGasForCall, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual returns (uint amount) { _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall); (amount,) = _removeDust(_amount); amount = _debitFrom(_from, _dstChainId, _toAddress, amount); if (amount == 0) { revert OFTCoreAmountZero(); } // encode the msg.sender into the payload instead of _from bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall); _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendToChain(_dstChainId, _from, _toAddress, amount); } function _sendAndCallAck(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual { (bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload); bool credited = creditedPackets[_srcChainId][_srcAddress][_nonce]; uint amount = _sd2ld(amountSD); // credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds if (!credited) { amount = _creditTo(_srcChainId, address(this), amount); creditedPackets[_srcChainId][_srcAddress][_nonce] = true; } if (!_isContract(to)) { emit NonContractAddress(to); return; } // workaround for stack too deep uint16 srcChainId = _srcChainId; bytes memory srcAddress = _srcAddress; uint64 nonce = _nonce; bytes memory payload = _payload; bytes32 from_ = from; address to_ = to; uint amount_ = amount; bytes memory payloadForCall_ = payloadForCall; // no gas limit for the call if retry uint gas = credited ? gasleft() : gasForCall; (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.callOnOFTReceived.selector, srcChainId, srcAddress, nonce, from_, to_, amount_, payloadForCall_, gas)); if (success) { bytes32 hash = keccak256(payload); emit CallOFTReceivedSuccess(srcChainId, srcAddress, nonce, hash); } else { // store the failed message into the nonblockingLzApp _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason); } } function _isContract(address _account) internal view returns (bool) { return _account.code.length > 0; } function _checkAdapterParams(uint16 _dstChainId, uint16 _pkType, bytes memory _adapterParams, uint _extraGas) internal virtual { if (useCustomAdapterParams) { _checkGasLimit(_dstChainId, _pkType, _adapterParams, _extraGas); } else if (_adapterParams.length != 0) { revert OFTCoreAdapterParamsNotAllowed(); } } function _ld2sd(uint _amount) internal virtual view returns (uint64) { uint amountSD = _amount / _ld2sdRate(); if (amountSD > type(uint64).max) { revert OFTCoreAmountSDOverflow(); } return uint64(amountSD); } function _sd2ld(uint64 _amountSD) internal virtual view returns (uint) { return _amountSD * _ld2sdRate(); } function _removeDust(uint _amount) internal virtual view returns (uint amountAfter, uint dust) { dust = _amount % _ld2sdRate(); amountAfter = _amount - dust; } function _encodeSendPayload(bytes32 _toAddress, uint64 _amountSD) internal virtual view returns (bytes memory) { return abi.encodePacked(PT_SEND, _toAddress, _amountSD); } function _decodeSendPayload(bytes memory _payload) internal virtual view returns (address to, uint64 amountSD) { if (_payload.toUint8(0) != PT_SEND || _payload.length != 41) { revert OFTCoreInvalidPayload(); } to = _payload.toAddress(13); // drop the first 12 bytes of bytes32 amountSD = _payload.toUint64(33); } function _encodeSendAndCallPayload(address _from, bytes32 _toAddress, uint64 _amountSD, bytes memory _payload, uint64 _dstGasForCall) internal virtual view returns (bytes memory) { return abi.encodePacked( PT_SEND_AND_CALL, _toAddress, _amountSD, _addressToBytes32(_from), _dstGasForCall, _payload ); } function _decodeSendAndCallPayload(bytes memory _payload) internal virtual view returns (bytes32 from, address to, uint64 amountSD, bytes memory payload, uint64 dstGasForCall) { if (_payload.toUint8(0) != PT_SEND_AND_CALL) { revert OFTCoreInvalidPayload(); } to = _payload.toAddress(13); // drop the first 12 bytes of bytes32 amountSD = _payload.toUint64(33); from = _payload.toBytes32(41); dstGasForCall = _payload.toUint64(73); payload = _payload.slice(81, _payload.length - 81); } function _addressToBytes32(address _address) internal pure virtual returns (bytes32) { return bytes32(uint(uint160(_address))); } function _debitFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount) internal virtual returns (uint); function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual returns (uint); function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint); function _ld2sdRate() internal view virtual returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../../../oz/token/ERC20/ERC20.sol"; import "./BaseOFTV2.sol"; contract OFTV2 is BaseOFTV2, ERC20 { error OFTSharedDecimalsMustBeLessThanOrEqualToDecimals(uint8 sharedDecimals, uint8 decimals); uint internal immutable ld2sdRate; constructor(string memory _name, string memory _symbol, uint8 _sharedDecimals) ERC20(_name, _symbol) BaseOFTV2(_sharedDecimals) { uint8 decimals = decimals(); if (_sharedDecimals > decimals) { revert OFTSharedDecimalsMustBeLessThanOrEqualToDecimals(_sharedDecimals, decimals); } ld2sdRate = 10 ** (decimals - _sharedDecimals); } function __OFTV2_init(address _lzEndpoint) internal { __BaseOFTV2_init(_lzEndpoint); } /************************************************************************ * public functions ************************************************************************/ function circulatingSupply() public view virtual override returns (uint) { return totalSupply(); } function token() public view virtual override returns (address) { return address(this); } /************************************************************************ * internal functions ************************************************************************/ function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) { address spender = _msgSender(); if (_from != spender) _spendAllowance(_from, spender, _amount); _burn(_from, _amount); return _amount; } function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) { _mint(_toAddress, _amount); return _amount; } function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) { address spender = _msgSender(); // if transfer from this contract, no need to check allowance if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount); _transfer(_from, _to, _amount); return _amount; } function _ld2sdRate() internal view virtual override returns (uint) { return ld2sdRate; } }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.7.6; library ExcessivelySafeCall { uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := call( _gas, // gas _target, // recipient 0, // ether value add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeStaticCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal view returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := staticcall( _gas, // gas _target, // recipient add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /** * @notice Swaps function selectors in encoded contract calls * @dev Allows reuse of encoded calldata for functions with identical * argument types but different names. It simply swaps out the first 4 bytes * for the new selector. This function modifies memory in place, and should * only be used with caution. * @param _newSelector The new 4-byte selector * @param _buf The encoded contract args */ function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure { require(_buf.length >= 4); uint256 _mask = LOW_28_MASK; assembly { // load the first word of let _word := mload(add(_buf, 0x20)) // mask out the top 4 bytes // /x _word := and(_word, _mask) _word := or(_newSelector, _word) mstore(add(_buf, 0x20), _word) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); error OnlyOwner(); error NewOwnerIsZeroAddress(); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OnlyOwner(); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert NewOwnerIsZeroAddress(); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/IVotes.sol) pragma solidity ^0.8.0; /** * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts. * * _Available since v4.5._ */ interface IVotes { /** * @dev Emitted when an account changes their delegate. */ event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /** * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes. */ event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance); /** * @dev Returns the current amount of votes that `account` has. */ function getVotes(address account) external view returns (uint256); /** * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is * configured to use block numbers, this will return the value at the end of the corresponding block. */ function getPastVotes(address account, uint256 timepoint) external view returns (uint256); /** * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is * configured to use block numbers, this will return the value at the end of the corresponding block. * * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. * Votes that have not been delegated are still part of total supply, even though they would not participate in a * vote. */ function getPastTotalSupply(uint256 timepoint) external view returns (uint256); /** * @dev Returns the delegate that `account` has chosen. */ function delegates(address account) external view returns (address); /** * @dev Delegates votes from the sender to `delegatee`. */ function delegate(address delegatee) external; /** * @dev Delegates votes from signer to `delegatee`. */ function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5805.sol) pragma solidity ^0.8.0; import "../governance/utils/IVotes.sol"; import "./IERC6372.sol"; interface IERC5805 is IERC6372, IVotes {}
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC6372.sol) pragma solidity ^0.8.0; interface IERC6372 { /** * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting). */ function clock() external view returns (uint48); /** * @dev Description of the clock */ // solhint-disable-next-line func-name-mixedcase function CLOCK_MODE() external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { error ERC20DecreasedAllowanceBelowZero(); error ERC20TransferToZeroAddress(); error ERC20TransferFromZeroAddress(); error ERC20TransferExceedsBalance(); error ERC20MintToZeroAddress(); error ERC20ApproveFromZeroAddress(); error ERC20ApproveToZeroAddress(); error ERC20TransferExceedsAllowance(); mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); if (currentAllowance < subtractedValue) { revert ERC20DecreasedAllowanceBelowZero(); } unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { if (from == address(0)) { revert ERC20TransferFromZeroAddress(); } if (to == address(0)) { revert ERC20TransferToZeroAddress(); } _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; if (fromBalance < amount) { revert ERC20TransferExceedsBalance(); } unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { if (account == address(0)) { revert ERC20MintToZeroAddress(); } _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { if (owner == address(0)) { revert ERC20ApproveFromZeroAddress(); } if (spender == address(0)) { revert ERC20ApproveToZeroAddress(); } _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < amount) { revert ERC20TransferExceedsAllowance(); } unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.0; import "./IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/cryptography/EIP712.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; error ERC20PermitExpired(); error ERC20PermitInvalidSignature(); mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { if (block.timestamp > deadline) { revert ERC20PermitExpired(); } bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); if (signer != owner) { revert ERC20PermitInvalidSignature(); } _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Votes.sol) pragma solidity ^0.8.0; import "./ERC20Permit.sol"; import "../../../interfaces/IERC5805.sol"; import "../../../utils/math/Math.sol"; import "../../../utils/math/SafeCast.sol"; import "../../../utils/cryptography/ECDSA.sol"; /** * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's, * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1. * * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module. * * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting * power can be queried through the public accessors {getVotes} and {getPastVotes}. * * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked. * * _Available since v4.2._ */ abstract contract ERC20Votes is ERC20Permit, IERC5805 { struct Checkpoint { uint32 fromBlock; uint224 votes; } error ERC20VotesBrokenClock(); error ERC20VotesSupplyOverflow(); error ERC20VotesFutureLookup(); error ERC20VotesSignatureExpired(); error ERC20VotesInvalidNonce(); bytes32 private constant _DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); mapping(address => address) private _delegates; mapping(address => Checkpoint[]) private _checkpoints; Checkpoint[] private _totalSupplyCheckpoints; /** * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting). */ function clock() public view virtual override returns (uint48) { return SafeCast.toUint48(block.number); } /** * @dev Description of the clock */ // solhint-disable-next-line func-name-mixedcase function CLOCK_MODE() public view virtual override returns (string memory) { // Check that the clock was not modified if (clock() != block.number) { revert ERC20VotesBrokenClock(); } return "mode=blocknumber&from=default"; } /** * @dev Get the `pos`-th checkpoint for `account`. */ function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) { return _checkpoints[account][pos]; } /** * @dev Get number of checkpoints for `account`. */ function numCheckpoints(address account) public view virtual returns (uint32) { return SafeCast.toUint32(_checkpoints[account].length); } /** * @dev Get the address `account` is currently delegating to. */ function delegates(address account) public view virtual override returns (address) { return _delegates[account]; } /** * @dev Gets the current votes balance for `account` */ function getVotes(address account) public view virtual override returns (uint256) { uint256 pos = _checkpoints[account].length; unchecked { return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes; } } /** * @dev Retrieve the number of votes for `account` at the end of `timepoint`. * * Requirements: * * - `timepoint` must be in the past */ function getPastVotes(address account, uint256 timepoint) public view virtual override returns (uint256) { if (timepoint >= clock()) { revert ERC20VotesFutureLookup(); } return _checkpointsLookup(_checkpoints[account], timepoint); } /** * @dev Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances. * It is NOT the sum of all the delegated votes! * * Requirements: * * - `timepoint` must be in the past */ function getPastTotalSupply(uint256 timepoint) public view virtual override returns (uint256) { if (timepoint >= clock()) { revert ERC20VotesFutureLookup(); } return _checkpointsLookup(_totalSupplyCheckpoints, timepoint); } /** * @dev Lookup a value in a list of (sorted) checkpoints. */ function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 timepoint) private view returns (uint256) { // We run a binary search to look for the last (most recent) checkpoint taken before (or at) `timepoint`. // // Initially we check if the block is recent to narrow the search range. // During the loop, the index of the wanted checkpoint remains in the range [low-1, high). // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant. // - If the middle checkpoint is after `timepoint`, we look in [low, mid) // - If the middle checkpoint is before or equal to `timepoint`, we look in [mid+1, high) // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not // out of bounds (in which case we're looking too far in the past and the result is 0). // Note that if the latest checkpoint available is exactly for `timepoint`, we end up with an index that is // past the end of the array, so we technically don't find a checkpoint after `timepoint`, but it works out // the same. uint256 length = ckpts.length; uint256 low = 0; uint256 high = length; if (length > 5) { uint256 mid = length - Math.sqrt(length); if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) { high = mid; } else { low = mid + 1; } } while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) { high = mid; } else { low = mid + 1; } } unchecked { return high == 0 ? 0 : _unsafeAccess(ckpts, high - 1).votes; } } /** * @dev Delegate votes from the sender to `delegatee`. */ function delegate(address delegatee) public virtual override { _delegate(_msgSender(), delegatee); } /** * @dev Delegates votes from signer to `delegatee` */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public virtual override { if (block.timestamp > expiry) { revert ERC20VotesSignatureExpired(); } address signer = ECDSA.recover( _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))), v, r, s ); if (nonce != _useNonce(signer)) { revert ERC20VotesInvalidNonce(); } _delegate(signer, delegatee); } /** * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1). */ function _maxSupply() internal view virtual returns (uint224) { return type(uint224).max; } /** * @dev Snapshots the totalSupply after it has been increased. */ function _mint(address account, uint256 amount) internal virtual override { super._mint(account, amount); if (totalSupply() > _maxSupply()) { revert ERC20VotesSupplyOverflow(); } _writeCheckpoint(_totalSupplyCheckpoints, _add, amount); } /** * @dev Snapshots the totalSupply after it has been decreased. */ function _burn(address account, uint256 amount) internal virtual override { super._burn(account, amount); _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount); } /** * @dev Move voting power when tokens are transferred. * * Emits a {IVotes-DelegateVotesChanged} event. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); } /** * @dev Change delegation for `delegator` to `delegatee`. * * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}. */ function _delegate(address delegator, address delegatee) internal virtual { address currentDelegate = delegates(delegator); uint256 delegatorBalance = balanceOf(delegator); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveVotingPower(currentDelegate, delegatee, delegatorBalance); } function _moveVotingPower(address src, address dst, uint256 amount) private { if (src != dst && amount > 0) { if (src != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount); emit DelegateVotesChanged(src, oldWeight, newWeight); } if (dst != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount); emit DelegateVotesChanged(dst, oldWeight, newWeight); } } } function _writeCheckpoint( Checkpoint[] storage ckpts, function(uint256, uint256) view returns (uint256) op, uint256 delta ) private returns (uint256 oldWeight, uint256 newWeight) { uint256 pos = ckpts.length; unchecked { Checkpoint memory oldCkpt = pos == 0 ? Checkpoint(0, 0) : _unsafeAccess(ckpts, pos - 1); oldWeight = oldCkpt.votes; newWeight = op(oldWeight, delta); if (pos > 0 && oldCkpt.fromBlock == clock()) { _unsafeAccess(ckpts, pos - 1).votes = SafeCast.toUint224(newWeight); } else { ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(clock()), votes: SafeCast.toUint224(newWeight)})); } } } function _add(uint256 a, uint256 b) private pure returns (uint256) { return a + b; } function _subtract(uint256 a, uint256 b) private pure returns (uint256) { return a - b; } /** * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds. */ function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) { assembly { mstore(0, ckpts.slot) result.slot := add(keccak256(0, 0x20), pos) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; error SafeERC20ApproveFromNonZeroToNonZeroAllowance(); error SafeERC20DecreaseAllowanceBelowZero(); error SafeERC20PermitInvalidNonce(); error SafeERC20ERC20OperationFailed(); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' if ((value != 0) && (token.allowance(address(this), spender) != 0)) { revert SafeERC20ApproveFromNonZeroToNonZeroAllowance(); } _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); if (oldAllowance < value) { revert SafeERC20DecreaseAllowanceBelowZero(); } _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); if (nonceAfter != nonceBefore + 1) { revert SafeERC20PermitInvalidNonce(); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20ERC20OperationFailed(); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; import "./ECDSA.sol"; import "../ShortStrings.sol"; import "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * _Available since v3.4._ * * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _name.toStringWithFallback(_nameFallback), _version.toStringWithFallback(_versionFallback), block.chainid, address(this), bytes32(0), new uint256[](0) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol) pragma solidity ^0.8.8; import "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(_FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 900, "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":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_minDstGas","type":"uint256"}],"name":"SetMinDstGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"precrime","type":"address"}],"name":"SetPrecrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"buyTax","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sellTax","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isTaxing","type":"bool"}],"name":"SetTax","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"whitelist","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"SetTaxWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"taxableContract","type":"address"},{"indexed":false,"internalType":"bool","name":"isTaxable","type":"bool"}],"name":"SetTaxableContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"blacklist","type":"address"},{"indexed":false,"internalType":"bool","name":"isBlacklisted","type":"bool"}],"name":"SetTransferBlacklist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_path","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"SetTrustedRemoteAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"SetUseCustomAdapterParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"CLOCK_MODE","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_PAYLOAD_SIZE_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NO_EXTRA_GAS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT_SEND","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PT_SEND_AND_CALL","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes32","name":"_from","type":"bytes32"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_payload","type":"bytes"},{"internalType":"uint256","name":"_gasForCall","type":"uint256"}],"name":"callOnOFTReceived","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32","name":"pos","type":"uint32"}],"name":"checkpoints","outputs":[{"components":[{"internalType":"uint32","name":"fromBlock","type":"uint32"},{"internalType":"uint224","name":"votes","type":"uint224"}],"internalType":"struct ERC20Votes.Checkpoint","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"circulatingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clock","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"creditedPackets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_payload","type":"bytes"},{"internalType":"uint64","name":"_dstGasForCall","type":"uint64"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendAndCallFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"failedMessages","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"forceResumeReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timepoint","type":"uint256"}],"name":"getPastTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timepoint","type":"uint256"}],"name":"getPastVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getTrustedRemoteAddress","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"address","name":"_buyTaxReceiver","type":"address"},{"internalType":"address","name":"_antiMEVStrategy","type":"address"},{"internalType":"address","name":"_migrator","type":"address"},{"internalType":"uint256","name":"_buyTax","type":"uint256"},{"internalType":"uint256","name":"_sellTax","type":"uint256"},{"internalType":"bool","name":"_isTaxingEnabled","type":"bool"},{"internalType":"bool","name":"_isAntiMEV","type":"bool"},{"internalType":"bool","name":"_isTransferBlacklisting","type":"bool"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"setPayloadSizeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_precrime","type":"address"}],"name":"setPrecrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_buyTax","type":"uint256"},{"internalType":"uint256","name":"_sellTax","type":"uint256"},{"internalType":"bool","name":"_isTaxingEnabled","type":"bool"}],"name":"setTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_whitelist","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setTaxWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_taxableContract","type":"address"},{"internalType":"bool","name":"_isTaxable","type":"bool"}],"name":"setTaxableContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_blacklist","type":"address"},{"internalType":"bool","name":"_isBlacklisted","type":"bool"}],"name":"setTransferBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"setUseCustomAdapterParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sharedDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useCustomAdapterParams","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101a0604081815234620004895762000018826200048e565b600882526020918281016710915388151154d560c21b8082528351936200003f856200048e565b60088552818686015280519162000056836200048e565b60088352868301528051956200006c876200048e565b6001808852603160f81b82890190815260008054336001600160a01b031982168117835591969295939291906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08880a3600860805288516001600160401b0399908a8111620003a457600c54918483811c931680156200047e575b8784101462000385578190601f938481116200042a575b508790848311600114620003c4578a92620003b8575b5050600019600383901b1c191690841b17600c555b8151918a8311620003a457600d548481811c9116801562000399575b8782101462000385578281116200033c575b5085918311600114620002d6579282939183928994620002ca575b50501b916000199060031b1c191617600d555b6402540be40060a052620001a286620004c0565b94610160958652620001b4896200069d565b966101809788525190209261012098848a5251902093610140948086524660e0528251938401947f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f86528385015260608401524660808401523060a084015260a0835260c083019783891090891117620002b6575086905251902060c052306101009081526015805460ff60e01b1916600160e01b179055615f9a95908662000856873960805186611acb015260a05186818161398101528181613c9001528181613fd5015261403d015260c0518661597c015260e05186615a370152518561594d015251846159cb015251836159f1015251826119d3015251816119fd0152f35b634e487b7160e01b81526041600452602490fd5b0151925038806200017b565b600d8852858820919083601f1981168a5b89888383106200032457505050106200030a575b505050811b01600d556200018e565b015160001960f88460031b161c19169055388080620002fb565b868601518855909601959485019487935001620002e7565b600d89528689208380860160051c8201928987106200037b575b0160051c019085905b8281106200036f57505062000160565b8a81550185906200035f565b9250819262000356565b634e487b7160e01b89526022600452602489fd5b90607f16906200014e565b634e487b7160e01b88526041600452602488fd5b0151905038806200011d565b600c8b52888b208794509190601f1984168c5b8b828210620004135750508411620003f9575b505050811b01600c5562000132565b015160001960f88460031b161c19169055388080620003ea565b8385015186558a97909501949384019301620003d7565b909150600c8a52878a208480850160051c8201928a861062000474575b918891869594930160051c01915b8281106200046557505062000107565b8c815585945088910162000455565b9250819262000447565b92607f1692620000f0565b600080fd5b604081019081106001600160401b03821117620004aa57604052565b634e487b7160e01b600052604160045260246000fd5b8051602090818110156200055d5750601f825111620004fc5780825192015190808310620004ed57501790565b82600019910360031b1b161790565b90604051809263305a27a960e01b82528060048301528251908160248401526000935b82851062000543575050604492506000838284010152601f80199101168101030190fd5b84810182015186860160440152938101938593506200051f565b906001600160401b038211620004aa57600e54926001938481811c9116801562000692575b838210146200067c57601f811162000642575b5081601f8411600114620005d65750928293918392600094620005ca575b50501b916000199060031b1c191617600e5560ff90565b015192503880620005b3565b919083601f198116600e60005284600020946000905b888383106200062757505050106200060d575b505050811b01600e5560ff90565b015160001960f88460031b161c19169055388080620005ff565b858701518855909601959485019487935090810190620005ec565b600e60005284601f84600020920160051c820191601f860160051c015b8281106200066f57505062000595565b600081550185906200065f565b634e487b7160e01b600052602260045260246000fd5b90607f169062000582565b8051602090818110156200072b5750601f825111620006ca5780825192015190808310620004ed57501790565b90604051809263305a27a960e01b82528060048301528251908160248401526000935b82851062000711575050604492506000838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350620006ed565b906001600160401b038211620004aa57600f54926001938481811c911680156200084a575b838210146200067c57601f811162000810575b5081601f8411600114620007a4575092829391839260009462000798575b50501b916000199060031b1c191617600f5560ff90565b01519250388062000781565b919083601f198116600f60005284600020946000905b88838310620007f55750505010620007db575b505050811b01600f5560ff90565b015160001960f88460031b161c19169055388080620007cd565b858701518855909601959485019487935090810190620007ba565b600f60005284601f84600020920160051c820191601f860160051c015b8281106200083d57505062000763565b600081550185906200082d565b90607f16906200075056fe6080604052600436101561001257600080fd5b60003560e01c80621d3567146104ec57806301ffc9a7146104e757806306fdde03146104e257806307e0db17146104dd578063095ea7b3146104d85780630df37483146104d357806310ddb137146104ce57806318160ddd1461041557806323b872dd146104c95780632518d450146104c4578063313ce567146104bf5780633644e515146104ba578063365260b4146104b557806339509351146104b05780633a46b1a8146104ab5780633d8b38f6146104a65780633f1f4fa4146104a157806340c10f191461049c57806342966c681461049757806342d65a8d1461049257806344770515146104885780634bf5d7e91461048d5780634c42899a14610488578063587cde1e146104835780635afde0631461047e5780635b8c41e6146104795780635c19a95c1461047457806363cd3c691461046f57806366ad5c8a1461046a578063695ef6bf146104655780636fcfff451461046057806370a082311461045b578063715018a6146104565780637533d7881461045157806376203b481461044c57806379cc6790146104475780637c9242e8146104425780637ecebe001461043d57806384761dbb1461043857806384b0196e14610433578063857749b01461042e5780638cfd8f5c146104295780638da5cb5b146104245780638e539e8c1461041f57806391ddadf41461041a5780639358928b14610415578063950c8a741461041057806395d89b411461040b5780639ab24eb0146104065780639bdb9812146104015780639f38369a146103fc578063a457c2d7146103f7578063a4c51df5146103f2578063a6c3d165146103ed578063a9059cbb146103e8578063ac8da3c4146103e3578063b29a8140146103de578063b353aaa7146103d9578063b81181d4146103d4578063baf3292d146103cf578063c3cda520146103ca578063c4461834146103c5578063cbed8b9c146103c0578063d1deba1f146103bb578063d505accf146103b6578063dd62ed3e146103b1578063df2a5b3b146103ac578063e6a20ae6146103a7578063e9c80e63146103a2578063eab45d9c1461039d578063eaffd49a14610398578063eb8d72b714610393578063ed629c5c1461038e578063f1127ed814610389578063f2fde38b14610384578063f5ecbdbc1461037f578063f840edfd1461037a5763fc0c546a1461037557600080fd5b61306a565b613026565b612f5c565b612ec0565b612e3a565b612e17565b612cd2565b612c4c565b612bea565b612bb7565b612b9b565b612ad6565b612a7a565b612937565b6127f7565b612717565b6126fa565b6125ce565b612542565b612407565b6123e0565b61228a565b61225d565b612233565b6120aa565b612016565b611f8c565b611e76565b611e2b565b611dc5565b611d1c565b611cf5565b610a2e565b611cc9565b611b60565b611b39565b611aef565b611ab1565b6119b8565b61198b565b61194d565b611920565b6118ec565b6117ca565b611777565b611633565b6115f5565b6115a9565b61148b565b61144b565b6113e7565b6113c1565b611359565b611118565b6110d8565b61101d565b611039565b610f9c565b610f7f565b610f19565b610ee4565b610e88565b610ccd565b610c6a565b610b7b565b610b58565b610b3c565b610abb565b610a4c565b6109ae565b610973565b61093e565b610898565b6107b9565b6106ca565b6105ae565b6004359061ffff8216820361050257565b600080fd5b6024359061ffff8216820361050257565b9181601f840112156105025782359167ffffffffffffffff8311610502576020838186019501011161050257565b9060806003198301126105025760043561ffff81168103610502579167ffffffffffffffff90602435828111610502578161058391600401610518565b9390939260443581811681036105025792606435918211610502576105aa91600401610518565b9091565b34610502576105bc36610546565b91929493906105e56105d96105d96001546001600160a01b031690565b6001600160a01b031690565b33036106a05761060b6106068661ffff166000526002602052604060002090565b61175c565b80519081881491821592610697575b508115610673575b5061064957610639610641926106479736916112a0565b9236916112a0565b92613543565b005b60046040517f9c5f4e7a000000000000000000000000000000000000000000000000000000008152fd5b90506106803688856112a0565b602081519101209060208151910120141538610622565b1591503861061a565b60046040517f4f7ad9c4000000000000000000000000000000000000000000000000000000008152fd5b34610502576020366003190112610502576004357fffffffff00000000000000000000000000000000000000000000000000000000811680910361050257807f1f7ecdf70000000000000000000000000000000000000000000000000000000060209214908115610741575b506040519015158152f35b6301ffc9a760e01b91501438610736565b600091031261050257565b60005b8381106107705750506000910152565b8181015183820152602001610760565b906020916107998151809281855285808601910161075d565b601f01601f1916010190565b9060206107b6928181520190610780565b90565b34610502576000806003193601126108955760405181600c546107db8161168d565b908184526020926001918281169081600014610873575060011461081a575b6108168561080a81890382611253565b604051918291826107a5565b0390f35b929450600c83527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c75b82841061086057505050816108169361080a9282010193386107fa565b8054858501870152928501928101610843565b60ff191686860152505050151560051b820101915061080a81610816386107fa565b80fd5b346105025760006020366003190112610895576108b36104f1565b6108bb614591565b816001600160a01b036001541691823b1561092957602461ffff918360405195869485937f07e0db170000000000000000000000000000000000000000000000000000000085521660048401525af1801561092457610918575080f35b61092190611192565b80f35b6132f2565b5080fd5b6001600160a01b0381160361050257565b346105025760403660031901126105025761096860043561095e8161092d565b6024359033614d3f565b602060405160018152f35b346105025760403660031901126105025761ffff61098f6104f1565b610997614591565b166000526004602052602435604060002055600080f35b346105025760006020366003190112610895576109c96104f1565b6109d1614591565b816001600160a01b036001541691823b1561092957602461ffff918360405195869485937f10ddb1370000000000000000000000000000000000000000000000000000000085521660048401525af1801561092457610918575080f35b34610502576000366003190112610502576020600b54604051908152f35b3461050257606036600319011261050257610968600435610a6c8161092d565b602435610a788161092d565b60443591610a87833383614e08565b6145cf565b8015150361050257565b604090600319011261050257600435610aae8161092d565b906024356107b681610a8c565b34610502577ffd7f6d25e7487e01d60c54f215c3a81bb6f973034cb26cf98baa0355fcc05f19610aea36610a96565b90610af3614591565b6001600160a01b0381166000526017602052610b1f8260406000209060ff801983541691151516179055565b604080516001600160a01b039290921682529115156020820152a1005b3461050257600036600319011261050257602060405160128152f35b34610502576000366003190112610502576020610b73615943565b604051908152f35b346105025760a036600319011261050257610b946104f1565b606435610ba081610a8c565b6084359067ffffffffffffffff821161050257610bcd610bc66040933690600401610518565b36916112a0565b92610be4610bdc604435613fd3565b602435614072565b6001600160a01b036001541691610c1285519687958694859463040a7bb160e41b86523090600487016138b4565b03915afa908115610924576000908192610c39575b50604080519182526020820192909252f35b9050610c5c915060403d8111610c63575b610c548183611253565b81019061389e565b9038610c27565b503d610c4a565b3461050257604036600319011261050257600435610c878161092d565b33600052600a602052610cb1816040600020906001600160a01b0316600052602052604060002090565b546024358101809111610cc8576109689133614d3f565b613085565b3461050257604036600319011261050257600435610cea8161092d565b6024359065ffffffffffff610cfe43615e52565b16821015610e23576001600160a01b03166000526013602052604060002080549160008360058111610dd2575b50905b838210610d7d57505081610d555750506001600160e01b0360005b60405191168152602090f35b6000908152602090206001600160e01b0391610d789101600019015b5460201c90565b610d49565b9092610d898185615c6d565b90818363ffffffff610daf610da5848960005260206000200190565b5463ffffffff1690565b161115610dc0575050925b90610d2e565b909450610dcd9150613f85565b610dba565b80610de2610de892969396615c82565b90613536565b908263ffffffff610e03610da5858860005260206000200190565b161115610e135750925b38610d2b565b9350610e1e90613f85565b610e0d565b60046040517fb95f42c3000000000000000000000000000000000000000000000000000000008152fd5b9060406003198301126105025760043561ffff8116810361050257916024359067ffffffffffffffff8211610502576105aa91600401610518565b3461050257602061ffff610ed5610e9e36610e4d565b9390911660005260028452610ec0610ec76040600020604051928380926116c7565b0382611253565b8481519101209236916112a0565b82815191012014604051908152f35b346105025760203660031901126105025761ffff610f006104f1565b1660005260046020526020604060002054604051908152f35b3461050257604036600319011261050257600435610f368161092d565b6001600160a01b03601554163303610f555761064790602435906133e7565b60046040517f80206449000000000000000000000000000000000000000000000000000000008152fd5b346105025760203660031901126105025761064760043533615030565b34610502576001600160a01b03610fb236610e4d565b610fba614591565b6001549160009485931690813b15611019578361100795604051968795869485937f42d65a8d000000000000000000000000000000000000000000000000000000008552600485016134b8565b03925af1801561092457610918575080f35b8380fd5b3461050257600036600319011261050257602060405160008152f35b34610502576000366003190112610502574365ffffffffffff61105b43615e52565b16036110ae57610816604051611070816111ab565b601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c740000006020820152604051918291602083526020830190610780565b60046040517fd50637bf000000000000000000000000000000000000000000000000000000008152fd5b346105025760203660031901126105025760206004356110f78161092d565b6001600160a01b038091166000526012825260406000205416604051908152f35b34610502577f8f3675e5a31b083483e5a782db4130316da1e3c5fca72fc2398f59692286d8a561114736610a96565b90611150614591565b6001600160a01b0381166000526018602052610b1f8260406000209060ff801983541691151516179055565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff81116111a657604052565b61117c565b6040810190811067ffffffffffffffff8211176111a657604052565b6020810190811067ffffffffffffffff8211176111a657604052565b6080810190811067ffffffffffffffff8211176111a657604052565b60a0810190811067ffffffffffffffff8211176111a657604052565b60e0810190811067ffffffffffffffff8211176111a657604052565b60c0810190811067ffffffffffffffff8211176111a657604052565b90601f8019910116810190811067ffffffffffffffff8211176111a657604052565b60405190611282826111ab565b565b67ffffffffffffffff81116111a657601f01601f191660200190565b9291926112ac82611284565b916112ba6040519384611253565b829481845281830111610502578281602093846000960137010152565b60606003198201126105025760043561ffff81168103610502579160243567ffffffffffffffff92838211610502578060238301121561050257816024611323936004013591016112a0565b9160443590811681036105025790565b60209061134d92826040519483868095519384920161075d565b82019081520301902090565b346105025760206113b861ffff61139683611373366112d7565b94909116600052600682526040600020826040519483868095519384920161075d565b8201908152030190209067ffffffffffffffff16600052602052604060002090565b54604051908152f35b34610502576020366003190112610502576106476004356113e18161092d565b33615101565b34610502577f271a6c83d2d471fc3b7e0785e77e48c25259853378b45972025bdfa21af522f361141636610a96565b9061141f614591565b6001600160a01b0381166000526019602052610b1f8260406000209060ff801983541691151516179055565b346105025761145936610546565b91929493903033036106a057610639611477926106479736916112a0565b926138f9565b908160609103126105025790565b60a0366003190112610502576004356114a38161092d565b6114ab610507565b6044359160843567ffffffffffffffff8111610502576114cf90369060040161147d565b908135916114dc8361092d565b6114fb610bc66020830135926114f18461092d565b60408101906136b5565b926115068486613f1f565b61151b61151460643561403b565b5084614229565b93841561157f577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a9361157261ffff936001600160a01b03936020966115696115638b613fd3565b8d614072565b9234938c613a92565b60405195865216941692a4005b60046040517fca69cd3c000000000000000000000000000000000000000000000000000000008152fd5b34610502576020366003190112610502576001600160a01b036004356115ce8161092d565b16600052601360205260206115e7604060002054615ecf565b63ffffffff60405191168152f35b34610502576020366003190112610502576001600160a01b0360043561161a8161092d565b1660005260096020526020604060002054604051908152f35b34610502576000806003193601126108955761164d614591565b806001600160a01b0381546001600160a01b031981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90600182811c921680156116bd575b60208310146116a757565b634e487b7160e01b600052602260045260246000fd5b91607f169161169c565b8054600093926116d68261168d565b91828252602093600191828116908160001461173d57506001146116fc575b5050505050565b90939495506000929192528360002092846000945b838610611729575050505001019038808080806116f5565b805485870183015294019385908201611711565b60ff19168685015250505090151560051b0101915038808080806116f5565b9061128261177092604051938480926116c7565b0383611253565b346105025760203660031901126105025761ffff6117936104f1565b166000526002602052610816610ec06117b66040600020604051928380926116c7565b604051918291602083526020830190610780565b60e0366003190112610502576004356117e28161092d565b6117ea610507565b6044359167ffffffffffffffff9060843582811161050257611810903690600401610518565b9160a435848116948582036105025760c4359081116105025761183790369060040161147d565b9361187961187186359261184a8461092d565b61186961185f60208a0135996114f18b61092d565b98909236916112a0565b9636916112a0565b968789613e15565b61188761151460643561403b565b95861561157f577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a956118d06118d9946001600160a01b03976118c98b613fd3565b8d336140c8565b9234938a613a92565b604051938452169261ffff1691602090a4005b346105025760403660031901126105025761064760043561190c8161092d565b6024359061191b823383614e08565b615030565b346105025760203660031901126105025761064760043561194081610a8c565b611948614591565b613263565b34610502576020366003190112610502576001600160a01b036004356119728161092d565b1660005260106020526020604060002054604051908152f35b34610502576020366003190112610502576106476004356119ab81610a8c565b6119b3614591565b6131ea565b346105025760008060031936011261089557611a55906119f77f0000000000000000000000000000000000000000000000000000000000000000615a9e565b90611a217f0000000000000000000000000000000000000000000000000000000000000000615bb0565b9060405191611a2f836111c7565b818352611a63602091604051968796600f60f81b885260e08589015260e0880190610780565b908682036040880152610780565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b828110611a9a57505050500390f35b835185528695509381019392810192600101611a8b565b3461050257600036600319011261050257602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346105025760403660031901126105025760206113b8611b0d6104f1565b61ffff611b18610507565b91166000526003835260406000209061ffff16600052602052604060002090565b346105025760003660031901126105025760206001600160a01b0360005416604051908152f35b346105025760203660031901126105025760043565ffffffffffff611b8443615e52565b16811015610e23576014549060008260058111611c62575b50905b828210611bfb578280611bc35750602060005b6001600160e01b0360405191168152f35b6014600052602090611bf6907fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb01610d71565b611bb2565b9091611c078184615c6d565b601460005290818363ffffffff611c3f7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8401610da5565b161115611c50575050915b90611b9f565b909350611c5d9150613f85565b611c4a565b80610de2611c7292959395615c82565b6014600052908263ffffffff611ca97fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610da5565b161115611cb95750915b38611b9c565b9250611cc490613f85565b611cb3565b34610502576000366003190112610502576020611ce543615e52565b65ffffffffffff60405191168152f35b346105025760003660031901126105025760206001600160a01b0360055416604051908152f35b34610502576000806003193601126108955760405181600d54611d3e8161168d565b9081845260209260019182811690816000146108735750600114611d6c576108168561080a81890382611253565b929450600d83527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb55b828410611db257505050816108169361080a9282010193386107fa565b8054858501870152928501928101611d95565b34610502576020366003190112610502576001600160a01b03600435611dea8161092d565b166000526013602052604060002080548015600014611e1157505060405160008152602090f35b602091611e22916000190190614e88565b5054811c611bb2565b3461050257602060ff611e6a61ffff61139684611e47366112d7565b94909116600052600882526040600020826040519483868095519384920161075d565b54166040519015158152f35b346105025760208060031936011261050257611eb39061ffff611e976104f1565b16600052600281526040611eba816000208251948580926116c7565b0384611253565b825115611f635782516013199384820190828211610cc857611ee682611edf81613f77565b1015614371565b611ef382825110156143bc565b81611f1657505050610816925080519160008352820181525b51918291826107a5565b839594955194601f8316801560051b91828289010195860101920101905b808410611f525750508352601f01601f191681526108169250611f0c565b815184529286019290860190611f34565b600490517f6897706a000000000000000000000000000000000000000000000000000000008152fd5b3461050257604036600319011261050257600435611fa98161092d565b6024359033600052600a602052611fd7816040600020906001600160a01b0316600052602052604060002090565b5491808310611fec5761096892039033614d3f565b60046040517f9703dd42000000000000000000000000000000000000000000000000000000008152fd5b346105025760e03660031901126105025761202f6104f1565b67ffffffffffffffff9060643582811161050257612051903690600401610518565b60849291923584811681036105025760a4359161206d83610a8c565b60c43595861161050257612088612098963690600401610518565b95909460443590602435906136e8565b60408051928352602083019190915290f35b34610502576120b836610e4d565b91906120c2614591565b6040519160208483828601376120ed6034858781013060601b85820152036014810187520185611253565b60009361ffff8316855260028252604085209181519167ffffffffffffffff83116111a65761212683612120865461168d565b866134d3565b81601f841160011461219d57508287989361218c959361217d937f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a92612192575b50508160011b916000199060031b1c19161790565b90555b604051938493846134b8565b0390a180f35b015190503880612168565b9190601f1984166121b386600052602060002090565b9389905b82821061221b5750509260019285927f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a9b9661218c989610612202575b505050811b019055612180565b015160001960f88460031b161c191690553880806121f5565b806001869782949787015181550196019401906121b7565b34610502576040366003190112610502576109686004356122538161092d565b60243590336145cf565b346105025760203660031901126105025761064760043561227d8161092d565b612285614591565b6132fe565b34610502576040366003190112610502576004356122a78161092d565b6122af614591565b6001600160a01b039061237560009280845416848060405193602096878601947fa9059cbb000000000000000000000000000000000000000000000000000000008652602487015260243560448701526044865261230c866111e3565b16926040519461231b866111ab565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af13d156123d8573d9161235a83611284565b926123686040519485611253565b83523d878785013e6156bf565b9081519182151591826123b8575b5050905061238e5780f35b60046040517f029151ac000000000000000000000000000000000000000000000000000000008152fd5b6123cc9250806123d09483010191016132dd565b1590565b803880612383565b6060916156bf565b346105025760003660031901126105025760206001600160a01b0360015416604051908152f35b3461050257610120366003190112610502576004356124258161092d565b602435906124328261092d565b6044359061243f8261092d565b6064359061244c8261092d565b60c43561245881610a8c565b60e4359361246585610a8c565b6101043561247281610a8c565b60ff60155460d81c16612518577b01000000000000000000000000000000000000000000000000000000966122856124de926119486119b3996124b3614591565b6001600160a01b039a8b98896001600160a01b03199b168b600154161760015560a4356084356130ae565b1690601a541617601a55167fffffffff00ffffffffffffff0000000000000000000000000000000000000000601554161717601555600080f35b60046040517f0dc149f0000000000000000000000000000000000000000000000000000000008152fd5b34610502576020366003190112610502577f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b60206001600160a01b0360043561258a8161092d565b612592614591565b16806001600160a01b03196005541617600555604051908152a1005b6064359060ff8216820361050257565b6084359060ff8216820361050257565b346105025760c0366003190112610502576004356125eb8161092d565b602435906044356125fa6125ae565b908042116126d057612671916040519060208201927fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf84526001600160a01b0386166040840152866060840152608083015260808252612659826111ff565b61266c60a4359360843593519020615a5d565b61574f565b91612698836001600160a01b03166000526010602052604060002090815491600183019055565b036126a65761064791615101565b60046040517f713f9ea1000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd52e1db5000000000000000000000000000000000000000000000000000000008152fd5b346105025760003660031901126105025760206040516127108152f35b34610502576080366003190112610502576127306104f1565b612738610507565b60643567ffffffffffffffff811161050257612758903690600401610518565b9092612762614591565b6001600160a01b036001541690813b1561050257600080946127d4604051978896879586947fcbed8b9c00000000000000000000000000000000000000000000000000000000865261ffff80921660048701521660248501526044356044850152608060648501526084840191613497565b03925af18015610924576127e457005b806127f161064792611192565b80610752565b61280036610546565b906128438361282a6128238997989961ffff166000526006602052604060002090565b888a61369c565b9067ffffffffffffffff16600052602052604060002090565b5491821561064957826128573683856112a0565b602081519101200361290d577fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e59661ffff966128e26128fc93876128db67ffffffffffffffff9760006128c78461282a8f6128c09061ffff166000526006602052604060002090565b8a8c61369c565b556128d33687896112a0565b9336916112a0565b918a6138f9565b604051978897168752608060208801526080870191613497565b9216604084015260608301520390a1005b60046040517f1bcbd8e4000000000000000000000000000000000000000000000000000000008152fd5b346105025760e0366003190112610502576004356129548161092d565b6024356129608161092d565b6044359060643561296f6125be565b90804211612a5057612a176129a0866001600160a01b03166000526010602052604060002090815491600183019055565b9260405160208101917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983526001600160a01b0394858a1696876040850152868916606085015289608085015260a084015260c083015260c08252612a048261121b565b61266c60c4359360a43593519020615a5d565b1603612a265761064792614d3f565b60046040517f822a64c8000000000000000000000000000000000000000000000000000000008152fd5b60046040517fc77deac2000000000000000000000000000000000000000000000000000000008152fd5b346105025760403660031901126105025760206113b8600435612a9c8161092d565b6001600160a01b0360243591612ab18361092d565b16600052600a83526040600020906001600160a01b0316600052602052604060002090565b3461050257606036600319011261050257612aef6104f1565b612af7610507565b9060443591612b04614591565b8215612b71577f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09260609261ffff8091169283600052600360205282612b5c8260406000209061ffff16600052602052604060002090565b556040519384521660208301526040820152a1005b60046040517f73157870000000000000000000000000000000000000000000000000000000008152fd5b3461050257600036600319011261050257602060405160018152f35b3461050257606036600319011261050257610647604435612bd781610a8c565b612bdf614591565b6024356004356130ae565b34610502576020366003190112610502577f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a46020600435612c2a81610a8c565b612c32614591565b151560ff196007541660ff821617600755604051908152a1005b346105025761010036600319011261050257612c666104f1565b67ffffffffffffffff9060243582811161050257612c88903690600401610518565b919060443590848216820361050257608435612ca38161092d565b60c43595861161050257612cbe610647963690600401610518565b94909360e4359660a435946064359361377d565b3461050257612ce036610e4d565b9190612cea614591565b60009161ffff81168352602060028152604084209067ffffffffffffffff86116111a657612d2286612d1c845461168d565b846134d3565b8490601f8711600114612d8357509461218c9161217d828088997ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab9991612d78575b508160011b916000199060031b1c19161790565b905087013538612d64565b90601f198716612d9884600052602060002090565b9287905b828210612dff5750509161218c9391887ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab98999410612de5575b5050600182811b019055612180565b860135600019600385901b60f8161c191690553880612dd6565b80600185968294968b01358155019501930190612d9c565b3461050257600036600319011261050257602060ff600754166040519015158152f35b3461050257604036600319011261050257600435612e578161092d565b63ffffffff6024358181168103610502576020612eae612ea86001600160e01b03936001600160a01b036040976000868a51612e92816111ab565b8281520152166000526013845286600020614e88565b50614eb6565b84519381511684520151166020820152f35b3461050257602036600319011261050257600435612edd8161092d565b612ee5614591565b6001600160a01b038091168015612f32576000918254826001600160a01b03198216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60046040517f7448fbae000000000000000000000000000000000000000000000000000000008152fd5b3461050257608036600319011261050257612f756104f1565b6000612f7f610507565b91612f8b60443561092d565b60846001600160a01b03600154169360405194859384927ff5ecbdbc00000000000000000000000000000000000000000000000000000000845261ffff809216600485015216602483015230604483015260643560648301525afa80156109245761081691600091613005575b50604051918291826107a5565b613020913d8091833e6130188183611253565b810190613438565b38612ff8565b34610502576020366003190112610502576001600160a01b0360043561304b8161092d565b613053614591565b166001600160a01b0319601a541617601a55600080f35b34610502576000366003190112610502576020604051308152f35b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715610cc857565b600a8102818104600a1482151715610cc8576127108091119081156131cf575b506131a5576015805478ff00000000000000000000000000000000000000000000000094151560c081901b959095167fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff90911675ffff000000000000000000000000000000000000000060a085901b161777ffff0000000000000000000000000000000000000000000060b086901b1617179055604080519182526020820192909252908101919091527f7294b4c7617e41cb925ae9440310fb23923aff0612102e0dbc68dab1b5b86c659080606081015b0390a1565b60046040517f0421d1aa000000000000000000000000000000000000000000000000000000008152fd5b9050600a8302838104600a1484151715610cc85711386130ce565b60207f12dcaec55ae8add66312d9a3feb1c94658903c007d895c262ce36355111ed1589115156015547fffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffff79ff000000000000000000000000000000000000000000000000008360c81b16911617601555604051908152a1565b60207f4afb66c9bb6da7f9e6cbb478337238477302fef1901949e5cbc037b2db7cd3429115156015547fffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffff7aff00000000000000000000000000000000000000000000000000008360d01b16911617601555604051908152a1565b9081602091031261050257516107b681610a8c565b6040513d6000823e3d90fd5b6001600160a01b0381166040516301ffc9a760e01b8152630d4d18e360e31b6004820152602081602481855afa908115610924576000916133b9575b501561338f57601680546001600160a01b03191690911790556040516001600160a01b0390911681527f063dfd21e2b799ca4cb66556e57c360c6abc46f21805029c971f7475a96bd69a9080602081016131a0565b60046040517f9dcd44a3000000000000000000000000000000000000000000000000000000008152fd5b6133da915060203d81116133e0575b6133d28183611253565b8101906132dd565b3861333a565b503d6133c8565b816133f191614ed8565b6001600160e01b03600b541161340e5761340a9061545f565b5050565b60046040517f5956b680000000000000000000000000000000000000000000000000000000008152fd5b6020818303126105025780519067ffffffffffffffff8211610502570181601f8201121561050257805161346b81611284565b926134796040519485611253565b81845260208284010111610502576107b6916020808501910161075d565b908060209392818452848401376000828201840152601f01601f1916010190565b60409061ffff6107b695931681528160208201520191613497565b90601f81116134e157505050565b600091825260208220906020601f850160051c8301941061351d575b601f0160051c01915b82811061351257505050565b818155600101613506565b90925082906134fd565b605019810191908211610cc857565b91908203918211610cc857565b9290916135cf5a604051907f66ad5c8a00000000000000000000000000000000000000000000000000000000602083015261ffff87166024830152608060448301526135c9826135bb61359960a483018a610780565b67ffffffffffffffff8816606484015282810360231901608484015288610780565b03601f198101845283611253565b30614546565b9390156135dd575050505050565b6135e6946135f0565b38808080806116f5565b919361368e7fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c956131a0939561ffff815160208301209616958660005260066020526136548361139660208b6040600020826040519483868095519384920161075d565b5567ffffffffffffffff61367a604051988998895260a060208a015260a0890190610780565b921660408701528582036060870152610780565b908382036080850152610780565b6020919283604051948593843782019081520301902090565b903590601e1981360301821215610502570180359067ffffffffffffffff82116105025760200191813603831361050257565b949261370e6040986137066137149361371b989d9c969d36916112a0565b9436916112a0565b99613fd3565b90336140c8565b6001600160a01b03600154169161374985519788958694859463040a7bb160e41b86523090600487016138b4565b03915afa91821561092457600090819361376257509190565b90506105aa91925060403d8111610c6357610c548183611253565b989593909697989491943033036138745761ffff6001600160a01b03916137a58786306145cf565b1692169283837fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf6020604051898152a3833b1561050257613835996000998a966138579467ffffffffffffffff6040519e8f9d8e9c8d9a7f7fcf35da000000000000000000000000000000000000000000000000000000008c5260048c015260c060248c015260c48b0191613497565b95166044880152606487015260848601528483036003190160a4860152613497565b0393f18015610924576138675750565b806127f161128292611192565b60046040517fb9984ab5000000000000000000000000000000000000000000000000000000008152fd5b9190826040910312610502576020825192015190565b91926001600160a01b036107b6969461ffff6138e49416855216602084015260a0604084015260a0830190610780565b92151560608201526080818403910152610780565b92919060ff613907846144e2565b1680613a015750505060ff61391b826144e2565b16158015906139f5575b6139cb5761393b6139358261448b565b91614536565b906001600160a01b03808216156139c1575b6139ad6139a77fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf939467ffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000911661309b565b8461434e565b60405190815292169261ffff1691602090a3565b61dead915061394d565b60046040517fc20e59c6000000000000000000000000000000000000000000000000000000008152fd5b50602981511415613925565b600103613a115761128293613c43565b60046040517fa0e89db1000000000000000000000000000000000000000000000000000000008152fd5b92613a606107b697959361ffff613a6e9416865260c0602087015260c0860190610780565b908482036040860152610780565b936001600160a01b03809216606084015216608082015260a0818403910152610780565b94611eb391939295613ac1613ab58261ffff166000526002602052604060002090565b604051948580926116c7565b825115613b8957845161ffff82166000526004602052604060002054908115613b7f575b11613b5557613aff6105d96001546001600160a01b031690565b93843b1561050257600096613b4491604051998a98899788967fc580310000000000000000000000000000000000000000000000000000000000885260048801613a3b565b03925af18015610924576138675750565b60046040517fbba53260000000000000000000000000000000000000000000000000000000008152fd5b6127109150613ae5565b60046040517f7af198bf000000000000000000000000000000000000000000000000000000008152fd5b989796929394613c129567ffffffffffffffff613bee60e099956001600160a01b03958e61ffff610100921681528160208201520190610780565b961660408c015260608b015216608089015260a088015286820360c0880152610780565b930152565b67ffffffffffffffff613c3860409396959496606084526060840190610780565b951660208201520152565b9091613c4e84614145565b9091613c7f613c788761282a613c728b61ffff166000526008602052604060002090565b8c611333565b5460ff1690565b91613cb667ffffffffffffffff92837f0000000000000000000000000000000000000000000000000000000000000000911661309b565b9288888b8315613dcb575b505050853b15613d805794613d2196946135c9948a946135bb948d99600014613d795750505a925b5a978b6040519a8b987feaffd49a0000000000000000000000000000000000000000000000000000000060208b015260248a01613bb3565b9015613d6e575090613d6961ffff928560207fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd88496975191012090604051948594169684613c17565b0390a2565b9261128294926135f0565b1692613ce9565b50506040516001600160a01b039094168452507f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9750919550859450506020840192506131a0915050565b9061282a613e0092613dfa89613de5613e0d979b306133e7565b9961ffff166000526008602052604060002090565b90611333565b805460ff19166001179055565b88888b613cc1565b9160ff60075416600014613eeb576022825110613ec15761ffff6022613e5f93015193166000526003602052613e5960406000206001600052602052604060002090565b54613fa1565b908115613e975710613e6d57565b60046040517f918e5cfa000000000000000000000000000000000000000000000000000000008152fd5b60046040517ff39d7eda000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6db89b3e000000000000000000000000000000000000000000000000000000008152fd5b50905051613ef557565b60046040517f1beaad3f000000000000000000000000000000000000000000000000000000008152fd5b9060ff60075416600014613f6e576022815110613ec157602261ffff91015191166000526003602052613f5f604060002060008052602052604060002090565b54908115613e975710613e6d57565b905051613ef557565b90601f8201809211610cc857565b9060018201809211610cc857565b6051019081605111610cc857565b91908201809211610cc857565b634e487b7160e01b600052601260045260246000fd5b8115613fce570490565b613fae565b7f0000000000000000000000000000000000000000000000000000000000000000908115613fce570467ffffffffffffffff90818111614011571690565b60046040517f70049130000000000000000000000000000000000000000000000000000000008152fd5b7f00000000000000000000000000000000000000000000000000000000000000008015613fce57810690818103908111610cc85791565b9077ffffffffffffffffffffffffffffffffffffffffffffffff19906040519260006020850152602184015260c01b166041820152602981526060810181811067ffffffffffffffff8211176111a65760405290565b93926071926107b6946001600160a01b03604051978895600160f81b6020880152602187015277ffffffffffffffffffffffffffffffffffffffffffffffff19809460c01b16604187015216604985015260c01b166069830152614135815180926020868601910161075d565b8101036051810184520182611253565b90600160ff614153846144e2565b16036139cb576141628261448b565b9061416c83614536565b9060498451106141e55760498401519360518151106141a15761419e6051820151916141988151613527565b90614407565b91565b606460405162461bcd60e51b815260206004820152601460248201527f746f55696e7436345f6f75744f66426f756e64730000000000000000000000006044820152fd5b606460405162461bcd60e51b815260206004820152601560248201527f746f427974657333325f6f75744f66426f756e647300000000000000000000006044820152fd5b6001600160a01b0381169033820361433e575b81156142f057600081816142e294614255878096614714565b84614273846001600160a01b03166000526009602052604060002090565b546142808282101561505c565b0361429e846001600160a01b03166000526009602052604060002090565b556142ac85600b5403600b55565b6040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081015b0390a3614b68565b6142eb8161558f565b505090565b608460405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152fd5b614349833383614e08565b61423c565b8161435891614ed8565b6001600160e01b03600b541161340e576142eb8161545f565b1561437857565b606460405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152fd5b156143c357565b606460405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b61441482611edf81613f77565b614429815161442284613f93565b11156143bc565b81614441575050604051600081526020810160405290565b60405191601f8116916051831560051b80858701019484860193010101905b8084106144785750508252601f01601f191660405290565b9092835181526020809101930190614460565b602181511061449e57602d015160601c90565b606460405162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e647300000000000000000000006044820152fd5b60018151106144f2576001015190565b606460405162461bcd60e51b815260206004820152601360248201527f746f55696e74385f6f75744f66426f756e6473000000000000000000000000006044820152fd5b60298151106141a1576029015190565b909291600080916040519561455a87611237565b6096875282602088019560a036883760208451940192f1903d9060968211614588575b6000908286523e9190565b6096915061457d565b6001600160a01b036000541633036145a557565b60046040517f5fc483c5000000000000000000000000000000000000000000000000000000008152fd5b91906001600160a01b03928381169384156146ea57821680156146c0576145f78484846147a2565b614614826001600160a01b03166000526009602052604060002090565b549484861061469657846112829603614640846001600160a01b03166000526009602052604060002090565b5561465e846001600160a01b03166000526009602052604060002090565b8054860190556040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081016142da565b60046040517fd01849fe000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0359c55e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f27903dcf000000000000000000000000000000000000000000000000000000008152fd5b6015549160ff8360c81c1661472f575b5061128291506149b9565b6001600160a01b039081601a5416803b156105025760009283608492600260ff604051998a978896632163733b60e21b88528b166004880152856024880152604487015260e01c161460648401525af191821561092457611282921561472457806127f161479c92611192565b38614724565b6015549260ff8460c81c166147bd575b506112829250614aaf565b6001600160a01b039081601a5416803b156105025760009283608492600260ff6040519a8b978896632163733b60e21b8852808c1660048901528c166024880152604487015260e01c161460648401525af19283156109245761128293156147b257806127f161482c92611192565b386147b2565b6015549060ff8260d01c1680614981575b6149645760ff8260c01c169182614953575b508161492b575b50806148f0575b61486957565b614881600160e11b60ff60e01b196015541617601555565b6148996105d96105d96016546001600160a01b031690565b803b156105025760008091600460405180948193630d4d18e360e31b83525af18015610924576148dd575b50611282600160e01b60ff60e01b196015541617601555565b806127f16148ea92611192565b386148c4565b506000805260186020526149266123cc7f999d26de3473317ead3eeaf34ca78057f1439db67b6953469c3c96ce9caf6bd7613c78565b614863565b61494d9150613c78906001600160a01b03166000526017602052604060002090565b3861485c565b60e01c60ff16600114915038614855565b604051635504bc0760e01b815260006004820152602490fd5b0390fd5b506000805260196020526149b47fd2ac945fcc0096878c763e37d6929b78378c1a2defabde8ba7ee5ed1d6e7a5b2613c78565b614843565b6015549060ff8260d01c1680614a89575b614a665760ff8260c01c169182614a55575b5081614a1b575b816149f0575b5061486957565b614a159150613c786123cc916001600160a01b03166000526018602052604060002090565b386149e9565b6000805260176020529050614a4f7fd840e16649f6b9a295d95876f4633d3a6b10b55e8162971cf78afd886d5ec89b613c78565b906149e3565b60e01c60ff166001149150386149dc565b604051635504bc0760e01b81526001600160a01b03919091166004820152602490fd5b50614aaa613c78826001600160a01b03166000526019602052604060002090565b6149ca565b6015549160ff8360d01c1680614b42575b614b215760ff8360c01c169283614b10575b5082614ae6575b50816149f0575061486957565b614b09919250613c78906001600160a01b03166000526017602052604060002090565b9038614ad9565b60e01c60ff16600114925038614ad2565b604051635504bc0760e01b81526001600160a01b0383166004820152602490fd5b50614b63613c78836001600160a01b03166000526019602052604060002090565b614ac0565b91614b748183856150cd565b6015549260ff8460c01c1680614d1e575b614b90575b50505050565b614bb0613c78826001600160a01b03166000526017602052604060002090565b80614cf5575b15614c325750614c119250614be590614be0614bd960155461ffff9060a01c1690565b61ffff1690565b614d2e565b90614bfe600160e11b60ff60e01b196015541617601555565b6016546001600160a01b03165b906145cf565b614c29600160e01b60ff60e01b196015541617601555565b38808080614b8a565b614c52613c78846001600160a01b03166000526017602052604060002090565b9081614cca575b50614c67575b505050614c29565b614c7f6127109161ffff614caa9560b01c169061309b565b0490614c99600160e11b60ff60e01b196015541617601555565b6000546001600160a01b0316614c0b565b614cc2600160e01b60ff60e01b196015541617601555565b388080614c5f565b614cef9150613c786123cc916001600160a01b03166000526018602052604060002090565b38614c59565b50614d196123cc613c78856001600160a01b03166000526018602052604060002090565b614bb6565b50600160ff8560e01c1614614b85565b614d3b906127109261309b565b0490565b90916001600160a01b03809216918215614dde578316928315614db457817f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592614daa60209386600052600a85526040600020906001600160a01b0316600052602052604060002090565b55604051908152a3565b60046040517fd8aedff6000000000000000000000000000000000000000000000000000000008152fd5b60046040517fbec36d8f000000000000000000000000000000000000000000000000000000008152fd5b906001600160a01b038216600052600a602052614e3c816040600020906001600160a01b0316600052602052604060002090565b549260018401614e4c5750505050565b808410614e5e57614c29930391614d3f565b60046040517fb9788773000000000000000000000000000000000000000000000000000000008152fd5b8054821015614ea05760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b90604051614ec3816111ab565b602081935463ffffffff81168352811c910152565b906001600160a01b038216918215615006576015549260ff8460c81c16614f75575b6112829350614f0882614832565b614f1c614f1784600b54613fa1565b600b55565b614f39826001600160a01b03166000526009602052604060002090565b8054840190556040518381526000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602090a36000614b68565b614f8a6105d9601a546001600160a01b031690565b803b1561050257604051632163733b60e21b81526000600482018190526001600160a01b03851660248301526044820186905260e09690961c60ff166002146064820152949085908183816084810103925af19384156109245761128294614ff3575b50614efa565b806127f161500092611192565b38614fed565b60046040517fd1bb5a3e000000000000000000000000000000000000000000000000000000008152fd5b906001600160a01b03821680156142f0578160008481615057946142558561340a99614714565b61558f565b1561506357565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b9061128292916001600160a01b03809116600052601260205280806040600020541692166000526040600020541690615170565b611282916001600160a01b03809216600092818452601260205280604085205416809260096020527f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60408720549660126020526040812094871694856001600160a01b031982541617905580a45b91906001600160a01b038082169316838114158061538b575b6151935750505050565b80615206575b50826151a6575b80614b8a565b7fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724916151e86151ed926001600160a01b03166000526013602052604060002090565b615607565b60408051928352602083019190915290a23880806151a0565b8060005260136020527fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72460406000208054801591826000146153685761524a611275565b6000815260006020820152915b61527a61526e60208501516001600160e01b031690565b6001600160e01b031690565b926152858985615f4a565b94159081615345575b50156152e3576152b66152cd926152a486615dd4565b92600019019060005260206000200190565b9063ffffffff82549181199060201b169116179055565b604080519182526020820192909252a238615199565b50615340906153076153026152f743615e52565b65ffffffffffff1690565b615ecf565b9061533b61531486615dd4565b61532b61531f611275565b63ffffffff9095168552565b6001600160e01b03166020840152565b615400565b6152cd565b5163ffffffff16905063ffffffff61535f6152f743615e52565b9116143861528e565b61538561538060001984018360005260206000200190565b614eb6565b91615257565b50821515615189565b60145490680100000000000000008210156111a6576001820180601455821015614ea0576014600052805160209182015190911b63ffffffff191663ffffffff91909116177fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec90910155565b8054680100000000000000008110156111a65761542291600182018155614e88565b61544957815160209283015190921b63ffffffff191663ffffffff92909216919091179055565b634e487b7160e01b600052600060045260246000fd5b6014549091811591821561555a57615475611275565b60008152600060208201525b6154a261549b61526e60208401516001600160e01b031690565b9586615f57565b93159081615537575b50156154ec57611282906152b66154c185615dd4565b6014600052917fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb0190565b506112826154ff6153026152f743615e52565b61553261550b85615dd4565b615522615516611275565b63ffffffff9094168452565b6001600160e01b03166020830152565b615394565b5163ffffffff16905063ffffffff6155516152f743615e52565b911614386154ab565b601460005261558a7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614eb6565b615481565b601454909181159182156155d2576155a5611275565b60008152600060208201525b6154a26155cb61526e60208401516001600160e01b031690565b9586615f4a565b60146000526156027fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614eb6565b6155b1565b9091815491821592836000146156a25761561f611275565b60008152600060208201525b61564c61564561526e60208401516001600160e01b031690565b9687615f57565b9415908161567f575b501561566b576152b6611282926152a486615dd4565b50611282906153076153026152f743615e52565b5163ffffffff16905063ffffffff6156996152f743615e52565b91161438615655565b6156ba61538060001983018460005260206000200190565b61562b565b9192901561572057508151156156d3575090565b3b156156dc5790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156157335750805190602001fd5b61497d9060405191829162461bcd60e51b8352600483016107a5565b916107b6939161575e936158c1565b919091615786565b6005111561577057565b634e487b7160e01b600052602160045260246000fd5b61578f81615766565b806157975750565b6157a081615766565b600181036157ed5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6157f681615766565b600281036158435760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b8061584f600392615766565b1461585657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608490fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116159375791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156109245781516001600160a01b03811615615931579190565b50600190565b50505050600090600390565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016301480615a34575b1561599e577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a08152615a2e81611237565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000004614615975565b604290615a68615943565b90604051917f19010000000000000000000000000000000000000000000000000000000000008352600283015260228201522090565b60ff8114615af45760ff811690601f8211615aca5760405191615ac0836111ab565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600e54816000615b078361168d565b808352602093600190818116908115615b905750600114615b31575b50506107b692500382611253565b90939150600e6000527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd936000915b818310615b785750506107b693508201013880615b23565b85548784018501529485019486945091830191615b60565b9150506107b694925060ff191682840152151560051b8201013880615b23565b60ff8114615bd25760ff811690601f8211615aca5760405191615ac0836111ab565b50604051600f54816000615be58361168d565b808352602093600190818116908115615b905750600114615c0e5750506107b692500382611253565b90939150600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802936000915b818310615c555750506107b693508201013880615b23565b85548784018501529485019486945091830191615c3d565b90808216911860011c8101809111610cc85790565b8015615dbc5780615d55615d4e615d44615d3a615d30615d26615d1c615d1260016107b69a6000908b60801c80615db0575b508060401c80615da3575b508060201c80615d96575b508060101c80615d89575b508060081c80615d7c575b508060041c80615d6f575b508060021c80615d62575b50821c615d5b575b811c1b615d0b818b613fc4565b0160011c90565b615d0b818a613fc4565b615d0b8189613fc4565b615d0b8188613fc4565b615d0b8187613fc4565b615d0b8186613fc4565b615d0b8185613fc4565b8092613fc4565b90615dc2565b8101615cfe565b6002915091019038615cf6565b6004915091019038615ceb565b6008915091019038615ce0565b6010915091019038615cd5565b6020915091019038615cca565b6040915091019038615cbf565b91505060809038615cb4565b50600090565b9080821015615dcf575090565b905090565b6001600160e01b0390818111615de8571690565b608460405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f32342062697473000000000000000000000000000000000000000000000000006064820152fd5b65ffffffffffff90818111615e65571690565b608460405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201527f38206269747300000000000000000000000000000000000000000000000000006064820152fd5b63ffffffff90818111615ee0571690565b608460405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f32206269747300000000000000000000000000000000000000000000000000006064820152fd5b908103908111610cc85790565b908101809111610cc8579056fea26469706673582212203013b806e85bf1310a17dd0b96c9e1b38aa9fbb58148abcfa5a8085965b1179c64736f6c63430008150033
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80621d3567146104ec57806301ffc9a7146104e757806306fdde03146104e257806307e0db17146104dd578063095ea7b3146104d85780630df37483146104d357806310ddb137146104ce57806318160ddd1461041557806323b872dd146104c95780632518d450146104c4578063313ce567146104bf5780633644e515146104ba578063365260b4146104b557806339509351146104b05780633a46b1a8146104ab5780633d8b38f6146104a65780633f1f4fa4146104a157806340c10f191461049c57806342966c681461049757806342d65a8d1461049257806344770515146104885780634bf5d7e91461048d5780634c42899a14610488578063587cde1e146104835780635afde0631461047e5780635b8c41e6146104795780635c19a95c1461047457806363cd3c691461046f57806366ad5c8a1461046a578063695ef6bf146104655780636fcfff451461046057806370a082311461045b578063715018a6146104565780637533d7881461045157806376203b481461044c57806379cc6790146104475780637c9242e8146104425780637ecebe001461043d57806384761dbb1461043857806384b0196e14610433578063857749b01461042e5780638cfd8f5c146104295780638da5cb5b146104245780638e539e8c1461041f57806391ddadf41461041a5780639358928b14610415578063950c8a741461041057806395d89b411461040b5780639ab24eb0146104065780639bdb9812146104015780639f38369a146103fc578063a457c2d7146103f7578063a4c51df5146103f2578063a6c3d165146103ed578063a9059cbb146103e8578063ac8da3c4146103e3578063b29a8140146103de578063b353aaa7146103d9578063b81181d4146103d4578063baf3292d146103cf578063c3cda520146103ca578063c4461834146103c5578063cbed8b9c146103c0578063d1deba1f146103bb578063d505accf146103b6578063dd62ed3e146103b1578063df2a5b3b146103ac578063e6a20ae6146103a7578063e9c80e63146103a2578063eab45d9c1461039d578063eaffd49a14610398578063eb8d72b714610393578063ed629c5c1461038e578063f1127ed814610389578063f2fde38b14610384578063f5ecbdbc1461037f578063f840edfd1461037a5763fc0c546a1461037557600080fd5b61306a565b613026565b612f5c565b612ec0565b612e3a565b612e17565b612cd2565b612c4c565b612bea565b612bb7565b612b9b565b612ad6565b612a7a565b612937565b6127f7565b612717565b6126fa565b6125ce565b612542565b612407565b6123e0565b61228a565b61225d565b612233565b6120aa565b612016565b611f8c565b611e76565b611e2b565b611dc5565b611d1c565b611cf5565b610a2e565b611cc9565b611b60565b611b39565b611aef565b611ab1565b6119b8565b61198b565b61194d565b611920565b6118ec565b6117ca565b611777565b611633565b6115f5565b6115a9565b61148b565b61144b565b6113e7565b6113c1565b611359565b611118565b6110d8565b61101d565b611039565b610f9c565b610f7f565b610f19565b610ee4565b610e88565b610ccd565b610c6a565b610b7b565b610b58565b610b3c565b610abb565b610a4c565b6109ae565b610973565b61093e565b610898565b6107b9565b6106ca565b6105ae565b6004359061ffff8216820361050257565b600080fd5b6024359061ffff8216820361050257565b9181601f840112156105025782359167ffffffffffffffff8311610502576020838186019501011161050257565b9060806003198301126105025760043561ffff81168103610502579167ffffffffffffffff90602435828111610502578161058391600401610518565b9390939260443581811681036105025792606435918211610502576105aa91600401610518565b9091565b34610502576105bc36610546565b91929493906105e56105d96105d96001546001600160a01b031690565b6001600160a01b031690565b33036106a05761060b6106068661ffff166000526002602052604060002090565b61175c565b80519081881491821592610697575b508115610673575b5061064957610639610641926106479736916112a0565b9236916112a0565b92613543565b005b60046040517f9c5f4e7a000000000000000000000000000000000000000000000000000000008152fd5b90506106803688856112a0565b602081519101209060208151910120141538610622565b1591503861061a565b60046040517f4f7ad9c4000000000000000000000000000000000000000000000000000000008152fd5b34610502576020366003190112610502576004357fffffffff00000000000000000000000000000000000000000000000000000000811680910361050257807f1f7ecdf70000000000000000000000000000000000000000000000000000000060209214908115610741575b506040519015158152f35b6301ffc9a760e01b91501438610736565b600091031261050257565b60005b8381106107705750506000910152565b8181015183820152602001610760565b906020916107998151809281855285808601910161075d565b601f01601f1916010190565b9060206107b6928181520190610780565b90565b34610502576000806003193601126108955760405181600c546107db8161168d565b908184526020926001918281169081600014610873575060011461081a575b6108168561080a81890382611253565b604051918291826107a5565b0390f35b929450600c83527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c75b82841061086057505050816108169361080a9282010193386107fa565b8054858501870152928501928101610843565b60ff191686860152505050151560051b820101915061080a81610816386107fa565b80fd5b346105025760006020366003190112610895576108b36104f1565b6108bb614591565b816001600160a01b036001541691823b1561092957602461ffff918360405195869485937f07e0db170000000000000000000000000000000000000000000000000000000085521660048401525af1801561092457610918575080f35b61092190611192565b80f35b6132f2565b5080fd5b6001600160a01b0381160361050257565b346105025760403660031901126105025761096860043561095e8161092d565b6024359033614d3f565b602060405160018152f35b346105025760403660031901126105025761ffff61098f6104f1565b610997614591565b166000526004602052602435604060002055600080f35b346105025760006020366003190112610895576109c96104f1565b6109d1614591565b816001600160a01b036001541691823b1561092957602461ffff918360405195869485937f10ddb1370000000000000000000000000000000000000000000000000000000085521660048401525af1801561092457610918575080f35b34610502576000366003190112610502576020600b54604051908152f35b3461050257606036600319011261050257610968600435610a6c8161092d565b602435610a788161092d565b60443591610a87833383614e08565b6145cf565b8015150361050257565b604090600319011261050257600435610aae8161092d565b906024356107b681610a8c565b34610502577ffd7f6d25e7487e01d60c54f215c3a81bb6f973034cb26cf98baa0355fcc05f19610aea36610a96565b90610af3614591565b6001600160a01b0381166000526017602052610b1f8260406000209060ff801983541691151516179055565b604080516001600160a01b039290921682529115156020820152a1005b3461050257600036600319011261050257602060405160128152f35b34610502576000366003190112610502576020610b73615943565b604051908152f35b346105025760a036600319011261050257610b946104f1565b606435610ba081610a8c565b6084359067ffffffffffffffff821161050257610bcd610bc66040933690600401610518565b36916112a0565b92610be4610bdc604435613fd3565b602435614072565b6001600160a01b036001541691610c1285519687958694859463040a7bb160e41b86523090600487016138b4565b03915afa908115610924576000908192610c39575b50604080519182526020820192909252f35b9050610c5c915060403d8111610c63575b610c548183611253565b81019061389e565b9038610c27565b503d610c4a565b3461050257604036600319011261050257600435610c878161092d565b33600052600a602052610cb1816040600020906001600160a01b0316600052602052604060002090565b546024358101809111610cc8576109689133614d3f565b613085565b3461050257604036600319011261050257600435610cea8161092d565b6024359065ffffffffffff610cfe43615e52565b16821015610e23576001600160a01b03166000526013602052604060002080549160008360058111610dd2575b50905b838210610d7d57505081610d555750506001600160e01b0360005b60405191168152602090f35b6000908152602090206001600160e01b0391610d789101600019015b5460201c90565b610d49565b9092610d898185615c6d565b90818363ffffffff610daf610da5848960005260206000200190565b5463ffffffff1690565b161115610dc0575050925b90610d2e565b909450610dcd9150613f85565b610dba565b80610de2610de892969396615c82565b90613536565b908263ffffffff610e03610da5858860005260206000200190565b161115610e135750925b38610d2b565b9350610e1e90613f85565b610e0d565b60046040517fb95f42c3000000000000000000000000000000000000000000000000000000008152fd5b9060406003198301126105025760043561ffff8116810361050257916024359067ffffffffffffffff8211610502576105aa91600401610518565b3461050257602061ffff610ed5610e9e36610e4d565b9390911660005260028452610ec0610ec76040600020604051928380926116c7565b0382611253565b8481519101209236916112a0565b82815191012014604051908152f35b346105025760203660031901126105025761ffff610f006104f1565b1660005260046020526020604060002054604051908152f35b3461050257604036600319011261050257600435610f368161092d565b6001600160a01b03601554163303610f555761064790602435906133e7565b60046040517f80206449000000000000000000000000000000000000000000000000000000008152fd5b346105025760203660031901126105025761064760043533615030565b34610502576001600160a01b03610fb236610e4d565b610fba614591565b6001549160009485931690813b15611019578361100795604051968795869485937f42d65a8d000000000000000000000000000000000000000000000000000000008552600485016134b8565b03925af1801561092457610918575080f35b8380fd5b3461050257600036600319011261050257602060405160008152f35b34610502576000366003190112610502574365ffffffffffff61105b43615e52565b16036110ae57610816604051611070816111ab565b601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c740000006020820152604051918291602083526020830190610780565b60046040517fd50637bf000000000000000000000000000000000000000000000000000000008152fd5b346105025760203660031901126105025760206004356110f78161092d565b6001600160a01b038091166000526012825260406000205416604051908152f35b34610502577f8f3675e5a31b083483e5a782db4130316da1e3c5fca72fc2398f59692286d8a561114736610a96565b90611150614591565b6001600160a01b0381166000526018602052610b1f8260406000209060ff801983541691151516179055565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff81116111a657604052565b61117c565b6040810190811067ffffffffffffffff8211176111a657604052565b6020810190811067ffffffffffffffff8211176111a657604052565b6080810190811067ffffffffffffffff8211176111a657604052565b60a0810190811067ffffffffffffffff8211176111a657604052565b60e0810190811067ffffffffffffffff8211176111a657604052565b60c0810190811067ffffffffffffffff8211176111a657604052565b90601f8019910116810190811067ffffffffffffffff8211176111a657604052565b60405190611282826111ab565b565b67ffffffffffffffff81116111a657601f01601f191660200190565b9291926112ac82611284565b916112ba6040519384611253565b829481845281830111610502578281602093846000960137010152565b60606003198201126105025760043561ffff81168103610502579160243567ffffffffffffffff92838211610502578060238301121561050257816024611323936004013591016112a0565b9160443590811681036105025790565b60209061134d92826040519483868095519384920161075d565b82019081520301902090565b346105025760206113b861ffff61139683611373366112d7565b94909116600052600682526040600020826040519483868095519384920161075d565b8201908152030190209067ffffffffffffffff16600052602052604060002090565b54604051908152f35b34610502576020366003190112610502576106476004356113e18161092d565b33615101565b34610502577f271a6c83d2d471fc3b7e0785e77e48c25259853378b45972025bdfa21af522f361141636610a96565b9061141f614591565b6001600160a01b0381166000526019602052610b1f8260406000209060ff801983541691151516179055565b346105025761145936610546565b91929493903033036106a057610639611477926106479736916112a0565b926138f9565b908160609103126105025790565b60a0366003190112610502576004356114a38161092d565b6114ab610507565b6044359160843567ffffffffffffffff8111610502576114cf90369060040161147d565b908135916114dc8361092d565b6114fb610bc66020830135926114f18461092d565b60408101906136b5565b926115068486613f1f565b61151b61151460643561403b565b5084614229565b93841561157f577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a9361157261ffff936001600160a01b03936020966115696115638b613fd3565b8d614072565b9234938c613a92565b60405195865216941692a4005b60046040517fca69cd3c000000000000000000000000000000000000000000000000000000008152fd5b34610502576020366003190112610502576001600160a01b036004356115ce8161092d565b16600052601360205260206115e7604060002054615ecf565b63ffffffff60405191168152f35b34610502576020366003190112610502576001600160a01b0360043561161a8161092d565b1660005260096020526020604060002054604051908152f35b34610502576000806003193601126108955761164d614591565b806001600160a01b0381546001600160a01b031981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90600182811c921680156116bd575b60208310146116a757565b634e487b7160e01b600052602260045260246000fd5b91607f169161169c565b8054600093926116d68261168d565b91828252602093600191828116908160001461173d57506001146116fc575b5050505050565b90939495506000929192528360002092846000945b838610611729575050505001019038808080806116f5565b805485870183015294019385908201611711565b60ff19168685015250505090151560051b0101915038808080806116f5565b9061128261177092604051938480926116c7565b0383611253565b346105025760203660031901126105025761ffff6117936104f1565b166000526002602052610816610ec06117b66040600020604051928380926116c7565b604051918291602083526020830190610780565b60e0366003190112610502576004356117e28161092d565b6117ea610507565b6044359167ffffffffffffffff9060843582811161050257611810903690600401610518565b9160a435848116948582036105025760c4359081116105025761183790369060040161147d565b9361187961187186359261184a8461092d565b61186961185f60208a0135996114f18b61092d565b98909236916112a0565b9636916112a0565b968789613e15565b61188761151460643561403b565b95861561157f577fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a956118d06118d9946001600160a01b03976118c98b613fd3565b8d336140c8565b9234938a613a92565b604051938452169261ffff1691602090a4005b346105025760403660031901126105025761064760043561190c8161092d565b6024359061191b823383614e08565b615030565b346105025760203660031901126105025761064760043561194081610a8c565b611948614591565b613263565b34610502576020366003190112610502576001600160a01b036004356119728161092d565b1660005260106020526020604060002054604051908152f35b34610502576020366003190112610502576106476004356119ab81610a8c565b6119b3614591565b6131ea565b346105025760008060031936011261089557611a55906119f77f42454e2054455354000000000000000000000000000000000000000000000008615a9e565b90611a217f3100000000000000000000000000000000000000000000000000000000000001615bb0565b9060405191611a2f836111c7565b818352611a63602091604051968796600f60f81b885260e08589015260e0880190610780565b908682036040880152610780565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b828110611a9a57505050500390f35b835185528695509381019392810192600101611a8b565b3461050257600036600319011261050257602060405160ff7f0000000000000000000000000000000000000000000000000000000000000008168152f35b346105025760403660031901126105025760206113b8611b0d6104f1565b61ffff611b18610507565b91166000526003835260406000209061ffff16600052602052604060002090565b346105025760003660031901126105025760206001600160a01b0360005416604051908152f35b346105025760203660031901126105025760043565ffffffffffff611b8443615e52565b16811015610e23576014549060008260058111611c62575b50905b828210611bfb578280611bc35750602060005b6001600160e01b0360405191168152f35b6014600052602090611bf6907fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb01610d71565b611bb2565b9091611c078184615c6d565b601460005290818363ffffffff611c3f7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8401610da5565b161115611c50575050915b90611b9f565b909350611c5d9150613f85565b611c4a565b80610de2611c7292959395615c82565b6014600052908263ffffffff611ca97fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec8501610da5565b161115611cb95750915b38611b9c565b9250611cc490613f85565b611cb3565b34610502576000366003190112610502576020611ce543615e52565b65ffffffffffff60405191168152f35b346105025760003660031901126105025760206001600160a01b0360055416604051908152f35b34610502576000806003193601126108955760405181600d54611d3e8161168d565b9081845260209260019182811690816000146108735750600114611d6c576108168561080a81890382611253565b929450600d83527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb55b828410611db257505050816108169361080a9282010193386107fa565b8054858501870152928501928101611d95565b34610502576020366003190112610502576001600160a01b03600435611dea8161092d565b166000526013602052604060002080548015600014611e1157505060405160008152602090f35b602091611e22916000190190614e88565b5054811c611bb2565b3461050257602060ff611e6a61ffff61139684611e47366112d7565b94909116600052600882526040600020826040519483868095519384920161075d565b54166040519015158152f35b346105025760208060031936011261050257611eb39061ffff611e976104f1565b16600052600281526040611eba816000208251948580926116c7565b0384611253565b825115611f635782516013199384820190828211610cc857611ee682611edf81613f77565b1015614371565b611ef382825110156143bc565b81611f1657505050610816925080519160008352820181525b51918291826107a5565b839594955194601f8316801560051b91828289010195860101920101905b808410611f525750508352601f01601f191681526108169250611f0c565b815184529286019290860190611f34565b600490517f6897706a000000000000000000000000000000000000000000000000000000008152fd5b3461050257604036600319011261050257600435611fa98161092d565b6024359033600052600a602052611fd7816040600020906001600160a01b0316600052602052604060002090565b5491808310611fec5761096892039033614d3f565b60046040517f9703dd42000000000000000000000000000000000000000000000000000000008152fd5b346105025760e03660031901126105025761202f6104f1565b67ffffffffffffffff9060643582811161050257612051903690600401610518565b60849291923584811681036105025760a4359161206d83610a8c565b60c43595861161050257612088612098963690600401610518565b95909460443590602435906136e8565b60408051928352602083019190915290f35b34610502576120b836610e4d565b91906120c2614591565b6040519160208483828601376120ed6034858781013060601b85820152036014810187520185611253565b60009361ffff8316855260028252604085209181519167ffffffffffffffff83116111a65761212683612120865461168d565b866134d3565b81601f841160011461219d57508287989361218c959361217d937f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a92612192575b50508160011b916000199060031b1c19161790565b90555b604051938493846134b8565b0390a180f35b015190503880612168565b9190601f1984166121b386600052602060002090565b9389905b82821061221b5750509260019285927f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce9a9b9661218c989610612202575b505050811b019055612180565b015160001960f88460031b161c191690553880806121f5565b806001869782949787015181550196019401906121b7565b34610502576040366003190112610502576109686004356122538161092d565b60243590336145cf565b346105025760203660031901126105025761064760043561227d8161092d565b612285614591565b6132fe565b34610502576040366003190112610502576004356122a78161092d565b6122af614591565b6001600160a01b039061237560009280845416848060405193602096878601947fa9059cbb000000000000000000000000000000000000000000000000000000008652602487015260243560448701526044865261230c866111e3565b16926040519461231b866111ab565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af13d156123d8573d9161235a83611284565b926123686040519485611253565b83523d878785013e6156bf565b9081519182151591826123b8575b5050905061238e5780f35b60046040517f029151ac000000000000000000000000000000000000000000000000000000008152fd5b6123cc9250806123d09483010191016132dd565b1590565b803880612383565b6060916156bf565b346105025760003660031901126105025760206001600160a01b0360015416604051908152f35b3461050257610120366003190112610502576004356124258161092d565b602435906124328261092d565b6044359061243f8261092d565b6064359061244c8261092d565b60c43561245881610a8c565b60e4359361246585610a8c565b6101043561247281610a8c565b60ff60155460d81c16612518577b01000000000000000000000000000000000000000000000000000000966122856124de926119486119b3996124b3614591565b6001600160a01b039a8b98896001600160a01b03199b168b600154161760015560a4356084356130ae565b1690601a541617601a55167fffffffff00ffffffffffffff0000000000000000000000000000000000000000601554161717601555600080f35b60046040517f0dc149f0000000000000000000000000000000000000000000000000000000008152fd5b34610502576020366003190112610502577f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b60206001600160a01b0360043561258a8161092d565b612592614591565b16806001600160a01b03196005541617600555604051908152a1005b6064359060ff8216820361050257565b6084359060ff8216820361050257565b346105025760c0366003190112610502576004356125eb8161092d565b602435906044356125fa6125ae565b908042116126d057612671916040519060208201927fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf84526001600160a01b0386166040840152866060840152608083015260808252612659826111ff565b61266c60a4359360843593519020615a5d565b61574f565b91612698836001600160a01b03166000526010602052604060002090815491600183019055565b036126a65761064791615101565b60046040517f713f9ea1000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd52e1db5000000000000000000000000000000000000000000000000000000008152fd5b346105025760003660031901126105025760206040516127108152f35b34610502576080366003190112610502576127306104f1565b612738610507565b60643567ffffffffffffffff811161050257612758903690600401610518565b9092612762614591565b6001600160a01b036001541690813b1561050257600080946127d4604051978896879586947fcbed8b9c00000000000000000000000000000000000000000000000000000000865261ffff80921660048701521660248501526044356044850152608060648501526084840191613497565b03925af18015610924576127e457005b806127f161064792611192565b80610752565b61280036610546565b906128438361282a6128238997989961ffff166000526006602052604060002090565b888a61369c565b9067ffffffffffffffff16600052602052604060002090565b5491821561064957826128573683856112a0565b602081519101200361290d577fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e59661ffff966128e26128fc93876128db67ffffffffffffffff9760006128c78461282a8f6128c09061ffff166000526006602052604060002090565b8a8c61369c565b556128d33687896112a0565b9336916112a0565b918a6138f9565b604051978897168752608060208801526080870191613497565b9216604084015260608301520390a1005b60046040517f1bcbd8e4000000000000000000000000000000000000000000000000000000008152fd5b346105025760e0366003190112610502576004356129548161092d565b6024356129608161092d565b6044359060643561296f6125be565b90804211612a5057612a176129a0866001600160a01b03166000526010602052604060002090815491600183019055565b9260405160208101917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983526001600160a01b0394858a1696876040850152868916606085015289608085015260a084015260c083015260c08252612a048261121b565b61266c60c4359360a43593519020615a5d565b1603612a265761064792614d3f565b60046040517f822a64c8000000000000000000000000000000000000000000000000000000008152fd5b60046040517fc77deac2000000000000000000000000000000000000000000000000000000008152fd5b346105025760403660031901126105025760206113b8600435612a9c8161092d565b6001600160a01b0360243591612ab18361092d565b16600052600a83526040600020906001600160a01b0316600052602052604060002090565b3461050257606036600319011261050257612aef6104f1565b612af7610507565b9060443591612b04614591565b8215612b71577f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09260609261ffff8091169283600052600360205282612b5c8260406000209061ffff16600052602052604060002090565b556040519384521660208301526040820152a1005b60046040517f73157870000000000000000000000000000000000000000000000000000000008152fd5b3461050257600036600319011261050257602060405160018152f35b3461050257606036600319011261050257610647604435612bd781610a8c565b612bdf614591565b6024356004356130ae565b34610502576020366003190112610502577f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a46020600435612c2a81610a8c565b612c32614591565b151560ff196007541660ff821617600755604051908152a1005b346105025761010036600319011261050257612c666104f1565b67ffffffffffffffff9060243582811161050257612c88903690600401610518565b919060443590848216820361050257608435612ca38161092d565b60c43595861161050257612cbe610647963690600401610518565b94909360e4359660a435946064359361377d565b3461050257612ce036610e4d565b9190612cea614591565b60009161ffff81168352602060028152604084209067ffffffffffffffff86116111a657612d2286612d1c845461168d565b846134d3565b8490601f8711600114612d8357509461218c9161217d828088997ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab9991612d78575b508160011b916000199060031b1c19161790565b905087013538612d64565b90601f198716612d9884600052602060002090565b9287905b828210612dff5750509161218c9391887ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab98999410612de5575b5050600182811b019055612180565b860135600019600385901b60f8161c191690553880612dd6565b80600185968294968b01358155019501930190612d9c565b3461050257600036600319011261050257602060ff600754166040519015158152f35b3461050257604036600319011261050257600435612e578161092d565b63ffffffff6024358181168103610502576020612eae612ea86001600160e01b03936001600160a01b036040976000868a51612e92816111ab565b8281520152166000526013845286600020614e88565b50614eb6565b84519381511684520151166020820152f35b3461050257602036600319011261050257600435612edd8161092d565b612ee5614591565b6001600160a01b038091168015612f32576000918254826001600160a01b03198216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60046040517f7448fbae000000000000000000000000000000000000000000000000000000008152fd5b3461050257608036600319011261050257612f756104f1565b6000612f7f610507565b91612f8b60443561092d565b60846001600160a01b03600154169360405194859384927ff5ecbdbc00000000000000000000000000000000000000000000000000000000845261ffff809216600485015216602483015230604483015260643560648301525afa80156109245761081691600091613005575b50604051918291826107a5565b613020913d8091833e6130188183611253565b810190613438565b38612ff8565b34610502576020366003190112610502576001600160a01b0360043561304b8161092d565b613053614591565b166001600160a01b0319601a541617601a55600080f35b34610502576000366003190112610502576020604051308152f35b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715610cc857565b600a8102818104600a1482151715610cc8576127108091119081156131cf575b506131a5576015805478ff00000000000000000000000000000000000000000000000094151560c081901b959095167fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff90911675ffff000000000000000000000000000000000000000060a085901b161777ffff0000000000000000000000000000000000000000000060b086901b1617179055604080519182526020820192909252908101919091527f7294b4c7617e41cb925ae9440310fb23923aff0612102e0dbc68dab1b5b86c659080606081015b0390a1565b60046040517f0421d1aa000000000000000000000000000000000000000000000000000000008152fd5b9050600a8302838104600a1484151715610cc85711386130ce565b60207f12dcaec55ae8add66312d9a3feb1c94658903c007d895c262ce36355111ed1589115156015547fffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffff79ff000000000000000000000000000000000000000000000000008360c81b16911617601555604051908152a1565b60207f4afb66c9bb6da7f9e6cbb478337238477302fef1901949e5cbc037b2db7cd3429115156015547fffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffff7aff00000000000000000000000000000000000000000000000000008360d01b16911617601555604051908152a1565b9081602091031261050257516107b681610a8c565b6040513d6000823e3d90fd5b6001600160a01b0381166040516301ffc9a760e01b8152630d4d18e360e31b6004820152602081602481855afa908115610924576000916133b9575b501561338f57601680546001600160a01b03191690911790556040516001600160a01b0390911681527f063dfd21e2b799ca4cb66556e57c360c6abc46f21805029c971f7475a96bd69a9080602081016131a0565b60046040517f9dcd44a3000000000000000000000000000000000000000000000000000000008152fd5b6133da915060203d81116133e0575b6133d28183611253565b8101906132dd565b3861333a565b503d6133c8565b816133f191614ed8565b6001600160e01b03600b541161340e5761340a9061545f565b5050565b60046040517f5956b680000000000000000000000000000000000000000000000000000000008152fd5b6020818303126105025780519067ffffffffffffffff8211610502570181601f8201121561050257805161346b81611284565b926134796040519485611253565b81845260208284010111610502576107b6916020808501910161075d565b908060209392818452848401376000828201840152601f01601f1916010190565b60409061ffff6107b695931681528160208201520191613497565b90601f81116134e157505050565b600091825260208220906020601f850160051c8301941061351d575b601f0160051c01915b82811061351257505050565b818155600101613506565b90925082906134fd565b605019810191908211610cc857565b91908203918211610cc857565b9290916135cf5a604051907f66ad5c8a00000000000000000000000000000000000000000000000000000000602083015261ffff87166024830152608060448301526135c9826135bb61359960a483018a610780565b67ffffffffffffffff8816606484015282810360231901608484015288610780565b03601f198101845283611253565b30614546565b9390156135dd575050505050565b6135e6946135f0565b38808080806116f5565b919361368e7fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c956131a0939561ffff815160208301209616958660005260066020526136548361139660208b6040600020826040519483868095519384920161075d565b5567ffffffffffffffff61367a604051988998895260a060208a015260a0890190610780565b921660408701528582036060870152610780565b908382036080850152610780565b6020919283604051948593843782019081520301902090565b903590601e1981360301821215610502570180359067ffffffffffffffff82116105025760200191813603831361050257565b949261370e6040986137066137149361371b989d9c969d36916112a0565b9436916112a0565b99613fd3565b90336140c8565b6001600160a01b03600154169161374985519788958694859463040a7bb160e41b86523090600487016138b4565b03915afa91821561092457600090819361376257509190565b90506105aa91925060403d8111610c6357610c548183611253565b989593909697989491943033036138745761ffff6001600160a01b03916137a58786306145cf565b1692169283837fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf6020604051898152a3833b1561050257613835996000998a966138579467ffffffffffffffff6040519e8f9d8e9c8d9a7f7fcf35da000000000000000000000000000000000000000000000000000000008c5260048c015260c060248c015260c48b0191613497565b95166044880152606487015260848601528483036003190160a4860152613497565b0393f18015610924576138675750565b806127f161128292611192565b60046040517fb9984ab5000000000000000000000000000000000000000000000000000000008152fd5b9190826040910312610502576020825192015190565b91926001600160a01b036107b6969461ffff6138e49416855216602084015260a0604084015260a0830190610780565b92151560608201526080818403910152610780565b92919060ff613907846144e2565b1680613a015750505060ff61391b826144e2565b16158015906139f5575b6139cb5761393b6139358261448b565b91614536565b906001600160a01b03808216156139c1575b6139ad6139a77fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf939467ffffffffffffffff7f00000000000000000000000000000000000000000000000000000002540be400911661309b565b8461434e565b60405190815292169261ffff1691602090a3565b61dead915061394d565b60046040517fc20e59c6000000000000000000000000000000000000000000000000000000008152fd5b50602981511415613925565b600103613a115761128293613c43565b60046040517fa0e89db1000000000000000000000000000000000000000000000000000000008152fd5b92613a606107b697959361ffff613a6e9416865260c0602087015260c0860190610780565b908482036040860152610780565b936001600160a01b03809216606084015216608082015260a0818403910152610780565b94611eb391939295613ac1613ab58261ffff166000526002602052604060002090565b604051948580926116c7565b825115613b8957845161ffff82166000526004602052604060002054908115613b7f575b11613b5557613aff6105d96001546001600160a01b031690565b93843b1561050257600096613b4491604051998a98899788967fc580310000000000000000000000000000000000000000000000000000000000885260048801613a3b565b03925af18015610924576138675750565b60046040517fbba53260000000000000000000000000000000000000000000000000000000008152fd5b6127109150613ae5565b60046040517f7af198bf000000000000000000000000000000000000000000000000000000008152fd5b989796929394613c129567ffffffffffffffff613bee60e099956001600160a01b03958e61ffff610100921681528160208201520190610780565b961660408c015260608b015216608089015260a088015286820360c0880152610780565b930152565b67ffffffffffffffff613c3860409396959496606084526060840190610780565b951660208201520152565b9091613c4e84614145565b9091613c7f613c788761282a613c728b61ffff166000526008602052604060002090565b8c611333565b5460ff1690565b91613cb667ffffffffffffffff92837f00000000000000000000000000000000000000000000000000000002540be400911661309b565b9288888b8315613dcb575b505050853b15613d805794613d2196946135c9948a946135bb948d99600014613d795750505a925b5a978b6040519a8b987feaffd49a0000000000000000000000000000000000000000000000000000000060208b015260248a01613bb3565b9015613d6e575090613d6961ffff928560207fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd88496975191012090604051948594169684613c17565b0390a2565b9261128294926135f0565b1692613ce9565b50506040516001600160a01b039094168452507f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9750919550859450506020840192506131a0915050565b9061282a613e0092613dfa89613de5613e0d979b306133e7565b9961ffff166000526008602052604060002090565b90611333565b805460ff19166001179055565b88888b613cc1565b9160ff60075416600014613eeb576022825110613ec15761ffff6022613e5f93015193166000526003602052613e5960406000206001600052602052604060002090565b54613fa1565b908115613e975710613e6d57565b60046040517f918e5cfa000000000000000000000000000000000000000000000000000000008152fd5b60046040517ff39d7eda000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6db89b3e000000000000000000000000000000000000000000000000000000008152fd5b50905051613ef557565b60046040517f1beaad3f000000000000000000000000000000000000000000000000000000008152fd5b9060ff60075416600014613f6e576022815110613ec157602261ffff91015191166000526003602052613f5f604060002060008052602052604060002090565b54908115613e975710613e6d57565b905051613ef557565b90601f8201809211610cc857565b9060018201809211610cc857565b6051019081605111610cc857565b91908201809211610cc857565b634e487b7160e01b600052601260045260246000fd5b8115613fce570490565b613fae565b7f00000000000000000000000000000000000000000000000000000002540be400908115613fce570467ffffffffffffffff90818111614011571690565b60046040517f70049130000000000000000000000000000000000000000000000000000000008152fd5b7f00000000000000000000000000000000000000000000000000000002540be4008015613fce57810690818103908111610cc85791565b9077ffffffffffffffffffffffffffffffffffffffffffffffff19906040519260006020850152602184015260c01b166041820152602981526060810181811067ffffffffffffffff8211176111a65760405290565b93926071926107b6946001600160a01b03604051978895600160f81b6020880152602187015277ffffffffffffffffffffffffffffffffffffffffffffffff19809460c01b16604187015216604985015260c01b166069830152614135815180926020868601910161075d565b8101036051810184520182611253565b90600160ff614153846144e2565b16036139cb576141628261448b565b9061416c83614536565b9060498451106141e55760498401519360518151106141a15761419e6051820151916141988151613527565b90614407565b91565b606460405162461bcd60e51b815260206004820152601460248201527f746f55696e7436345f6f75744f66426f756e64730000000000000000000000006044820152fd5b606460405162461bcd60e51b815260206004820152601560248201527f746f427974657333325f6f75744f66426f756e647300000000000000000000006044820152fd5b6001600160a01b0381169033820361433e575b81156142f057600081816142e294614255878096614714565b84614273846001600160a01b03166000526009602052604060002090565b546142808282101561505c565b0361429e846001600160a01b03166000526009602052604060002090565b556142ac85600b5403600b55565b6040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081015b0390a3614b68565b6142eb8161558f565b505090565b608460405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152fd5b614349833383614e08565b61423c565b8161435891614ed8565b6001600160e01b03600b541161340e576142eb8161545f565b1561437857565b606460405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152fd5b156143c357565b606460405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b61441482611edf81613f77565b614429815161442284613f93565b11156143bc565b81614441575050604051600081526020810160405290565b60405191601f8116916051831560051b80858701019484860193010101905b8084106144785750508252601f01601f191660405290565b9092835181526020809101930190614460565b602181511061449e57602d015160601c90565b606460405162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e647300000000000000000000006044820152fd5b60018151106144f2576001015190565b606460405162461bcd60e51b815260206004820152601360248201527f746f55696e74385f6f75744f66426f756e6473000000000000000000000000006044820152fd5b60298151106141a1576029015190565b909291600080916040519561455a87611237565b6096875282602088019560a036883760208451940192f1903d9060968211614588575b6000908286523e9190565b6096915061457d565b6001600160a01b036000541633036145a557565b60046040517f5fc483c5000000000000000000000000000000000000000000000000000000008152fd5b91906001600160a01b03928381169384156146ea57821680156146c0576145f78484846147a2565b614614826001600160a01b03166000526009602052604060002090565b549484861061469657846112829603614640846001600160a01b03166000526009602052604060002090565b5561465e846001600160a01b03166000526009602052604060002090565b8054860190556040518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080602081016142da565b60046040517fd01849fe000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0359c55e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f27903dcf000000000000000000000000000000000000000000000000000000008152fd5b6015549160ff8360c81c1661472f575b5061128291506149b9565b6001600160a01b039081601a5416803b156105025760009283608492600260ff604051998a978896632163733b60e21b88528b166004880152856024880152604487015260e01c161460648401525af191821561092457611282921561472457806127f161479c92611192565b38614724565b6015549260ff8460c81c166147bd575b506112829250614aaf565b6001600160a01b039081601a5416803b156105025760009283608492600260ff6040519a8b978896632163733b60e21b8852808c1660048901528c166024880152604487015260e01c161460648401525af19283156109245761128293156147b257806127f161482c92611192565b386147b2565b6015549060ff8260d01c1680614981575b6149645760ff8260c01c169182614953575b508161492b575b50806148f0575b61486957565b614881600160e11b60ff60e01b196015541617601555565b6148996105d96105d96016546001600160a01b031690565b803b156105025760008091600460405180948193630d4d18e360e31b83525af18015610924576148dd575b50611282600160e01b60ff60e01b196015541617601555565b806127f16148ea92611192565b386148c4565b506000805260186020526149266123cc7f999d26de3473317ead3eeaf34ca78057f1439db67b6953469c3c96ce9caf6bd7613c78565b614863565b61494d9150613c78906001600160a01b03166000526017602052604060002090565b3861485c565b60e01c60ff16600114915038614855565b604051635504bc0760e01b815260006004820152602490fd5b0390fd5b506000805260196020526149b47fd2ac945fcc0096878c763e37d6929b78378c1a2defabde8ba7ee5ed1d6e7a5b2613c78565b614843565b6015549060ff8260d01c1680614a89575b614a665760ff8260c01c169182614a55575b5081614a1b575b816149f0575b5061486957565b614a159150613c786123cc916001600160a01b03166000526018602052604060002090565b386149e9565b6000805260176020529050614a4f7fd840e16649f6b9a295d95876f4633d3a6b10b55e8162971cf78afd886d5ec89b613c78565b906149e3565b60e01c60ff166001149150386149dc565b604051635504bc0760e01b81526001600160a01b03919091166004820152602490fd5b50614aaa613c78826001600160a01b03166000526019602052604060002090565b6149ca565b6015549160ff8360d01c1680614b42575b614b215760ff8360c01c169283614b10575b5082614ae6575b50816149f0575061486957565b614b09919250613c78906001600160a01b03166000526017602052604060002090565b9038614ad9565b60e01c60ff16600114925038614ad2565b604051635504bc0760e01b81526001600160a01b0383166004820152602490fd5b50614b63613c78836001600160a01b03166000526019602052604060002090565b614ac0565b91614b748183856150cd565b6015549260ff8460c01c1680614d1e575b614b90575b50505050565b614bb0613c78826001600160a01b03166000526017602052604060002090565b80614cf5575b15614c325750614c119250614be590614be0614bd960155461ffff9060a01c1690565b61ffff1690565b614d2e565b90614bfe600160e11b60ff60e01b196015541617601555565b6016546001600160a01b03165b906145cf565b614c29600160e01b60ff60e01b196015541617601555565b38808080614b8a565b614c52613c78846001600160a01b03166000526017602052604060002090565b9081614cca575b50614c67575b505050614c29565b614c7f6127109161ffff614caa9560b01c169061309b565b0490614c99600160e11b60ff60e01b196015541617601555565b6000546001600160a01b0316614c0b565b614cc2600160e01b60ff60e01b196015541617601555565b388080614c5f565b614cef9150613c786123cc916001600160a01b03166000526018602052604060002090565b38614c59565b50614d196123cc613c78856001600160a01b03166000526018602052604060002090565b614bb6565b50600160ff8560e01c1614614b85565b614d3b906127109261309b565b0490565b90916001600160a01b03809216918215614dde578316928315614db457817f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592614daa60209386600052600a85526040600020906001600160a01b0316600052602052604060002090565b55604051908152a3565b60046040517fd8aedff6000000000000000000000000000000000000000000000000000000008152fd5b60046040517fbec36d8f000000000000000000000000000000000000000000000000000000008152fd5b906001600160a01b038216600052600a602052614e3c816040600020906001600160a01b0316600052602052604060002090565b549260018401614e4c5750505050565b808410614e5e57614c29930391614d3f565b60046040517fb9788773000000000000000000000000000000000000000000000000000000008152fd5b8054821015614ea05760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b90604051614ec3816111ab565b602081935463ffffffff81168352811c910152565b906001600160a01b038216918215615006576015549260ff8460c81c16614f75575b6112829350614f0882614832565b614f1c614f1784600b54613fa1565b600b55565b614f39826001600160a01b03166000526009602052604060002090565b8054840190556040518381526000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602090a36000614b68565b614f8a6105d9601a546001600160a01b031690565b803b1561050257604051632163733b60e21b81526000600482018190526001600160a01b03851660248301526044820186905260e09690961c60ff166002146064820152949085908183816084810103925af19384156109245761128294614ff3575b50614efa565b806127f161500092611192565b38614fed565b60046040517fd1bb5a3e000000000000000000000000000000000000000000000000000000008152fd5b906001600160a01b03821680156142f0578160008481615057946142558561340a99614714565b61558f565b1561506357565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b9061128292916001600160a01b03809116600052601260205280806040600020541692166000526040600020541690615170565b611282916001600160a01b03809216600092818452601260205280604085205416809260096020527f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60408720549660126020526040812094871694856001600160a01b031982541617905580a45b91906001600160a01b038082169316838114158061538b575b6151935750505050565b80615206575b50826151a6575b80614b8a565b7fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724916151e86151ed926001600160a01b03166000526013602052604060002090565b615607565b60408051928352602083019190915290a23880806151a0565b8060005260136020527fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72460406000208054801591826000146153685761524a611275565b6000815260006020820152915b61527a61526e60208501516001600160e01b031690565b6001600160e01b031690565b926152858985615f4a565b94159081615345575b50156152e3576152b66152cd926152a486615dd4565b92600019019060005260206000200190565b9063ffffffff82549181199060201b169116179055565b604080519182526020820192909252a238615199565b50615340906153076153026152f743615e52565b65ffffffffffff1690565b615ecf565b9061533b61531486615dd4565b61532b61531f611275565b63ffffffff9095168552565b6001600160e01b03166020840152565b615400565b6152cd565b5163ffffffff16905063ffffffff61535f6152f743615e52565b9116143861528e565b61538561538060001984018360005260206000200190565b614eb6565b91615257565b50821515615189565b60145490680100000000000000008210156111a6576001820180601455821015614ea0576014600052805160209182015190911b63ffffffff191663ffffffff91909116177fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec90910155565b8054680100000000000000008110156111a65761542291600182018155614e88565b61544957815160209283015190921b63ffffffff191663ffffffff92909216919091179055565b634e487b7160e01b600052600060045260246000fd5b6014549091811591821561555a57615475611275565b60008152600060208201525b6154a261549b61526e60208401516001600160e01b031690565b9586615f57565b93159081615537575b50156154ec57611282906152b66154c185615dd4565b6014600052917fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb0190565b506112826154ff6153026152f743615e52565b61553261550b85615dd4565b615522615516611275565b63ffffffff9094168452565b6001600160e01b03166020830152565b615394565b5163ffffffff16905063ffffffff6155516152f743615e52565b911614386154ab565b601460005261558a7fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614eb6565b615481565b601454909181159182156155d2576155a5611275565b60008152600060208201525b6154a26155cb61526e60208401516001600160e01b031690565b9586615f4a565b60146000526156027fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4eb8201614eb6565b6155b1565b9091815491821592836000146156a25761561f611275565b60008152600060208201525b61564c61564561526e60208401516001600160e01b031690565b9687615f57565b9415908161567f575b501561566b576152b6611282926152a486615dd4565b50611282906153076153026152f743615e52565b5163ffffffff16905063ffffffff6156996152f743615e52565b91161438615655565b6156ba61538060001983018460005260206000200190565b61562b565b9192901561572057508151156156d3575090565b3b156156dc5790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156157335750805190602001fd5b61497d9060405191829162461bcd60e51b8352600483016107a5565b916107b6939161575e936158c1565b919091615786565b6005111561577057565b634e487b7160e01b600052602160045260246000fd5b61578f81615766565b806157975750565b6157a081615766565b600181036157ed5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6157f681615766565b600281036158435760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b8061584f600392615766565b1461585657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608490fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116159375791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156109245781516001600160a01b03811615615931579190565b50600190565b50505050600090600390565b6001600160a01b037f000000000000000000000000b38a560de616fcd2c091511b1c64350a049a3a5416301480615a34575b1561599e577fa9d008c2ad8f213be478c144a9e4ea58e4a21de6d07ef1f32b1dfc1c38fdb0f490565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f99150fbeb9fb882ed57616ff9bfef8992335a70b22e757956e2de5ceb8b8b74f60408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a08152615a2e81611237565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000014614615975565b604290615a68615943565b90604051917f19010000000000000000000000000000000000000000000000000000000000008352600283015260228201522090565b60ff8114615af45760ff811690601f8211615aca5760405191615ac0836111ab565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600e54816000615b078361168d565b808352602093600190818116908115615b905750600114615b31575b50506107b692500382611253565b90939150600e6000527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd936000915b818310615b785750506107b693508201013880615b23565b85548784018501529485019486945091830191615b60565b9150506107b694925060ff191682840152151560051b8201013880615b23565b60ff8114615bd25760ff811690601f8211615aca5760405191615ac0836111ab565b50604051600f54816000615be58361168d565b808352602093600190818116908115615b905750600114615c0e5750506107b692500382611253565b90939150600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802936000915b818310615c555750506107b693508201013880615b23565b85548784018501529485019486945091830191615c3d565b90808216911860011c8101809111610cc85790565b8015615dbc5780615d55615d4e615d44615d3a615d30615d26615d1c615d1260016107b69a6000908b60801c80615db0575b508060401c80615da3575b508060201c80615d96575b508060101c80615d89575b508060081c80615d7c575b508060041c80615d6f575b508060021c80615d62575b50821c615d5b575b811c1b615d0b818b613fc4565b0160011c90565b615d0b818a613fc4565b615d0b8189613fc4565b615d0b8188613fc4565b615d0b8187613fc4565b615d0b8186613fc4565b615d0b8185613fc4565b8092613fc4565b90615dc2565b8101615cfe565b6002915091019038615cf6565b6004915091019038615ceb565b6008915091019038615ce0565b6010915091019038615cd5565b6020915091019038615cca565b6040915091019038615cbf565b91505060809038615cb4565b50600090565b9080821015615dcf575090565b905090565b6001600160e01b0390818111615de8571690565b608460405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f32342062697473000000000000000000000000000000000000000000000000006064820152fd5b65ffffffffffff90818111615e65571690565b608460405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201527f38206269747300000000000000000000000000000000000000000000000000006064820152fd5b63ffffffff90818111615ee0571690565b608460405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f32206269747300000000000000000000000000000000000000000000000000006064820152fd5b908103908111610cc85790565b908101809111610cc8579056fea26469706673582212203013b806e85bf1310a17dd0b96c9e1b38aa9fbb58148abcfa5a8085965b1179c64736f6c63430008150033
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.