Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
BIFKN314
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 50 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "./BIFKNERC20.sol"; import "./BIFKN314LP.sol"; import "./PreventAutoSwap.sol"; import "./interfaces/IBIFKN314Factory.sol"; import "./interfaces/IBIFKN314CALLEE.sol"; import "./interfaces/IERC314Errors.sol"; import "./interfaces/IERC314Events.sol"; import "./interfaces/IERC314.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; /** * @title BIFKN314 * @dev This is a contract that implements the core functionality of the BIFKN314 token. * The contract is used to create a token that can be used for liquidity provision and swapping. * It follows the Automated Market Maker (AMM) model using the constant product formula. * The contract allows users to add and remove liquidity, swap tokens, and perform flash swaps. * The contract also accrues fees and distributes them to the feeTo address. * The contract is initialized with a supply cap. * The contract also maintains a reference to the BIFKN314LP contract for LP token management. * The contract allows for a factory address of address(0) to be set, which will disable fee distribution. * The contract owner can set the trading fee rate, maximum wallet percentage, and metadata URI. * The contract owner can also enable trading, set the fee collector address, and claim accrued trading fees. */ contract BIFKN314 is BIFKNERC20, ReentrancyGuard, PreventAutoSwap, IERC314Errors, IERC314Events, IERC314 { using Math for uint256; /** * @dev Represents the address constant for the dead address. * The dead address is a predefined address with all zeros, used to represent * an address that is no longer in use or has been destroyed. */ address private constant DEAD_ADDRESS = 0x000000000000000000000000000000000000dEaD; /** * @dev The minimum liquidity required for a transaction. */ uint256 public constant MINIMUM_LIQUIDITY = 10 ** 3; /** * @dev The `FLASHSWAP_FEE_RATE` constant represents the fee rate for flash swaps. * It is set to 30, which corresponds to a fee rate of 0.3%. */ uint256 public constant FLASHSWAP_FEE_RATE = 30; // 0.3% fee /** * @dev The base swap rate for the contract. * It represents a 0.3% fee for each swap. */ uint256 public constant BASE_SWAP_RATE = 30; // 0.3% fee /** * @dev The SCALE_FACTOR constant represents the scaling factor used in the contract. * It is set to 10000. */ uint256 public constant SCALE_FACTOR = 10000; /** * @dev The MAX_FEE_RATE constant represents the maximum fee rate that can be set. * It is set to 500, which corresponds to a fee rate of 5%. */ uint256 public constant MAX_FEE_RATE = 500; // 5% fee /** * @dev Represents the metadata URI for the contract. */ string public metadataURI; /** * @dev Represents the LP token contract for the BIFKN314 contract. */ BIFKN314LP public liquidityToken; /** * @dev A public boolean variable that indicates whether the contract is initialized or not. */ bool public isInitialized; /** * @dev A public boolean variable that indicates whether the contract factory is initialized or not. */ bool public factoryInitialized; /** * @dev A boolean variable indicating whether trading is enabled or not. * Once trading is enabled, it cannot be disabled. * Trading must be enabled before users can swap tokens. * Trading can only be enabled by the contract owner. * Trading is disabled by default. */ bool public tradingEnabled; /** * @dev A mapping that stores whether an address is exempt from the maximum wallet limit. */ mapping(address => bool) public isMaxWalletExempt; /** * @dev Represents the last cumulative price of the native asset. */ uint public price0CumulativeLast; /** * @dev Represents the last cumulative price of the token. */ uint public price1CumulativeLast; /** * @dev Represents the timestamp of the last block for enabling twap */ uint32 public blockTimestampLast; /** * @dev The address of the factory contract. */ IBIFKN314Factory public factory; /** * @dev The maximum percentage of the total supply that a wallet can hold. * For example, a value of 100 represents 1% of the total supply. */ uint256 public maxWalletPercent; /** * @dev A boolean variable that indicates whether the maximum wallet limit is enabled or not. */ bool public maxWalletEnabled; /** * @dev Public variable to store the accrued native fees. */ uint256 public accruedNativeFactoryFees; /** * @dev Public variable to store the amount of accrued token fees. */ uint256 public accruedTokenFactoryFees; /** * @dev The tradingFeeRate variable represents the rate at which trading fees are charged. * It is a public variable, meaning it can be accessed and modified by other contracts and external accounts. * The value of tradingFeeRate is a uint256, which represents a non-negative integer. * If the value of tradingFeeRate is 0, no trading fees are charged. * If the value of tradingFeeRate is 500, a trading fee of 5% is charged. */ uint256 public tradingFeeRate; /** * @dev Public variable to store the accrued trading fees. */ uint256 public accruedNativeTradingFees; /** * @dev Public variable to store the accrued token trading fees. */ uint256 public accruedTokenTradingFees; /** * @dev The address of the fee collector. */ address public feeCollector; /** * @dev The address of the contract owner. */ address public owner; /** * @dev Modifier that allows only the contract owner to execute the function. * Throws an error if the caller is not the owner. */ modifier onlyOwner() { if (_msgSender() != owner) revert Unauthorized(_msgSender()); _; } /** * @dev Modifier that allows only the fee collector to execute the function. * Throws an error if the caller is not the fee collector. */ modifier onlyFeeCollector() { if (_msgSender() != feeCollector) revert Unauthorized(_msgSender()); _; } /** * @dev Modifier to ensure that a transaction is executed before the specified deadline. * @param deadline The deadline timestamp after which the transaction is considered expired. * @notice This modifier reverts the transaction if the current block timestamp is greater than or equal to the deadline. */ modifier ensureDeadline(uint deadline) { if (block.timestamp >= deadline) revert TransactionExpired(); _; } /** * @dev Constructor function for the BIFKN314 contract. * It initializes the contract by calling the constructor of the BIFKNERC20 contract. * If the message sender is a contract, it sets the factory address to the message sender. * If the message sender is not a contract, it sets the factory address to address(0). * Finally, it transfers the ownership of the contract to the message sender. */ constructor() BIFKNERC20() { address sender = _msgSender(); _transferOwnership(sender); } /** * @dev Initializes the factory contract with a new owner. * @param newOwner The address of the new owner. * @notice This function can only be called once to initialize the factory contract. * @notice Once initialized, the ownership of the contract will be transferred to the factory contract. * @notice If the factory contract has already been initialized, calling this function will revert. */ function initializeFactory(address newOwner) external { if (factoryInitialized) revert OwnerAlreadyInitialized(); factoryInitialized = true; factory = IBIFKN314Factory(newOwner); _transferOwnership(address(factory)); } /** * @dev Initializes the contract with the given name and symbol. * Only the contract owner can call this function. * * @param tokenName The name of the contract. * @param tokenSymbol The symbol of the contract. */ function initialize( string memory tokenName, string memory tokenSymbol ) public override onlyOwner { super.initialize(tokenName, tokenSymbol); liquidityToken = new BIFKN314LP(); liquidityToken.initialize( string(abi.encodePacked(tokenName, " LP Token")), string("BLP") ); } /** * @dev Sets the total supply and mints tokens to the specified owner. * @param totalSupply_ The total supply of tokens to be minted. * @param owner_ The address of the owner to receive the minted tokens. * @param feeRate_ The trading fee rate to be set. * @param maxWalletPercent_ The maximum wallet percentage to be set. * @param metadataURI_ The metadata URI to be set. * @notice Only the contract owner can call this function. * @notice The total supply must be greater than zero. * @notice The total supply must not have been already minted. * @notice The owner address must not be the zero address. */ function setSupplyAndMint( uint256 totalSupply_, address owner_, uint256 feeRate_, uint256 maxWalletPercent_, string memory metadataURI_ ) public onlyOwner { if (totalSupply_ == 0) { revert AmountMustBeGreaterThanZero(); } if (totalSupply() > 0) { revert SupplyAlreadyMinted(); } if (owner_ == address(0)) { revert InvalidOwner(); } if (maxWalletPercent_ > 0) { maxWalletEnabled = true; setMaxWalletPercent(maxWalletPercent_); } metadataURI = metadataURI_; setTradingFeeRate(feeRate_); _transferOwnership(owner_); feeCollector = owner_; super._mint(owner_, totalSupply_); } /** * @dev Transfers tokens from the sender to the recipient. * Overrides the transfer function from the inherited contract. * If the recipient is this contract and autoSwap is not prevented, * then it automatically swaps tokens to native currency. * Otherwise, calls the transfer function from the inherited contract. * @param recipient The address receiving the tokens. * @param amount The amount of tokens to transfer. * @return success A boolean indicating the success of the transfer. */ function transfer( address recipient, uint256 amount ) public override returns (bool success) { if (recipient == address(this) && !_autoSwapIsPrevented()) { swapTokenToNative( amount, _calculateAutoSwapSlippage(amount, false), block.timestamp + 3 minutes ); success = true; } else { _checkMaxWallet(recipient, amount); success = super.transfer(recipient, amount); } } /** * @dev Internal function to transfer tokens from one address to another. * Overrides the internal transfer function from the inherited contract. * Calls the transfer function from the inherited contract. * This function is specifically used when transferring tokens to the contract * for the purpose of adding liquidity, swapping, or flash swapping. * @param from The address to transfer tokens from. * @param to The address to transfer tokens to. * @param value The amount of tokens to transfer. */ function _internalTransfer( address from, address to, uint256 value ) internal { super._transfer(from, to, value); } /** * @dev Adds liquidity to the contract by depositing tokens and native currency. * @param amountToken_ The amount of tokens to be deposited. * @param recipient The address of the recipient of the liquidity tokens. * @param deadline The deadline in unix time from the current timestamp for the transaction to occur. * @return liquidity The amount of liquidity tokens minted. */ function addLiquidity( uint256 amountToken_, address recipient, uint256 deadline ) public payable nonReentrant ensureDeadline(deadline) returns (uint256 liquidity) { address sender = _msgSender(); // check if contract is initialized // only owner can add liquidity before initialization if (!isInitialized && sender != owner) { revert ContractIsNotInitialized(); } if (amountToken_ == 0 || msg.value == 0) { revert AmountMustBeGreaterThanZero(); } // get reserves (uint256 nativeReserve, uint256 tokenReserve) = getReserves(); // the native reserve is the balance of the contract minus the value sent nativeReserve = nativeReserve - msg.value; uint256 lpTotalSupply = liquidityToken.totalSupply(); uint256 amountNative = msg.value; uint256 amountToken = amountToken_; if (lpTotalSupply == 0) { uint256 _amountProduct = Math.sqrt(amountNative * amountToken); liquidity = _amountProduct - MINIMUM_LIQUIDITY; // Set owner of the first MINIMUM_LIQUIDITY tokens to the zero address liquidityToken.mint(DEAD_ADDRESS, MINIMUM_LIQUIDITY); // Liquidity is initialized isInitialized = true; } else { if (nativeReserve == 0 || tokenReserve == 0) revert InvalidReserves(); // Determine the amount of token required to add liquidity // according to the native amount sent amountToken = (amountNative * tokenReserve) / nativeReserve; uint256 currentKValue = _calculateKValue( nativeReserve, tokenReserve ); if (amountToken_ < amountToken) { revert AmountOfTokensLessThanMinimumRequired( amountToken_, amountToken ); } /** * @dev Calculates the liquidity amount based on the given amounts of native currency and token. * The liquidity amount is determined by taking the minimum of two calculations: * 1. (amountNative * lpTotalSupply) / _nativeReserve * 2. (amountToken * lpTotalSupply) / _tokenReserve */ liquidity = Math.min( (amountNative * lpTotalSupply) / nativeReserve, (amountToken * lpTotalSupply) / tokenReserve ); /** * @dev Updates the reserves and checks the liquidity ratio. * The new k value is calculated by multiplying the new token reserve by the new native reserve. * If the new k value is less than the current k value, the transaction is reverted. */ uint256 newNativeReserve = nativeReserve + amountNative; uint256 newTokenReserve = tokenReserve + amountToken; uint256 newKValue = newTokenReserve * newNativeReserve; if (newKValue < currentKValue) { revert DecreasesK(); } } // check if liquidity is greater than 0 if (liquidity == 0) { revert InsufficientLiquidityMinted(); } // mint liquidity tokens to the liquidity provider liquidityToken.mint(recipient, liquidity); // Only transfer the necessary amount of tokens _internalTransfer(sender, address(this), amountToken); _updatePrices(); emit AddLiquidity(sender, recipient, liquidity, msg.value, amountToken); } /** * @dev Removes liquidity from the contract by transferring native currency and tokens back to the liquidity provider. * @param amount The amount of liquidity to be removed. * @param recipient The address of the recipient of the native currency and tokens. * @param deadline The deadline in unix time from the current timestamp for the transaction to occur. * @return nativeAmount The amount of native currency received. * @return tokenAmount The amount of tokens received. * @notice The liquidity provider must have sufficient liquidity balance. */ function removeLiquidity( uint256 amount, address recipient, uint256 deadline ) public nonReentrant ensureDeadline(deadline) returns (uint256 nativeAmount, uint256 tokenAmount) { address sender = _msgSender(); if (!isInitialized) { revert ContractIsNotInitialized(); } uint256 lpTokenBalance = liquidityToken.balanceOf(sender); if (lpTokenBalance == 0) { revert YouHaveNoLiquidity(); } if (amount > lpTokenBalance) { revert InsufficientLiquidity(); } (nativeAmount, tokenAmount) = getAmountsForLP(amount); liquidityToken.burnFrom(sender, amount); _transferNative(recipient, nativeAmount); super._transfer(address(this), recipient, tokenAmount); emit RemoveLiquidity( sender, recipient, amount, nativeAmount, tokenAmount ); _updatePrices(); } /** * @dev Swaps native currency to tokens. * @param minimumTokensOut The minimum amount of tokens to receive in the swap. * @param deadline The deadline in unix time from current timestamp for the swap to occur. */ function swapNativeToToken( uint256 minimumTokensOut, uint256 deadline ) public payable nonReentrant ensureDeadline(deadline) { (uint256 nativeReserve, uint256 tokenReserve) = getReserves(); uint256 nativeIn = msg.value; address sender = _msgSender(); nativeReserve = nativeReserve - nativeIn; (uint256 tokensBought, uint256 factoryFee, uint256 tradingFee) = _swap( nativeIn, minimumTokensOut, nativeReserve, tokenReserve ); accruedNativeTradingFees += tradingFee; _handleFactoryFees(factoryFee, true); _checkMaxWallet(sender, tokensBought); super._transfer(address(this), sender, tokensBought); _updatePrices(); emit Swap(sender, 0, nativeIn, tokensBought, 0, false); } /** * @dev Swaps a specified amount of tokens for native currency. * @param tokensSold The amount of tokens to be sold. * @param minimumNativeOut The minimum amount of native currency expected to be received. * @param deadline The deadline in unix time from current timestamp for the swap to occur. */ function swapTokenToNative( uint256 tokensSold, uint256 minimumNativeOut, uint256 deadline ) public nonReentrant ensureDeadline(deadline) { (uint256 nativeReserve, uint256 tokenReserve) = getReserves(); address sender = _msgSender(); (uint256 nativeBought, uint256 factoryFee, uint256 tradingFee) = _swap( tokensSold, minimumNativeOut, tokenReserve, nativeReserve ); accruedTokenTradingFees += tradingFee; _handleFactoryFees(factoryFee, false); _internalTransfer(sender, address(this), tokensSold); _transferNative(sender, nativeBought); _updatePrices(); emit Swap(sender, tokensSold, 0, 0, nativeBought, false); } /** * @dev Executes a flash swap transaction. * @param recipient The address of the recipient of the flash swap. * @param amountNativeOut The amount of native currency to be sent to the recipient. * @param amountTokenOut The amount of tokens to be sent to the recipient. * @param data Additional data to be passed to the recipient. */ function flashSwap( address recipient, uint256 amountNativeOut, uint256 amountTokenOut, bytes calldata data ) external nonReentrant preventAutoSwap { if (!isInitialized) revert ContractIsNotInitialized(); if (!tradingEnabled) revert SwapNotEnabled(); if (amountNativeOut == 0 && amountTokenOut == 0) revert AmountMustBeGreaterThanZero(); if (recipient == address(0) || recipient == address(this)) revert InvalidRecipient(); (uint256 nativeReserve, uint256 tokenReserve) = getReserves(); if (amountNativeOut > nativeReserve || amountTokenOut > tokenReserve) revert InsufficientLiquidity(); address sender = _msgSender(); if (amountNativeOut > 0) { // Sending native currency _transferNative(recipient, amountNativeOut); } if (amountTokenOut > 0) { // Sending token _checkMaxWallet(recipient, amountTokenOut); super._transfer(address(this), recipient, amountTokenOut); } IBIFKN314CALLEE(recipient).BIFKN314CALL( sender, amountNativeOut, amountTokenOut, data ); (uint256 nativeReserveAfter, uint256 tokenReserveAfter) = getReserves(); uint amountNativeIn = nativeReserveAfter > nativeReserve ? nativeReserveAfter - nativeReserve : 0; uint amountTokenIn = tokenReserveAfter > tokenReserve ? tokenReserveAfter - tokenReserve : 0; if (amountNativeIn == 0 && amountTokenIn == 0) { revert TokenRepaymentFailed(); } { uint256 totalFees = FLASHSWAP_FEE_RATE + tradingFeeRate; uint256 nativeReserveAdjusted = (nativeReserveAfter * SCALE_FACTOR) - (amountNativeIn * totalFees); uint256 tokenReserveAdjusted = (tokenReserveAfter * SCALE_FACTOR) - (amountTokenIn * totalFees); if ( nativeReserveAdjusted * tokenReserveAdjusted < nativeReserve * tokenReserve * (SCALE_FACTOR ** 2) ) { revert DecreasesK(); } } accruedNativeTradingFees += _calculateTradingFee(amountNativeIn); accruedTokenTradingFees += _calculateTradingFee(amountTokenIn); _handleFactoryFees(_calculateFactoryFee(amountNativeIn), true); _handleFactoryFees(_calculateFactoryFee(amountTokenIn), false); _updatePrices(); emit Swap( sender, amountTokenIn, amountNativeIn, amountTokenOut, amountNativeOut, true ); } /** * @dev Calculates the amount of output tokens based on the input amount and reserves. * This accounts for all fees including the factory fee, trading fee, and base swap rate. * @param inputAmount The amount of input tokens. * @param inputReserve The amount of input tokens in the reserve. * @param outputReserve The amount of output tokens in the reserve. * @return outputAmount The amount of output tokens. * @return factoryFee The amount of factory fee. * @return tradingFee The amount of trading fee. */ function getAmountOut( uint256 inputAmount, uint256 inputReserve, uint256 outputReserve ) public view returns (uint256 outputAmount, uint256 factoryFee, uint256 tradingFee) { // Scale by 1e4 to avoid rounding errors // Since the SCALE_FACTOR is 1e4, the precision total is 1e8 // This strikes a good balance between risk of overflow and precision uint256 precision = 1e4; uint256 feeFactor = SCALE_FACTOR - (BASE_SWAP_RATE + tradingFeeRate); uint256 inputAmountScaled = inputAmount * precision; // if reserves are greater than 0 if (inputReserve > 0 && outputReserve > 0) { factoryFee = _calculateFactoryFee(inputAmountScaled) / precision; tradingFee = _calculateTradingFee(inputAmountScaled) / precision; uint256 inputAmountWithFee = inputAmountScaled * feeFactor; uint256 numerator = inputAmountWithFee * outputReserve; uint256 denominator = (inputReserve * SCALE_FACTOR * precision) + inputAmountWithFee; unchecked { outputAmount = numerator / denominator; } } else { revert InvalidReserves(); } } /** * @dev Calculates the input amount and factory fee based on the output amount, output reserve, and input reserve. * This accounts for all fees including the factory fee, trading fee, and base swap rate. * @param outputAmount The desired output amount. * @param outputReserve The current output reserve. * @param inputReserve The current input reserve. * @return inputAmount The calculated input amount. */ function getAmountIn( uint256 outputAmount, uint256 inputReserve, uint256 outputReserve ) public view returns (uint256 inputAmount) { // Scale by 1e4 to avoid rounding errors // Since the SCALE_FACTOR is 1e4, the precision total is 1e8 // This strikes a good balance between risk of overflow and precision uint256 precision = 1e4; uint256 feeFactor = SCALE_FACTOR - (BASE_SWAP_RATE + tradingFeeRate); feeFactor = feeFactor * precision; // Ensure reserves are greater than 0 if (outputReserve > 0 && inputReserve > 0) { uint256 numerator = inputReserve * outputAmount * SCALE_FACTOR * precision; uint256 denominator = (outputReserve - outputAmount) * feeFactor; unchecked { inputAmount = (numerator / denominator) + 1; } } else { revert InvalidReserves(); } } /** * @dev Returns the number of tokens held by the contract. * @return tokenBalance The token balance of the contract. */ function getTokensInContract() public view returns (uint256 tokenBalance) { tokenBalance = super.balanceOf(address(this)); } /** * @dev Returns the reserves of the contract. * If the fees are greater than the reserves, the function returns 0 for the respective reserve. * @return amountNative The native reserve balance. * @return amountToken The token reserve balance. */ function getReserves() public view returns (uint256 amountNative, uint256 amountToken) { uint256 totalNative = address(this).balance; uint256 totalNativeFees = accruedNativeTradingFees + accruedNativeFactoryFees; uint256 totalToken = getTokensInContract(); uint256 totalTokenFees = accruedTokenTradingFees + accruedTokenFactoryFees; amountNative = totalNative >= totalNativeFees ? totalNative - totalNativeFees : 0; amountToken = totalToken >= totalTokenFees ? totalToken - totalTokenFees : 0; } /** * @dev Gets the amount of tokens held by the liquidity provider. * @param amount The amount of liquidity tokens to be converted. * @return nativeAmount The amount of native currency held by the liquidity provider. * @return tokenAmount The amount of tokens held by the liquidity provider. */ function getAmountsForLP( uint256 amount ) public view returns (uint256 nativeAmount, uint256 tokenAmount) { if (amount == 0) revert AmountMustBeGreaterThanZero(); (uint256 nativeReserve, uint256 tokenReserve) = getReserves(); if (nativeReserve == 0 || tokenReserve == 0) revert InvalidReserves(); uint256 totalLPSupply = liquidityToken.totalSupply(); if (totalLPSupply == 0) revert InsufficientLiquidity(); nativeAmount = (amount * nativeReserve) / totalLPSupply; tokenAmount = (amount * tokenReserve) / totalLPSupply; if (nativeAmount == 0 || tokenAmount == 0) revert InsufficientLiquidity(); } /** * @dev Enables trading by setting the `tradingEnabled` flag to true. * Can only be called by the contract owner. * Once trading is enabled, it cannot be disabled. */ function setTradingEnabled() public onlyOwner { tradingEnabled = true; } /** * @dev Sets the fee collector address. * @param feeCollector_ The address of the fee collector. * @notice Only the contract owner can call this function. * @notice The fee collector address cannot be set to the zero address. */ function setFeeCollector(address feeCollector_) external onlyOwner { if (feeCollector_ == address(0)) revert InvalidAddress(); feeCollector = feeCollector_; } /** * @dev Sets the fee rate for trading. * @param feeRate The new fee rate to be set. * Requirements: * - `feeRate` must be less than or equal to 50 (5%). * Only the contract owner can call this function. */ function setTradingFeeRate(uint256 feeRate) public onlyOwner { if (feeRate > MAX_FEE_RATE) revert InvalidFeeRate(); // 5% tradingFeeRate = feeRate; } /** * @dev Sets the maximum wallet percentage. * @param maxWalletPercent_ The maximum wallet percentage to be set. * Requirements: * - `maxWalletPercent_` must be less than or equal to 10000 (100%) * and greater than 0 if maxWalletEnabled is true. * Only the contract owner can call this function. */ function setMaxWalletPercent(uint256 maxWalletPercent_) public onlyOwner { if (maxWalletPercent_ > 10000) revert InvalidMaxWalletPercent(); // 100% if (maxWalletEnabled && maxWalletPercent_ == 0) revert InvalidMaxWalletPercent(); maxWalletPercent = maxWalletPercent_; } /** * @dev Enables or disables the maximum wallet limit. * @param enabled The boolean value to set the maximum wallet limit. * Requirements: * - Only the contract owner can call this function. */ function setMaxWalletEnabled(bool enabled) public onlyOwner { if (enabled && maxWalletPercent == 0) revert InvalidMaxWalletPercent(); maxWalletEnabled = enabled; } /** * @dev Sets the metadata URI for the token. * @param newURI The new metadata URI to be set. * Requirements: * - Only the contract owner can call this function. */ function setMetadataURI(string memory newURI) public onlyOwner { metadataURI = newURI; } /** * @dev Sets the maximum wallet exemption status for a given address. * @param addressToChange The address for which the maximum wallet exemption status is to be set. * @param isExempt A boolean value indicating whether the address should be exempt from the maximum wallet limit. * Only the contract owner can call this function. * Requirements: * - The address to change cannot be the zero address, the contract address, or the dead address. * @notice If the address to change is the zero address, the contract address, or the dead address, the transaction will revert. */ function setMaxWalletExempt( address addressToChange, bool isExempt ) public onlyOwner { if ( addressToChange == address(0) || addressToChange == address(this) || addressToChange == DEAD_ADDRESS ) revert InvalidAddress(); isMaxWalletExempt[addressToChange] = isExempt; } /** * @dev Allows the fee collector to claim accrued trading fees. * The function transfers the accrued native currency and token trading fees to the fee collector. * The accrued amounts are reset to zero after the transfer. * Emits a `FeesCollected` event with the fee collector's address, accrued native amount, and accrued token amount. * * Requirements: * - The caller must be the fee collector. */ function claimFees() external onlyFeeCollector { uint256 accruedNativeAmount = accruedNativeTradingFees; uint256 accruedTokenAmount = accruedTokenTradingFees; address sender = _msgSender(); if (accruedNativeAmount == 0 && accruedTokenAmount == 0) revert NoFeesToClaim(); accruedNativeTradingFees = 0; // If the accrued token amount is greater than the balance of the contract // set the accrued token amount to the balance of the contract if (accruedTokenAmount > getTokensInContract()) accruedTokenAmount = getTokensInContract(); accruedTokenTradingFees = 0; _transferNative(sender, accruedNativeAmount); super._transfer(address(this), sender, accruedTokenAmount); emit FeesCollected(sender, accruedNativeAmount, accruedTokenAmount); } /** * @dev Transfers the ownership of the contract to a new address. * Can only be called by the current owner. * * @param newOwner The address of the new owner. */ function transferOwnership(address newOwner) public onlyOwner { if (newOwner == address(0)) revert InvalidOwner(); _transferOwnership(newOwner); } /** * @dev Allows the current owner to renounce their ownership. * It sets the owner address to 0, effectively removing the ownership. */ function renounceOwnership() external onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers the ownership of the contract to a new address. * Can only be called by the current owner. * * @param newOwner The address of the new owner. * @notice Emits an {OwnershipTransferred} event. */ function _transferOwnership(address newOwner) internal { address oldOwner = owner; owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev Calculates the product of two input values. * @param reserve1 The first input value. * @param reserve2 The second input value. * @return kValue_ The product of the two input values. */ function _calculateKValue( uint256 reserve1, uint256 reserve2 ) internal pure returns (uint256 kValue_) { kValue_ = reserve1 * reserve2; } /** * @dev Internal function to calculate the trading fee for a given amount. * @param amount The amount to apply the fee to. * @return amountForFee The amount to be deducted as a trading fee. * @notice If the amount is zero, the transaction will revert. * @notice If the trading fee rate is zero, the function will return zero. * @notice If the trading fee rate is 500, the function will return 5% of the amount. */ function _calculateTradingFee( uint256 amount ) internal view returns (uint256 amountForFee) { // If the trading fee rate is 0, return 0 if (tradingFeeRate == 0) amountForFee = 0; else { amountForFee = (amount * tradingFeeRate) / SCALE_FACTOR; } } /** * @dev Calculates the factory fee based on the input amount. * @param inputAmount The input amount for which the factory fee needs to be calculated. * @return amountForFee The amount to be deducted as a factory fee. * @notice If the input amount is zero, the transaction will revert. * @notice If the factory contract is not set, the function will return zero. */ function _calculateFactoryFee( uint256 inputAmount ) internal view returns (uint256 amountForFee) { if (address(factory) == address(0)) { amountForFee = 0; } else { amountForFee = (inputAmount * factory.feeRate()) / SCALE_FACTOR; } } /** * @dev Checks if the recipient's wallet balance exceeds the maximum allowed amount. * @param recipient The address of the recipient. * @param amount The amount to be transferred. * @notice If the max wallet limit is exceeded, the transaction will revert. */ function _checkMaxWallet(address recipient, uint256 amount) internal view { if (!maxWalletEnabled) return; // Skip if max wallet is not enabled // Only apply the max wallet check if the recipient is not (this) contract, address(0), or the dead address // and if the recipient is not exempt from the max wallet limit if ( recipient == address(this) || recipient == address(0) || recipient == DEAD_ADDRESS || isMaxWalletExempt[recipient] ) { return; } uint256 maxWalletAmount = ((totalSupply() * maxWalletPercent) / 10000); if (balanceOf(recipient) + amount > maxWalletAmount) { revert MaxWalletAmountExceeded(); } } /** * @dev Internal function to check for swap errors. * @param tokensSold The number of tokens sold in the swap. * @param nativeReserve The native reserve balance. * @param tokenReserve The token reserve balance. * @notice If the contract is not initialized, the transaction will revert. * @notice If the reserves are invalid, the transaction will revert. * @notice If the swap is not enabled, the transaction will revert. * @notice If the amount of tokens sold is zero, the transaction will revert. */ function _checkForSwapErrors( uint256 tokensSold, uint256 nativeReserve, uint256 tokenReserve ) internal view { if (!isInitialized) revert ContractIsNotInitialized(); if (!tradingEnabled) revert SwapNotEnabled(); if (tokensSold == 0) { revert AmountMustBeGreaterThanZero(); } if (nativeReserve == 0 || tokenReserve == 0) revert InvalidReserves(); } /** * @dev Performs a swap operation between two reserves. * @param amountIn The amount of tokens being swapped in. * @param minimumAmountOut The minimum amount of tokens expected to be received. * @param reserveIn The reserve of the input token. * @param reserveOut The reserve of the output token. * @return amountOut The amount of tokens received after the swap. * @return factoryFee The fee charged by the factory for the swap. * @return tradingFee The fee charged for the swap. */ function _swap( uint256 amountIn, uint256 minimumAmountOut, uint256 reserveIn, uint256 reserveOut ) internal view returns (uint256 amountOut, uint256 factoryFee, uint256 tradingFee) { _checkForSwapErrors(amountIn, reserveIn, reserveOut); uint256 currentKValue = _calculateKValue(reserveIn, reserveOut); (amountOut, factoryFee, tradingFee) = getAmountOut( amountIn, reserveIn, reserveOut ); if (amountOut == 0) revert BoughtAmountTooLow(); if (amountOut < minimumAmountOut) revert SlippageToleranceExceeded(); uint256 newReserveIn = reserveIn + (amountIn - tradingFee - factoryFee); uint256 newReserveOut = reserveOut - amountOut; if (_calculateKValue(newReserveIn, newReserveOut) < currentKValue) revert DecreasesK(); } /** * @dev Calculates the cumulative prices based on the provided native and token reserves. */ function _updatePrices() private { (uint256 nativeReserve, uint256 tokenReserve) = getReserves(); if (nativeReserve == 0 || tokenReserve == 0) revert InvalidReserves(); uint32 blockTimestamp = uint32(block.timestamp % 2 ** 32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // Overflow is desired if (timeElapsed > 0 && nativeReserve != 0 && tokenReserve != 0) { // Simulate fixed-point precision using a scaling factor uint256 scalingFactor = 2 ** 112; // Calculate price ratios with scaling to simulate UQ112x112 precision // Reflects the price of token in native currency uint256 price0Ratio = (nativeReserve * scalingFactor) / tokenReserve; // Reflects the price of native currency in token uint256 price1Ratio = (tokenReserve * scalingFactor) / nativeReserve; // Update cumulative prices price0CumulativeLast += price0Ratio * timeElapsed; price1CumulativeLast += price1Ratio * timeElapsed; // Update last block timestamp blockTimestampLast = blockTimestamp; } emit PricesUpdated( price0CumulativeLast, price1CumulativeLast, blockTimestampLast ); } /** * @dev Accrues fees to the contract. * @param factoryFee The amount of fees to be accrued. * @param native A boolean value indicating whether the fee is in native currency or not. */ function _handleFactoryFees(uint256 factoryFee, bool native) internal { // Check if the factory contract is set if (address(factory) != address(0)) { address feeTo = factory.feeTo(); uint256 distributionThreshold = factory.feeDistributionThreshold(); // Accrue fees and distribute if threshold is reached if (feeTo != address(0)) { if (native) { accruedNativeFactoryFees += factoryFee; } else { accruedTokenFactoryFees += factoryFee; } _distributeFees(feeTo, distributionThreshold); } } } /** * @dev Distributes fees to a specified address if the distribution threshold is reached. * @param feeTo The address to which the fees will be distributed. * @param distributionThreshold The threshold at which fees will be distributed. */ function _distributeFees( address feeTo, uint256 distributionThreshold ) internal { uint256 nativeFees = accruedNativeFactoryFees; uint256 tokenFees = accruedTokenFactoryFees; bool nativeDistributed = false; bool tokenDistributed = false; // Only distribute fees if either the native or token fees are greater than 0 if (nativeFees == 0 && tokenFees == 0) return; // Distribute native fees if threshold is reached if (nativeFees > 0 && nativeFees >= distributionThreshold) { accruedNativeFactoryFees = 0; nativeDistributed = true; } // Distribute token fees if threshold is reached if (tokenFees > 0) { (uint256 nativeReserve, uint256 tokenReserve) = getReserves(); uint256 nativeAmount = (tokenFees * nativeReserve) / tokenReserve; if (nativeAmount >= distributionThreshold) { if (tokenFees > getTokensInContract()) { tokenFees = getTokensInContract(); } accruedTokenFactoryFees = 0; tokenDistributed = true; } } if (nativeDistributed) _transferNative(feeTo, nativeFees); if (tokenDistributed) super._transfer(address(this), feeTo, tokenFees); // Emit event if fees are distributed if (nativeDistributed || tokenDistributed) emit FeesDistributed(feeTo, nativeFees, tokenFees); } /** * @dev Internal function to transfer native currency to a specified address. * @param to The address to transfer the native currency to. * @param amount The amount of native currency to transfer. * @notice If the transfer fails, the transaction will revert. */ function _transferNative(address to, uint256 amount) internal { if (amount == 0) return; if (to == address(0)) revert InvalidAddress(); if (amount > address(this).balance) { amount = address(this).balance; } (bool success, ) = payable(to).call{value: amount}(""); if (!success) revert FailedToSendNativeCurrency(); } /** * @dev Checks if the given address is a contract. * @param addressToCheck The address to check. * @return result A boolean value indicating whether the address is a contract. */ function _isContract( address addressToCheck ) internal view returns (bool result) { uint32 size; // Inline assembly code to get the size of the code at _address assembly { size := extcodesize(addressToCheck) } // If size > 0, it's a contract result = (size > 0); } /** * @dev Calculates the fee based on the given amount. * @param amount The amount for which the fee needs to be calculated. * @return flashswapFee The calculated fee. */ function _calculateFlashswapFee( uint256 amount ) internal pure returns (uint256 flashswapFee) { flashswapFee = (amount * FLASHSWAP_FEE_RATE) / SCALE_FACTOR; // Fee calculation } /** * @dev Calculates the minimum amount out with slippage for an auto swap. * @param amount The input amount. * @param isNative A boolean indicating whether the input is in the native token or not. * @return amountOutMin The minimum amount out with slippage. */ function _calculateAutoSwapSlippage( uint256 amount, bool isNative ) internal view returns (uint256 amountOutMin) { (uint256 nativeReserve, uint256 tokenReserve) = getReserves(); (uint256 amountOut, , ) = getAmountOut( amount, isNative ? nativeReserve : tokenReserve, isNative ? tokenReserve : nativeReserve ); amountOutMin = amountOut - (amountOut / 20); // 5% slippage } // Function to receive native /** * @dev Fallback function to receive native currency. * It calls the `swapNativeToToken` function with a minimum token out amount of 0 (i.e. infinite slippage). */ receive() external payable { if (!_autoSwapIsPrevented()) { swapNativeToToken( _calculateAutoSwapSlippage(msg.value, true), block.timestamp + 3 minutes ); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import "./BIFKNERC20.sol"; /** * @title BIFKN314LP * @dev Implementation of the liquidity provider (LP) token for the BIFKN314 AMM pool. */ contract BIFKN314LP is BIFKNERC20 { /** * @dev The address of the Automated Market Maker (AMM) contract. */ address public immutable ammAddress; error Unauthorized(address sender); /** * @dev Modifier that allows only the owner (amm) to call the function. * If the caller is not the owner, it will revert with an `OnlyOwnerError` error. */ modifier onlyOwner() { if (_msgSender() != ammAddress) revert Unauthorized(_msgSender()); _; } /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor() BIFKNERC20() { ammAddress = _msgSender(); } /** * @dev Initializes the contract with the given name and symbol. * * This function is called by the contract owner to initialize the contract. * It sets the name and symbol of the contract by calling the `initialize` function * of the parent contract. * * @param tokenName The name of the contract. * @param tokenSymbol The symbol of the contract. */ function initialize( string memory tokenName, string memory tokenSymbol ) public override onlyOwner { super.initialize(tokenName, tokenSymbol); } /** * @dev Function to mint tokens * * Requirements: * - the caller must be the BIFKN314 contract. * * @param account The address that will receive the minted tokens. * @param amount The amount of tokens to mint. */ function mint(address account, uint256 amount) public onlyOwner { super._mint(account, amount); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import "./ERC20.sol"; /** * @title BIFKNERC20 * @dev This contract represents the BIFKNERC20 token. */ contract BIFKNERC20 is ERC20 { /** * @dev The `DOMAIN_SEPARATOR` is a unique identifier for the contract domain. * It is used to prevent replay attacks and to ensure that the contract is interacting with the correct domain. */ bytes32 public DOMAIN_SEPARATOR; /** * @dev The hash of the permit type used in the EIP-2612 permit function. */ bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; /** * @dev A mapping that stores the nonces for each address. * Nonces are used to prevent replay attacks in certain operations. * The key of the mapping is the address and the value is the nonce. */ mapping(address => uint256) public nonces; /** * @dev Error indicating that the name and symbol must not be empty. */ error NameAndSymbolMustNotBeEmpty(); /** * @dev Error indicating that the name and symbol of the ERC20 token have already been set. */ error NameAndSymbolAlreadySet(); /** * @dev Error indicating that the signature has expired for ERC2612. * @param deadline The timestamp representing the expiration deadline. */ error ERC2612ExpiredSignature(uint256 deadline); /** * @dev Error indicating that the signer is invalid. * @param signer The address of the invalid signer. * @param owner The address of the token owner. */ error ERC2612InvalidSigner(address signer, address owner); /** * @dev Constructor function for the BIFKNERC20 contract. * It initializes the ERC20 contract and the EIP712 contract. * It also sets the DOMAIN_SEPARATOR variable using the _domainSeparatorV4 function. */ constructor() ERC20() {} /** * @dev Initializes the ERC20 token with the given name and symbol. * @param tokenName The name of the token. * @param tokenSymbol The symbol of the token. */ function initialize( string memory tokenName, string memory tokenSymbol ) public virtual { if (bytes(tokenName).length == 0 || bytes(tokenSymbol).length == 0) { revert NameAndSymbolMustNotBeEmpty(); } if (bytes(_name).length != 0 || bytes(_symbol).length != 0) { revert NameAndSymbolAlreadySet(); } _name = tokenName; _symbol = tokenSymbol; DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(bytes(_name)), keccak256(bytes("1")), block.chainid, address(this) ) ); } /** * @dev Allows `owner` to approve `spender` to spend `value` tokens on their behalf using a signed permit. * @param owner The address of the token owner. * @param spender The address of the spender. * @param value The amount of tokens to be approved. * @param deadline The deadline timestamp for the permit. * @param v The recovery id of the permit signature. * @param r The r value of the permit signature. * @param s The s value of the permit signature. * Requirements: * - The permit must not be expired (deadline not reached). * - The permit signature must be valid. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { if (deadline < block.timestamp) { revert ERC2612ExpiredSignature(deadline); } bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, keccak256( abi.encode( PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline ) ) ) ); address recoveredAddress = ecrecover(digest, v, r, s); if (recoveredAddress == address(0) || recoveredAddress != owner) { revert ERC2612InvalidSigner(recoveredAddress, owner); } _approve(owner, spender, value); } /** * @dev Burns a specific amount of tokens from the caller's balance. * @param value The amount of tokens to be burned. */ function burn(uint256 value) public virtual { _burn(_msgSender(), value); } /** * @dev Burns a specific amount of tokens from the specified account. * * Requirements: * - The caller must have an allowance for `account`'s tokens of at least `value`. * * Emits a {Transfer} event with `from` set to `account`. */ function burnFrom(address account, uint256 value) public virtual { _spendAllowance(account, _msgSender(), value); _burn(account, value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity 0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string internal _name; string internal _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() {} /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance( address owner, address spender ) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve( address spender, uint256 value ) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom( address from, address to, uint256 value ) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve( address owner, address spender, uint256 value, bool emitEvent ) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 value ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance( spender, currentAllowance, value ); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IBIFKN314CALLEE { function BIFKN314CALL( address sender, uint256 amount0, uint256 amount1, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IBIFKN314Factory { function feeTo() external view returns (address); function feeRate() external view returns (uint256); function feeToSetter() external view returns (address); function feeDistributionThreshold() external view returns (uint256); event TokenCreated( address indexed deployer, string name, string symbol, address ammAddress, address lpAddress, uint256 allAMMLength ); event FeeDistributed(address indexed feeTo, uint256 nativeAmount); error InvalidAddress(); error NameMustNotBeEmpty(); error SymbolMustNotBeEmpty(); error NameTooLong(); error SymbolTooLong(); error OnlyFeeToSetter(address sender); error InvalidTradingFee(); error SupplyMustBeGreaterThanZero(); error InsufficientDeploymentFee(); error InvalidFeeRate(); error InvalidMaxWalletPercent(); error DistributionFailed(); error ImplementationAlreadyDeployed(); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IERC314 { function addLiquidity( uint256 amountToken, address recipient, uint256 deadline ) external payable returns (uint256 liquidity); function removeLiquidity( uint256 amount, address recipient, uint256 deadline ) external returns (uint256 nativeAmount, uint256 tokenAmount); function swapNativeToToken( uint256 minimumTokensOut, uint256 deadline ) external payable; function swapTokenToNative( uint256 tokensSold, uint256 minimumNativeOut, uint256 deadline ) external; // function flashSwap( // address recipient, // uint256 amountNativeOut, // uint256 amountTokenOut, // bytes calldata data // ) external; function getAmountOut( uint256 inputAmount, uint256 inputReserve, uint256 outputReserve ) external view returns (uint256 outputAmount, uint256 factoryFee, uint256 tradingFee); function getAmountIn( uint256 outputAmount, uint256 inputReserve, uint256 outputReserve ) external view returns (uint256 inputAmount); function getTokensInContract() external view returns (uint256); function getReserves() external view returns (uint256 amountNative, uint256 amountERC20); function getAmountsForLP( uint256 amount ) external view returns (uint256 nativeAmount, uint256 tokenAmount); function setFeeCollector(address feeCollector) external; function setTradingFeeRate(uint256 feeRate) external; function claimFees() external; function transferOwnership(address newOwner) external; function renounceOwnership() external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IERC314Errors { error AmountOfTokensLessThanMinimumRequired( uint256 amount, uint256 minimumAmount ); error AmountMustBeGreaterThanZero(); error YouHaveNoLiquidity(); error InsufficientLiquidity(); error InvalidReserves(); error ContractIsNotInitialized(); error InsufficientLiquidityMinted(); error SwapNotEnabled(); error DecreasesK(); error TransactionExpired(); error SlippageToleranceExceeded(); error InvalidRecipient(); error FailedToSendNativeCurrency(); error NativeRepaymentFailed(); error TokenRepaymentFailed(); error Unauthorized(address sender); error SupplyAlreadyMinted(); error InvalidOwner(); error InvalidAddress(); error InvalidFeeRate(); error BoughtAmountTooLow(); error NoFeesToClaim(); error InvalidMaxWalletPercent(); error MaxWalletAmountExceeded(); error OwnerAlreadyInitialized(); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IERC314Events { event AddLiquidity( address indexed provider, address indexed toAddress, uint256 liquidityMinted, uint256 nativeAmount, uint256 tokenAmount ); event RemoveLiquidity( address indexed provider, address indexed toAddress, uint256 liquidityBurned, uint256 nativeAmount, uint256 tokenAmount ); event Swap( address indexed sender, uint256 amountTokenIn, uint256 amountNativeIn, uint256 amountTokenOut, uint256 amountNativeOut, bool flashSwap ); event PricesUpdated( uint256 tokenPriceInNative, uint256 nativePriceInToken, uint32 blockTimestampLast ); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); event FeesCollected( address indexed recipient, uint256 amountNative, uint256 amountToken ); event FeesDistributed( address indexed feeTo, uint256 nativeAmount, uint256 tokenAmount ); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; /** * @dev Contract module that helps prevent automatic swapping within a function call * for specific callers, allowing for finer control over when swapping should be prevented. * * This version uses a mapping to track the prevention status for each caller, * making it context-sensitive and allowing for certain operations to not affect others. */ abstract contract PreventAutoSwap { mapping(address => bool) private _autoSwapPreventedFor; /** * @dev Thrown when an operation tries to perform an auto-swap and it is prevented for the caller. */ error AutoSwapPrevented(); /** * @dev Prevents auto-swap for the caller of the function this modifier is applied to. * This approach allows differentiating between various operations and callers, * giving more control over the swapping mechanism. */ modifier preventAutoSwap() { _preventAutoSwapBefore(); _; _preventAutoSwapAfter(); } /** * @dev Prevents automatic swapping before executing a transaction. * If the msg.sender has already prevented auto swapping, it reverts with an `AutoSwapPrevented` error. * Otherwise, it marks the transaction origin as prevented for auto swapping. */ function _preventAutoSwapBefore() private { if (_autoSwapPreventedFor[msg.sender]) { revert AutoSwapPrevented(); } _autoSwapPreventedFor[msg.sender] = true; } /** * @dev Internal function to prevent auto swap after a transaction. * @notice This function sets the `_autoSwapPreventedFor` mapping value for the `msg.sender` address to `false`. * @notice Auto swap refers to an automatic swapping of tokens that may occur during a transaction. * @notice By calling this function, the auto swap is prevented for the `msg.sender` address. * @notice This function is private and can only be called from within the contract. */ function _preventAutoSwapAfter() private { _autoSwapPreventedFor[msg.sender] = false; } /** * @dev Returns true if auto swap is currently prevented for the caller. */ function _autoSwapIsPrevented() internal view returns (bool) { return _autoSwapPreventedFor[msg.sender]; } }
{ "optimizer": { "enabled": true, "runs": 50 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AmountMustBeGreaterThanZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minimumAmount","type":"uint256"}],"name":"AmountOfTokensLessThanMinimumRequired","type":"error"},{"inputs":[],"name":"AutoSwapPrevented","type":"error"},{"inputs":[],"name":"BoughtAmountTooLow","type":"error"},{"inputs":[],"name":"ContractIsNotInitialized","type":"error"},{"inputs":[],"name":"DecreasesK","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC2612ExpiredSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC2612InvalidSigner","type":"error"},{"inputs":[],"name":"FailedToSendNativeCurrency","type":"error"},{"inputs":[],"name":"InsufficientLiquidity","type":"error"},{"inputs":[],"name":"InsufficientLiquidityMinted","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidFeeRate","type":"error"},{"inputs":[],"name":"InvalidMaxWalletPercent","type":"error"},{"inputs":[],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReserves","type":"error"},{"inputs":[],"name":"MaxWalletAmountExceeded","type":"error"},{"inputs":[],"name":"NameAndSymbolAlreadySet","type":"error"},{"inputs":[],"name":"NameAndSymbolMustNotBeEmpty","type":"error"},{"inputs":[],"name":"NativeRepaymentFailed","type":"error"},{"inputs":[],"name":"NoFeesToClaim","type":"error"},{"inputs":[],"name":"OwnerAlreadyInitialized","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"SlippageToleranceExceeded","type":"error"},{"inputs":[],"name":"SupplyAlreadyMinted","type":"error"},{"inputs":[],"name":"SwapNotEnabled","type":"error"},{"inputs":[],"name":"TokenRepaymentFailed","type":"error"},{"inputs":[],"name":"TransactionExpired","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"YouHaveNoLiquidity","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"liquidityMinted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nativeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"AddLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountNative","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountToken","type":"uint256"}],"name":"FeesCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeTo","type":"address"},{"indexed":false,"internalType":"uint256","name":"nativeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"FeesDistributed","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":false,"internalType":"uint256","name":"tokenPriceInNative","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nativePriceInToken","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"blockTimestampLast","type":"uint32"}],"name":"PricesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"liquidityBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nativeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"RemoveLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountTokenIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountNativeIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountTokenOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountNativeOut","type":"uint256"},{"indexed":false,"internalType":"bool","name":"flashSwap","type":"bool"}],"name":"Swap","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":"BASE_SWAP_RATE","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":"FLASHSWAP_FEE_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FEE_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SCALE_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accruedNativeFactoryFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accruedNativeTradingFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accruedTokenFactoryFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accruedTokenTradingFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountToken_","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"payable","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":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockTimestampLast","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IBIFKN314Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountNativeOut","type":"uint256"},{"internalType":"uint256","name":"amountTokenOut","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"inputReserve","type":"uint256"},{"internalType":"uint256","name":"outputReserve","type":"uint256"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"inputAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"inputReserve","type":"uint256"},{"internalType":"uint256","name":"outputReserve","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"factoryFee","type":"uint256"},{"internalType":"uint256","name":"tradingFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getAmountsForLP","outputs":[{"internalType":"uint256","name":"nativeAmount","type":"uint256"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint256","name":"amountNative","type":"uint256"},{"internalType":"uint256","name":"amountToken","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensInContract","outputs":[{"internalType":"uint256","name":"tokenBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"tokenName","type":"string"},{"internalType":"string","name":"tokenSymbol","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"initializeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isMaxWalletExempt","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityToken","outputs":[{"internalType":"contract BIFKN314LP","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWalletEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWalletPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"nativeAmount","type":"uint256"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"feeCollector_","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setMaxWalletEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addressToChange","type":"address"},{"internalType":"bool","name":"isExempt","type":"bool"}],"name":"setMaxWalletExempt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxWalletPercent_","type":"uint256"}],"name":"setMaxWalletPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setMetadataURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalSupply_","type":"uint256"},{"internalType":"address","name":"owner_","type":"address"},{"internalType":"uint256","name":"feeRate_","type":"uint256"},{"internalType":"uint256","name":"maxWalletPercent_","type":"uint256"},{"internalType":"string","name":"metadataURI_","type":"string"}],"name":"setSupplyAndMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setTradingEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"feeRate","type":"uint256"}],"name":"setTradingFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minimumTokensOut","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapNativeToToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokensSold","type":"uint256"},{"internalType":"uint256","name":"minimumNativeOut","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokenToNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","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"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060016007553362000023816200002a565b506200007c565b601780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b614cdb806200008c6000396000f3fe6080604052600436106103105760003560e01c8063750521f511610197578063a9059cbb116100ed578063d294f09311610090578063d294f093146109bb578063d505accf146109d0578063dd62ed3e146109f0578063e01df1a814610a10578063e156afd514610a26578063e6cb316614610a3b578063f05dcfc514610a5b578063f2fde38b14610a7c57600080fd5b8063a9059cbb146108bc578063ba9a7a56146108dc578063c415b95c146108f2578063c45a015514610912578063c4ccdeea14610939578063c5700a0214610959578063ce4b5bbe1461098b578063d045a329146109a157600080fd5b8063750521f5146106fb5780637537ccb61461071b57806379cc67901461073b5780637ecebe001461075b57806382bf293c1461078857806385f8c259146107a85780638b19d6cf146107c85780638da5cb5b146107e85780638f017f921461080857806392f6576e1461081e57806395d89b41146108345780639aa5d46214610849578063a10d2e3d1461085c578063a42dce801461087c578063a614ff751461089c57600080fd5b80633644e515116102675780634b2245831161020a5780634b224583146106245780634cd88b7614610644578063538a3f0e146106645780635909c0d5146106845780635a2b6c071461069a5780635a3d5493146106b057806370a08231146106c6578063715018a6146106e657600080fd5b80633644e5151461053e578063392e53cd146105545780633c2f1806146105755780633d9a3d191461058a57806340ed04c7146105a057806342966c68146105b657806343cd8f7e146105d65780634ada218b1461060357600080fd5b80628133711461035157806303ee438c14610379578063054d50d41461039b57806306fdde03146103d65780630902f1ac146103eb578063095ea7b3146104155780630b52820a146104455780630bd11f8a146104535780631091f67c1461048357806318160ddd146104a35780631ab52a6c146104b857806323b872dd146104ce57806330adf81f146104ee578063313ce56714610522578063355cf34b1461035157600080fd5b3661034c573360009081526008602052604090205460ff1661034a5761034a61033a346001610a9c565b6103454260b46132da565b610af6565b005b600080fd5b34801561035d57600080fd5b50610366601e81565b6040519081526020015b60405180910390f35b34801561038557600080fd5b5061038e610be3565b604051610370919061333d565b3480156103a757600080fd5b506103bb6103b6366004613350565b610c71565b60408051938452602084019290925290820152606001610370565b3480156103e257600080fd5b5061038e610d6b565b3480156103f757600080fd5b50610400610dfd565b60408051928352602083019190915201610370565b34801561042157600080fd5b50610435610430366004613391565b610e77565b6040519015158152602001610370565b61034a6103453660046133bd565b34801561045f57600080fd5b5061043561046e3660046133df565b600b6020526000908152604090205460ff1681565b34801561048f57600080fd5b5061034a61049e3660046133fc565b610e91565b3480156104af57600080fd5b50600254610366565b3480156104c457600080fd5b5061036660115481565b3480156104da57600080fd5b506104356104e9366004613415565b610ef9565b3480156104fa57600080fd5b506103667f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b34801561052e57600080fd5b5060405160128152602001610370565b34801561054a57600080fd5b5061036660055481565b34801561056057600080fd5b50600a5461043590600160a01b900460ff1681565b34801561058157600080fd5b50610366610f1f565b34801561059657600080fd5b50610366600f5481565b3480156105ac57600080fd5b5061036660125481565b3480156105c257600080fd5b5061034a6105d13660046133fc565b610f2f565b3480156105e257600080fd5b50600a546105f6906001600160a01b031681565b6040516103709190613456565b34801561060f57600080fd5b50600a5461043590600160b01b900460ff1681565b34801561063057600080fd5b5061034a61063f366004613350565b610f3c565b34801561065057600080fd5b5061034a61065f36600461350c565b611025565b34801561067057600080fd5b5061034a61067f3660046133df565b611127565b34801561069057600080fd5b50610366600c5481565b3480156106a657600080fd5b5061036660145481565b3480156106bc57600080fd5b50610366600d5481565b3480156106d257600080fd5b506103666106e13660046133df565b61119e565b3480156106f257600080fd5b5061034a6111b9565b34801561070757600080fd5b5061034a61071636600461356f565b6111e6565b34801561072757600080fd5b5061034a6107363660046135bb565b611213565b34801561074757600080fd5b5061034a610756366004613391565b6112b0565b34801561076757600080fd5b506103666107763660046133df565b60066020526000908152604090205481565b34801561079457600080fd5b5061034a6107a33660046133fc565b6112c5565b3480156107b457600080fd5b506103666107c3366004613350565b61133c565b3480156107d457600080fd5b5061034a6107e33660046135f0565b6113e1565b3480156107f457600080fd5b506017546105f6906001600160a01b031681565b34801561081457600080fd5b5061036660155481565b34801561082a57600080fd5b506103666101f481565b34801561084057600080fd5b5061038e6114db565b61036661085736600461365c565b6114ea565b34801561086857600080fd5b506104006108773660046133fc565b6118c2565b34801561088857600080fd5b5061034a6108973660046133df565b611a10565b3480156108a857600080fd5b5061034a6108b7366004613683565b611a7a565b3480156108c857600080fd5b506104356108d7366004613391565b611ad9565b3480156108e857600080fd5b506103666103e881565b3480156108fe57600080fd5b506016546105f6906001600160a01b031681565b34801561091e57600080fd5b50600e546105f690600160201b90046001600160a01b031681565b34801561094557600080fd5b5061040061095436600461365c565b611b3e565b34801561096557600080fd5b50600e546109769063ffffffff1681565b60405163ffffffff9091168152602001610370565b34801561099757600080fd5b5061036661271081565b3480156109ad57600080fd5b506010546104359060ff1681565b3480156109c757600080fd5b5061034a611d40565b3480156109dc57600080fd5b5061034a6109eb36600461369e565b611e14565b3480156109fc57600080fd5b50610366610a0b366004613715565b611feb565b348015610a1c57600080fd5b5061036660135481565b348015610a3257600080fd5b5061034a612016565b348015610a4757600080fd5b5061034a610a5636600461374e565b61204c565b348015610a6757600080fd5b50600a5461043590600160a81b900460ff1681565b348015610a8857600080fd5b5061034a610a973660046133df565b6123cd565b6000806000610aa9610dfd565b915091506000610ad18686610abe5783610ac0565b845b87610acb5785610c71565b84610c71565b50509050601481610ae291906137f9565b610aec908261380d565b9695505050505050565b610afe61241e565b80804210610b1f576040516338e5e54b60e21b815260040160405180910390fd5b600080610b2a610dfd565b90925090503433610b3b828561380d565b93506000806000610b4e858b8989612448565b9250925092508060146000828254610b6691906132da565b90915550610b779050826001612522565b610b81848461268a565b610b8c308585612752565b610b946127b1565b836001600160a01b0316600080516020614c8683398151915260008786600080604051610bc5959493929190613820565b60405180910390a25050505050505050610bdf6001600755565b5050565b60098054610bf090613845565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1c90613845565b8015610c695780601f10610c3e57610100808354040283529160200191610c69565b820191906000526020600020905b815481529060010190602001808311610c4c57829003601f168201915b505050505081565b60008060008061271090506000601354601e610c8d91906132da565b610c999061271061380d565b90506000610ca7838a61387f565b9050600088118015610cb95750600087115b15610d465782610cc88261292b565b610cd291906137f9565b945082610cde826129e3565b610ce891906137f9565b93506000610cf6838361387f565b90506000610d04898361387f565b905060008286610d166127108e61387f565b610d20919061387f565b610d2a91906132da565b9050808281610d3b57610d3b6137e3565b049850505050610d5f565b604051633dce448b60e11b815260040160405180910390fd5b50505093509350939050565b606060038054610d7a90613845565b80601f0160208091040260200160405190810160405280929190818152602001828054610da690613845565b8015610df35780601f10610dc857610100808354040283529160200191610df3565b820191906000526020600020905b815481529060010190602001808311610dd657829003601f168201915b5050505050905090565b60008060004790506000601154601454610e1791906132da565b90506000610e23610f1f565b90506000601254601554610e3791906132da565b905082841015610e48576000610e52565b610e52838561380d565b955080821015610e63576000610e6d565b610e6d818361380d565b9450505050509091565b600033610e85818585612a08565b60019150505b92915050565b6017546001600160a01b0316336001600160a01b031614610ed157335b60405163472511eb60e11b8152600401610ec89190613456565b60405180910390fd5b6101f4811115610ef457604051630adad23360e31b815260040160405180910390fd5b601355565b600033610f07858285612a15565b610f12858585612752565b60019150505b9392505050565b6000610f2a3061119e565b905090565b610f393382612a62565b50565b610f4461241e565b80804210610f65576040516338e5e54b60e21b815260040160405180910390fd5b600080610f70610dfd565b915091506000610f7d3390565b90506000806000610f908a8a8789612448565b9250925092508060156000828254610fa891906132da565b90915550610fb99050826000612522565b610fc484308c612a98565b610fce8484612aa3565b610fd66127b1565b836001600160a01b0316600080516020614c868339815191528b600080876000604051611007959493929190613820565b60405180910390a2505050505050506110206001600755565b505050565b6017546001600160a01b0316336001600160a01b0316146110465733610eae565b6110508282612b55565b60405161105c906132b7565b604051809103906000f080158015611078573d6000803e3d6000fd5b50600a80546001600160a01b0319166001600160a01b03929092169182179055604051634cd88b76906110af908590602001613896565b60408051601f19818403018152828201825260038352620424c560ec1b602084015290516001600160e01b031960e085901b1681526110f192906004016138c3565b600060405180830381600087803b15801561110b57600080fd5b505af115801561111f573d6000803e3d6000fd5b505050505050565b600a54600160a81b900460ff161561115257604051631360e86560e31b815260040160405180910390fd5b600a8054600160a81b60ff60a81b19909116179055600e8054640100000000600160c01b031916600160201b6001600160a01b0384811682029290921792839055610f39920416612c92565b6001600160a01b031660009081526020819052604090205490565b6017546001600160a01b0316336001600160a01b0316146111da5733610eae565b6111e46000612c92565b565b6017546001600160a01b0316336001600160a01b0316146112075733610eae565b6009610bdf8282613937565b6017546001600160a01b0316336001600160a01b0316146112345733610eae565b6001600160a01b038216158061125257506001600160a01b03821630145b8061126757506001600160a01b03821661dead145b156112855760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b6112bb823383612a15565b610bdf8282612a62565b6017546001600160a01b0316336001600160a01b0316146112e65733610eae565b612710811115611309576040516326dd075560e01b815260040160405180910390fd5b60105460ff168015611319575080155b15611337576040516326dd075560e01b815260040160405180910390fd5b600f55565b60135460009061271090829061135390601e6132da565b61135f9061271061380d565b905061136b828261387f565b905060008411801561137d5750600085115b15610d4657600082612710611392898961387f565b61139c919061387f565b6113a6919061387f565b90506000826113b5898861380d565b6113bf919061387f565b90508082816113d0576113d06137e3565b046001019450505050509392505050565b6017546001600160a01b0316336001600160a01b0316146114025733610eae565b8460000361142357604051635e85ae7360e01b815260040160405180910390fd5b600061142e60025490565b111561144d57604051630a87463f60e21b815260040160405180910390fd5b6001600160a01b038416611474576040516349e27cff60e01b815260040160405180910390fd5b8115611490576010805460ff19166001179055611490826112c5565b600961149c8282613937565b506114a683610e91565b6114af84612c92565b601680546001600160a01b0319166001600160a01b0386161790556114d48486612ce4565b5050505050565b606060048054610d7a90613845565b60006114f461241e565b81804210611515576040516338e5e54b60e21b815260040160405180910390fd5b600a543390600160a01b900460ff1615801561153f57506017546001600160a01b03828116911614155b1561155d5760405163aae677e160e01b815260040160405180910390fd5b851580611568575034155b1561158657604051635e85ae7360e01b815260040160405180910390fd5b600080611591610dfd565b90925090506115a0348361380d565b91506000600a60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b91906139f6565b9050348960008390036116cd57600061163c611637838561387f565b612d1a565b905061164a6103e88261380d565b600a546040516340c10f1960e01b8152919a506001600160a01b0316906340c10f19906116819061dead906103e890600401613a0f565b600060405180830381600087803b15801561169b57600080fd5b505af11580156116af573d6000803e3d6000fd5b5050600a805460ff60a01b1916600160a01b179055506117c9915050565b8415806116d8575083155b156116f657604051633dce448b60e11b815260040160405180910390fd5b84611701858461387f565b61170b91906137f9565b905060006117198686612e02565b9050818c101561174657604051633885308960e21b8152600481018d905260248101839052604401610ec8565b61177886611754868661387f565b61175e91906137f9565b86611769878661387f565b61177391906137f9565b612e0e565b9850600061178684886132da565b9050600061179484886132da565b905060006117a2838361387f565b9050838110156117c45760405162bfbd3d60e31b815260040160405180910390fd5b505050505b876000036117ea57604051633489be7560e21b815260040160405180910390fd5b600a546040516340c10f1960e01b81526001600160a01b03909116906340c10f199061181c908d908c90600401613a0f565b600060405180830381600087803b15801561183657600080fd5b505af115801561184a573d6000803e3d6000fd5b50505050611859863083612a98565b6118616127b1565b604080518981523460208201529081018290526001600160a01b03808c1691908816907f2f3289d16dbc3007471d28c4936df3a95222bc938112449400d049637e3309ce9060600160405180910390a350505050505050610f186001600755565b600080826000036118e657604051635e85ae7360e01b815260040160405180910390fd5b6000806118f1610dfd565b915091508160001480611902575080155b1561192057604051633dce448b60e11b815260040160405180910390fd5b600a54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa15801561196a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198e91906139f6565b9050806000036119b15760405163bb55fd2760e01b815260040160405180910390fd5b806119bc848861387f565b6119c691906137f9565b9450806119d3838861387f565b6119dd91906137f9565b93508415806119ea575083155b15611a085760405163bb55fd2760e01b815260040160405180910390fd5b505050915091565b6017546001600160a01b0316336001600160a01b031614611a315733610eae565b6001600160a01b038116611a585760405163e6c4247b60e01b815260040160405180910390fd5b601680546001600160a01b0319166001600160a01b0392909216919091179055565b6017546001600160a01b0316336001600160a01b031614611a9b5733610eae565b808015611aa85750600f54155b15611ac6576040516326dd075560e01b815260040160405180910390fd5b6010805460ff1916911515919091179055565b60006001600160a01b03831630148015611b0357503360009081526008602052604090205460ff16155b15611b2a57611b2282611b17846000610a9c565b61063f4260b46132da565b506001610e8b565b611b34838361268a565b610f188383612e24565b600080611b4961241e565b82804210611b6a576040516338e5e54b60e21b815260040160405180910390fd5b600a543390600160a01b900460ff16611b965760405163aae677e160e01b815260040160405180910390fd5b600a546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611bc7908590600401613456565b602060405180830381865afa158015611be4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0891906139f6565b905080600003611c2b57604051635a5ec44f60e01b815260040160405180910390fd5b80881115611c4c5760405163bb55fd2760e01b815260040160405180910390fd5b611c55886118c2565b600a5460405163079cc67960e41b81529297509095506001600160a01b0316906379cc679090611c8b9085908c90600401613a0f565b600060405180830381600087803b158015611ca557600080fd5b505af1158015611cb9573d6000803e3d6000fd5b50505050611cc78786612aa3565b611cd2308886612752565b60408051898152602081018790529081018590526001600160a01b0380891691908416907feb755d537a0caac69ccb1ac1dc2b7397a32bb19f93bd06013c57ac0b2e5dd69c9060600160405180910390a3611d2b6127b1565b505050611d386001600755565b935093915050565b6016546001600160a01b0316336001600160a01b031614611d615733610eae565b6014546015543382158015611d74575081155b15611d925760405163211b631760e21b815260040160405180910390fd5b6000601455611d9f610f1f565b821115611db157611dae610f1f565b91505b6000601555611dc08184612aa3565b611dcb308284612752565b60408051848152602081018490526001600160a01b038316917f2e4fb6077d4acf86e12bb7411fb82b2b3eaa6a49787f4b1e17b423e7ea841169910160405180910390a2505050565b42841015611e385760405163313c898160e11b815260048101859052602401610ec8565b6005546001600160a01b038816600090815260066020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b919087611e8b83613a28565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e00160405160208183030381529060405280519060200120604051602001611f0492919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015611f6f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580611fa45750886001600160a01b0316816001600160a01b031614155b15611fd5576040516325c0072360e11b81526001600160a01b0380831660048301528a166024820152604401610ec8565b611fe0898989612a08565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6017546001600160a01b0316336001600160a01b0316146120375733610eae565b600a805460ff60b01b1916600160b01b179055565b61205461241e565b61205c612e32565b600a54600160a01b900460ff166120865760405163aae677e160e01b815260040160405180910390fd5b600a54600160b01b900460ff166120b057604051637e99d8bb60e01b815260040160405180910390fd5b831580156120bc575082155b156120da57604051635e85ae7360e01b815260040160405180910390fd5b6001600160a01b03851615806120f857506001600160a01b03851630145b1561211657604051634e46966960e11b815260040160405180910390fd5b600080612121610dfd565b915091508186118061213257508085115b156121505760405163bb55fd2760e01b815260040160405180910390fd5b338615612161576121618888612aa3565b851561217c57612171888761268a565b61217c308988612752565b60405163f3438c1760e01b81526001600160a01b0389169063f3438c17906121b09084908b908b908b908b90600401613a41565b600060405180830381600087803b1580156121ca57600080fd5b505af11580156121de573d6000803e3d6000fd5b505050506000806121ed610dfd565b91509150600085831161220157600061220b565b61220b868461380d565b9050600085831161221d576000612227565b612227868461380d565b905081158015612235575080155b156122535760405163e2ddc74960e01b815260040160405180910390fd5b6000601354601e61226491906132da565b90506000612272828561387f565b61227e6127108861387f565b612288919061380d565b90506000612296838561387f565b6122a26127108861387f565b6122ac919061380d565b90506122bb6002612710613b71565b6122c58a8c61387f565b6122cf919061387f565b6122d9828461387f565b10156122f75760405162bfbd3d60e31b815260040160405180910390fd5b505050612303826129e3565b6014600082825461231491906132da565b909155506123239050816129e3565b6015600082825461233491906132da565b9091555061234d90506123468361292b565b6001612522565b6123606123598261292b565b6000612522565b6123686127b1565b846001600160a01b0316600080516020614c8683398151915282848d8f6001604051612398959493929190613820565b60405180910390a2505050505050506123c3336000908152600860205260409020805460ff19169055565b6114d46001600755565b6017546001600160a01b0316336001600160a01b0316146123ee5733610eae565b6001600160a01b038116612415576040516349e27cff60e01b815260040160405180910390fd5b610f3981612c92565b60026007540361244157604051633ee5aeb560e01b815260040160405180910390fd5b6002600755565b6000806000612458878686612e7f565b60006124648686612e02565b9050612471888787610c71565b91955093509150600084900361249a5760405163271a700960e01b815260040160405180910390fd5b868410156124bb5760405163339454fb60e11b815260040160405180910390fd5b6000836124c8848b61380d565b6124d2919061380d565b6124dc90886132da565b905060006124ea868861380d565b9050826124f78383612e02565b10156125155760405162bfbd3d60e31b815260040160405180910390fd5b5050509450945094915050565b600e54600160201b90046001600160a01b031615610bdf576000600e60049054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa15801561258f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b39190613b80565b90506000600e60049054906101000a90046001600160a01b03166001600160a01b031663ef973d476040518163ffffffff1660e01b8152600401602060405180830381865afa15801561260a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262e91906139f6565b90506001600160a01b0382161561268457821561266257836011600082825461265791906132da565b9091555061267a9050565b836012600082825461267491906132da565b90915550505b6126848282612f1d565b50505050565b60105460ff16612698575050565b6001600160a01b0382163014806126b657506001600160a01b038216155b806126cb57506001600160a01b03821661dead145b806126ee57506001600160a01b0382166000908152600b602052604090205460ff165b156126f7575050565b6000612710600f5461270860025490565b612712919061387f565b61271c91906137f9565b905080826127298561119e565b61273391906132da565b11156110205760405163a9a44dff60e01b815260040160405180910390fd5b6001600160a01b03831661277c576000604051634b637e8f60e11b8152600401610ec89190613456565b6001600160a01b0382166127a657600060405163ec442f0560e01b8152600401610ec89190613456565b611020838383613037565b6000806127bc610dfd565b9150915081600014806127cd575080155b156127eb57604051633dce448b60e11b815260040160405180910390fd5b60006127fb600160201b42613b9d565b600e549091506000906128149063ffffffff1683613bb1565b905060008163ffffffff1611801561282b57508315155b801561283657508215155b156128d857600160701b60008461284d838861387f565b61285791906137f9565b9050600086612866848861387f565b61287091906137f9565b905061288263ffffffff85168361387f565b600c600082825461289391906132da565b909155506128a9905063ffffffff85168261387f565b600d60008282546128ba91906132da565b9091555050600e805463ffffffff191663ffffffff87161790555050505b600c54600d54600e5460408051938452602084019290925263ffffffff1682820152517f1d0b407d784b19534f95cb221efeda97b16fcb4171eb57280723bad5ccfce40d9181900360600190a150505050565b600e54600090600160201b90046001600160a01b031661294d57506000919050565b612710600e60049054906101000a90046001600160a01b03166001600160a01b031663978bbdb96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c791906139f6565b6129d1908461387f565b6129db91906137f9565b90505b919050565b60006013546000036129f757506000919050565b612710601354836129d1919061387f565b611020838383600161314e565b6000612a218484611feb565b905060001981146126845781811015612a5357828183604051637dc7a0d960e11b8152600401610ec893929190613bd5565b6126848484848403600061314e565b6001600160a01b038216612a8c576000604051634b637e8f60e11b8152600401610ec89190613456565b610bdf82600083613037565b611020838383612752565b80600003612aaf575050565b6001600160a01b038216612ad65760405163e6c4247b60e01b815260040160405180910390fd5b47811115612ae15750475b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612b2e576040519150601f19603f3d011682016040523d82523d6000602084013e612b33565b606091505b505090508061102057604051634173d3a560e11b815260040160405180910390fd5b81511580612b6257508051155b15612b80576040516379db2df160e11b815260040160405180910390fd5b60038054612b8d90613845565b1515905080612ba9575060048054612ba490613845565b151590505b15612bc757604051634a8cdeb560e01b815260040160405180910390fd5b6003612bd38382613937565b506004612be08282613937565b507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6003604051612c119190613bf6565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206005555050565b601780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216612d0e57600060405163ec442f0560e01b8152600401610ec89190613456565b610bdf60008383613037565b600081600003612d2c57506000919050565b60006001612d3984613223565b901c6001901b90506001818481612d5257612d526137e3565b048201901c90506001818481612d6a57612d6a6137e3565b048201901c90506001818481612d8257612d826137e3565b048201901c90506001818481612d9a57612d9a6137e3565b048201901c90506001818481612db257612db26137e3565b048201901c90506001818481612dca57612dca6137e3565b048201901c90506001818481612de257612de26137e3565b048201901c9050610f1881828581612dfc57612dfc6137e3565b04612e0e565b6000610f18828461387f565b6000818310612e1d5781610f18565b5090919050565b600033610e85818585612752565b3360009081526008602052604090205460ff1615612e6357604051631584469560e11b815260040160405180910390fd5b336000908152600860205260409020805460ff19166001179055565b600a54600160a01b900460ff16612ea95760405163aae677e160e01b815260040160405180910390fd5b600a54600160b01b900460ff16612ed357604051637e99d8bb60e01b815260040160405180910390fd5b82600003612ef457604051635e85ae7360e01b815260040160405180910390fd5b811580612eff575080155b1561102057604051633dce448b60e11b815260040160405180910390fd5b60115460125460008083158015612f32575082155b15612f3f57505050505050565b600084118015612f4f5750848410155b15612f5e576000601155600191505b8215612fbc57600080612f6f610dfd565b9092509050600081612f81848861387f565b612f8b91906137f9565b9050878110612fb857612f9c610f1f565b861115612fae57612fab610f1f565b95505b6000601255600193505b5050505b8115612fcc57612fcc8685612aa3565b8015612fdd57612fdd308785612752565b8180612fe65750805b1561111f5760408051858152602081018590526001600160a01b038816917f85da6ab72d2b48932522aea80adb8ca4fab6cdeb87bc2e7f6c03fd78d3b2100e910160405180910390a2505050505050565b6001600160a01b03831661306257806002600082825461305791906132da565b909155506130c19050565b6001600160a01b038316600090815260208190526040902054818110156130a25783818360405163391434e360e21b8152600401610ec893929190613bd5565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166130dd576002805482900390556130fc565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161314191815260200190565b60405180910390a3505050565b6001600160a01b03841661317857600060405163e602df0560e01b8152600401610ec89190613456565b6001600160a01b0383166131a2576000604051634a1406b160e11b8152600401610ec89190613456565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561268457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161321591815260200190565b60405180910390a350505050565b600080608083901c1561323857608092831c92015b604083901c1561324a57604092831c92015b602083901c1561325c57602092831c92015b601083901c1561326e57601092831c92015b600883901c1561328057600892831c92015b600483901c1561329257600492831c92015b600283901c156132a457600292831c92015b600183901c15610e8b5760010192915050565b61101980613c6d83390190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e8b57610e8b6132c4565b60005b838110156133085781810151838201526020016132f0565b50506000910152565b600081518084526133298160208601602086016132ed565b601f01601f19169290920160200192915050565b602081526000610f186020830184613311565b60008060006060848603121561336557600080fd5b505081359360208301359350604090920135919050565b6001600160a01b0381168114610f3957600080fd5b600080604083850312156133a457600080fd5b82356133af8161337c565b946020939093013593505050565b600080604083850312156133d057600080fd5b50508035926020909101359150565b6000602082840312156133f157600080fd5b8135610f188161337c565b60006020828403121561340e57600080fd5b5035919050565b60008060006060848603121561342a57600080fd5b83356134358161337c565b925060208401356134458161337c565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261349157600080fd5b81356001600160401b03808211156134ab576134ab61346a565b604051601f8301601f19908116603f011681019082821181831017156134d3576134d361346a565b816040528381528660208588010111156134ec57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561351f57600080fd5b82356001600160401b038082111561353657600080fd5b61354286838701613480565b9350602085013591508082111561355857600080fd5b5061356585828601613480565b9150509250929050565b60006020828403121561358157600080fd5b81356001600160401b0381111561359757600080fd5b6135a384828501613480565b949350505050565b803580151581146129de57600080fd5b600080604083850312156135ce57600080fd5b82356135d98161337c565b91506135e7602084016135ab565b90509250929050565b600080600080600060a0868803121561360857600080fd5b85359450602086013561361a8161337c565b9350604086013592506060860135915060808601356001600160401b0381111561364357600080fd5b61364f88828901613480565b9150509295509295909350565b60008060006060848603121561367157600080fd5b8335925060208401356134458161337c565b60006020828403121561369557600080fd5b610f18826135ab565b600080600080600080600060e0888a0312156136b957600080fd5b87356136c48161337c565b965060208801356136d48161337c565b95506040880135945060608801359350608088013560ff811681146136f857600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561372857600080fd5b82356137338161337c565b915060208301356137438161337c565b809150509250929050565b60008060008060006080868803121561376657600080fd5b85356137718161337c565b9450602086013593506040860135925060608601356001600160401b038082111561379b57600080fd5b818801915088601f8301126137af57600080fd5b8135818111156137be57600080fd5b8960208285010111156137d057600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052601260045260246000fd5b600082613808576138086137e3565b500490565b81810381811115610e8b57610e8b6132c4565b9485526020850193909352604084019190915260608301521515608082015260a00190565b600181811c9082168061385957607f821691505b60208210810361387957634e487b7160e01b600052602260045260246000fd5b50919050565b8082028115828204841417610e8b57610e8b6132c4565b600082516138a88184602087016132ed565b68102628102a37b5b2b760b91b920191825250600901919050565b6040815260006138d66040830185613311565b82810360208401526138e88185613311565b95945050505050565b601f82111561102057600081815260208120601f850160051c810160208610156139185750805b601f850160051c820191505b8181101561111f57828155600101613924565b81516001600160401b038111156139505761395061346a565b6139648161395e8454613845565b846138f1565b602080601f83116001811461399957600084156139815750858301515b600019600386901b1c1916600185901b17855561111f565b600085815260208120601f198616915b828110156139c8578886015182559484019460019091019084016139a9565b50858210156139e65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215613a0857600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b600060018201613a3a57613a3a6132c4565b5060010190565b60018060a01b038616815284602082015283604082015260806060820152816080820152818360a0830137600081830160a090810191909152601f909201601f19160101949350505050565b600181815b80851115613ac8578160001904821115613aae57613aae6132c4565b80851615613abb57918102915b93841c9390800290613a92565b509250929050565b600082613adf57506001610e8b565b81613aec57506000610e8b565b8160018114613b025760028114613b0c57613b28565b6001915050610e8b565b60ff841115613b1d57613b1d6132c4565b50506001821b610e8b565b5060208310610133831016604e8410600b8410161715613b4b575081810a610e8b565b613b558383613a8d565b8060001904821115613b6957613b696132c4565b029392505050565b6000610f1860ff841683613ad0565b600060208284031215613b9257600080fd5b8151610f188161337c565b600082613bac57613bac6137e3565b500690565b63ffffffff828116828216039080821115613bce57613bce6132c4565b5092915050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000808354613c0481613845565b60018281168015613c1c5760018114613c3157613c60565b60ff1984168752821515830287019450613c60565b8760005260208060002060005b85811015613c575781548a820152908401908201613c3e565b50505082870194505b5092969550505050505056fe60a060405234801561001057600080fd5b50336080819052610fdc61003d600039600081816101cd0152818161037f01526103ef0152610fdc6000f3fe608060405234801561001057600080fd5b50600436106100f65760003560e01c80634837e204116100925780634837e204146101c85780634cd88b76146101fc57806370a082311461020f57806379cc6790146102385780637ecebe001461024b57806395d89b411461026b578063a9059cbb14610273578063d505accf14610286578063dd62ed3e1461029957600080fd5b806306fdde03146100fb578063095ea7b31461011957806318160ddd1461013c57806323b872dd1461014e57806330adf81f14610161578063313ce567146101885780633644e5151461019757806340c10f19146101a057806342966c68146101b5575b600080fd5b6101036102ac565b6040516101109190610ab9565b60405180910390f35b61012c610127366004610b23565b61033e565b6040519015158152602001610110565b6002545b604051908152602001610110565b61012c61015c366004610b4d565b610358565b6101407f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160128152602001610110565b61014060055481565b6101b36101ae366004610b23565b61037c565b005b6101b36101c3366004610b89565b6103df565b6101ef7f000000000000000000000000000000000000000000000000000000000000000081565b6040516101109190610ba2565b6101b361020a366004610c59565b6103ec565b61014061021d366004610cbd565b6001600160a01b031660009081526020819052604090205490565b6101b3610246366004610b23565b61042c565b610140610259366004610cbd565b60066020526000908152604090205481565b610103610441565b61012c610281366004610b23565b610450565b6101b3610294366004610cdf565b61045e565b6101406102a7366004610d52565b610635565b6060600380546102bb90610d85565b80601f01602080910402602001604051908101604052809291908181526020018280546102e790610d85565b80156103345780601f1061030957610100808354040283529160200191610334565b820191906000526020600020905b81548152906001019060200180831161031757829003601f168201915b5050505050905090565b60003361034c818585610660565b60019150505b92915050565b600033610366858285610672565b6103718585856106c5565b506001949350505050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146103d157335b60405163472511eb60e11b81526004016103c89190610ba2565b60405180910390fd5b6103db8282610724565b5050565b6103e9338261075a565b50565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461042257336103ae565b6103db8282610790565b610437823383610672565b6103db828261075a565b6060600480546102bb90610d85565b60003361034c8185856106c5565b428410156104825760405163313c898160e11b8152600481018590526024016103c8565b6005546001600160a01b038816600090815260066020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190876104d583610dd5565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161054e92919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156105b9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615806105ee5750886001600160a01b0316816001600160a01b031614155b1561061f576040516325c0072360e11b81526001600160a01b0380831660048301528a1660248201526044016103c8565b61062a898989610660565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61066d83838360016108cd565b505050565b600061067e8484610635565b905060001981146106bf57818110156106b057828183604051637dc7a0d960e11b81526004016103c893929190610dee565b6106bf848484840360006108cd565b50505050565b6001600160a01b0383166106ef576000604051634b637e8f60e11b81526004016103c89190610ba2565b6001600160a01b03821661071957600060405163ec442f0560e01b81526004016103c89190610ba2565b61066d8383836109a2565b6001600160a01b03821661074e57600060405163ec442f0560e01b81526004016103c89190610ba2565b6103db600083836109a2565b6001600160a01b038216610784576000604051634b637e8f60e11b81526004016103c89190610ba2565b6103db826000836109a2565b8151158061079d57508051155b156107bb576040516379db2df160e11b815260040160405180910390fd5b600380546107c890610d85565b15159050806107e45750600480546107df90610d85565b151590505b1561080257604051634a8cdeb560e01b815260040160405180910390fd5b600361080e8382610e5d565b50600461081b8282610e5d565b507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600360405161084c9190610f1d565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206005555050565b6001600160a01b0384166108f757600060405163e602df0560e01b81526004016103c89190610ba2565b6001600160a01b038316610921576000604051634a1406b160e11b81526004016103c89190610ba2565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156106bf57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161099491815260200190565b60405180910390a350505050565b6001600160a01b0383166109cd5780600260008282546109c29190610f93565b90915550610a2c9050565b6001600160a01b03831660009081526020819052604090205481811015610a0d5783818360405163391434e360e21b81526004016103c893929190610dee565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610a4857600280548290039055610a67565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610aac91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b81811015610ae657858101830151858201604001528201610aca565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b1e57600080fd5b919050565b60008060408385031215610b3657600080fd5b610b3f83610b07565b946020939093013593505050565b600080600060608486031215610b6257600080fd5b610b6b84610b07565b9250610b7960208501610b07565b9150604084013590509250925092565b600060208284031215610b9b57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610bdd57600080fd5b813567ffffffffffffffff80821115610bf857610bf8610bb6565b604051601f8301601f19908116603f01168101908282118183101715610c2057610c20610bb6565b81604052838152866020858801011115610c3957600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215610c6c57600080fd5b823567ffffffffffffffff80821115610c8457600080fd5b610c9086838701610bcc565b93506020850135915080821115610ca657600080fd5b50610cb385828601610bcc565b9150509250929050565b600060208284031215610ccf57600080fd5b610cd882610b07565b9392505050565b600080600080600080600060e0888a031215610cfa57600080fd5b610d0388610b07565b9650610d1160208901610b07565b95506040880135945060608801359350608088013560ff81168114610d3557600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610d6557600080fd5b610d6e83610b07565b9150610d7c60208401610b07565b90509250929050565b600181811c90821680610d9957607f821691505b602082108103610db957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600060018201610de757610de7610dbf565b5060010190565b6001600160a01b039390931683526020830191909152604082015260600190565b601f82111561066d57600081815260208120601f850160051c81016020861015610e365750805b601f850160051c820191505b81811015610e5557828155600101610e42565b505050505050565b815167ffffffffffffffff811115610e7757610e77610bb6565b610e8b81610e858454610d85565b84610e0f565b602080601f831160018114610ec05760008415610ea85750858301515b600019600386901b1c1916600185901b178555610e55565b600085815260208120601f198616915b82811015610eef57888601518255948401946001909101908401610ed0565b5085821015610f0d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808354610f2b81610d85565b60018281168015610f435760018114610f5857610f87565b60ff1984168752821515830287019450610f87565b8760005260208060002060005b85811015610f7e5781548a820152908401908201610f65565b50505082870194505b50929695505050505050565b8082018082111561035257610352610dbf56fea2646970667358221220926f32d9ccd0b0e0016b302e43ae94cf0d0bc86d8bb2a06238ff8affbe7ed29964736f6c63430008140033d44b536c8222cd875ef4b7f421435c474a3e1035e29c64e5f039af6944de4beaa2646970667358221220026305719e357a9f9ba8c82fbf9ab3ef295548dc9c2f3b65cd4f68f253557cb164736f6c63430008140033
Deployed Bytecode
0x6080604052600436106103105760003560e01c8063750521f511610197578063a9059cbb116100ed578063d294f09311610090578063d294f093146109bb578063d505accf146109d0578063dd62ed3e146109f0578063e01df1a814610a10578063e156afd514610a26578063e6cb316614610a3b578063f05dcfc514610a5b578063f2fde38b14610a7c57600080fd5b8063a9059cbb146108bc578063ba9a7a56146108dc578063c415b95c146108f2578063c45a015514610912578063c4ccdeea14610939578063c5700a0214610959578063ce4b5bbe1461098b578063d045a329146109a157600080fd5b8063750521f5146106fb5780637537ccb61461071b57806379cc67901461073b5780637ecebe001461075b57806382bf293c1461078857806385f8c259146107a85780638b19d6cf146107c85780638da5cb5b146107e85780638f017f921461080857806392f6576e1461081e57806395d89b41146108345780639aa5d46214610849578063a10d2e3d1461085c578063a42dce801461087c578063a614ff751461089c57600080fd5b80633644e515116102675780634b2245831161020a5780634b224583146106245780634cd88b7614610644578063538a3f0e146106645780635909c0d5146106845780635a2b6c071461069a5780635a3d5493146106b057806370a08231146106c6578063715018a6146106e657600080fd5b80633644e5151461053e578063392e53cd146105545780633c2f1806146105755780633d9a3d191461058a57806340ed04c7146105a057806342966c68146105b657806343cd8f7e146105d65780634ada218b1461060357600080fd5b80628133711461035157806303ee438c14610379578063054d50d41461039b57806306fdde03146103d65780630902f1ac146103eb578063095ea7b3146104155780630b52820a146104455780630bd11f8a146104535780631091f67c1461048357806318160ddd146104a35780631ab52a6c146104b857806323b872dd146104ce57806330adf81f146104ee578063313ce56714610522578063355cf34b1461035157600080fd5b3661034c573360009081526008602052604090205460ff1661034a5761034a61033a346001610a9c565b6103454260b46132da565b610af6565b005b600080fd5b34801561035d57600080fd5b50610366601e81565b6040519081526020015b60405180910390f35b34801561038557600080fd5b5061038e610be3565b604051610370919061333d565b3480156103a757600080fd5b506103bb6103b6366004613350565b610c71565b60408051938452602084019290925290820152606001610370565b3480156103e257600080fd5b5061038e610d6b565b3480156103f757600080fd5b50610400610dfd565b60408051928352602083019190915201610370565b34801561042157600080fd5b50610435610430366004613391565b610e77565b6040519015158152602001610370565b61034a6103453660046133bd565b34801561045f57600080fd5b5061043561046e3660046133df565b600b6020526000908152604090205460ff1681565b34801561048f57600080fd5b5061034a61049e3660046133fc565b610e91565b3480156104af57600080fd5b50600254610366565b3480156104c457600080fd5b5061036660115481565b3480156104da57600080fd5b506104356104e9366004613415565b610ef9565b3480156104fa57600080fd5b506103667f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b34801561052e57600080fd5b5060405160128152602001610370565b34801561054a57600080fd5b5061036660055481565b34801561056057600080fd5b50600a5461043590600160a01b900460ff1681565b34801561058157600080fd5b50610366610f1f565b34801561059657600080fd5b50610366600f5481565b3480156105ac57600080fd5b5061036660125481565b3480156105c257600080fd5b5061034a6105d13660046133fc565b610f2f565b3480156105e257600080fd5b50600a546105f6906001600160a01b031681565b6040516103709190613456565b34801561060f57600080fd5b50600a5461043590600160b01b900460ff1681565b34801561063057600080fd5b5061034a61063f366004613350565b610f3c565b34801561065057600080fd5b5061034a61065f36600461350c565b611025565b34801561067057600080fd5b5061034a61067f3660046133df565b611127565b34801561069057600080fd5b50610366600c5481565b3480156106a657600080fd5b5061036660145481565b3480156106bc57600080fd5b50610366600d5481565b3480156106d257600080fd5b506103666106e13660046133df565b61119e565b3480156106f257600080fd5b5061034a6111b9565b34801561070757600080fd5b5061034a61071636600461356f565b6111e6565b34801561072757600080fd5b5061034a6107363660046135bb565b611213565b34801561074757600080fd5b5061034a610756366004613391565b6112b0565b34801561076757600080fd5b506103666107763660046133df565b60066020526000908152604090205481565b34801561079457600080fd5b5061034a6107a33660046133fc565b6112c5565b3480156107b457600080fd5b506103666107c3366004613350565b61133c565b3480156107d457600080fd5b5061034a6107e33660046135f0565b6113e1565b3480156107f457600080fd5b506017546105f6906001600160a01b031681565b34801561081457600080fd5b5061036660155481565b34801561082a57600080fd5b506103666101f481565b34801561084057600080fd5b5061038e6114db565b61036661085736600461365c565b6114ea565b34801561086857600080fd5b506104006108773660046133fc565b6118c2565b34801561088857600080fd5b5061034a6108973660046133df565b611a10565b3480156108a857600080fd5b5061034a6108b7366004613683565b611a7a565b3480156108c857600080fd5b506104356108d7366004613391565b611ad9565b3480156108e857600080fd5b506103666103e881565b3480156108fe57600080fd5b506016546105f6906001600160a01b031681565b34801561091e57600080fd5b50600e546105f690600160201b90046001600160a01b031681565b34801561094557600080fd5b5061040061095436600461365c565b611b3e565b34801561096557600080fd5b50600e546109769063ffffffff1681565b60405163ffffffff9091168152602001610370565b34801561099757600080fd5b5061036661271081565b3480156109ad57600080fd5b506010546104359060ff1681565b3480156109c757600080fd5b5061034a611d40565b3480156109dc57600080fd5b5061034a6109eb36600461369e565b611e14565b3480156109fc57600080fd5b50610366610a0b366004613715565b611feb565b348015610a1c57600080fd5b5061036660135481565b348015610a3257600080fd5b5061034a612016565b348015610a4757600080fd5b5061034a610a5636600461374e565b61204c565b348015610a6757600080fd5b50600a5461043590600160a81b900460ff1681565b348015610a8857600080fd5b5061034a610a973660046133df565b6123cd565b6000806000610aa9610dfd565b915091506000610ad18686610abe5783610ac0565b845b87610acb5785610c71565b84610c71565b50509050601481610ae291906137f9565b610aec908261380d565b9695505050505050565b610afe61241e565b80804210610b1f576040516338e5e54b60e21b815260040160405180910390fd5b600080610b2a610dfd565b90925090503433610b3b828561380d565b93506000806000610b4e858b8989612448565b9250925092508060146000828254610b6691906132da565b90915550610b779050826001612522565b610b81848461268a565b610b8c308585612752565b610b946127b1565b836001600160a01b0316600080516020614c8683398151915260008786600080604051610bc5959493929190613820565b60405180910390a25050505050505050610bdf6001600755565b5050565b60098054610bf090613845565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1c90613845565b8015610c695780601f10610c3e57610100808354040283529160200191610c69565b820191906000526020600020905b815481529060010190602001808311610c4c57829003601f168201915b505050505081565b60008060008061271090506000601354601e610c8d91906132da565b610c999061271061380d565b90506000610ca7838a61387f565b9050600088118015610cb95750600087115b15610d465782610cc88261292b565b610cd291906137f9565b945082610cde826129e3565b610ce891906137f9565b93506000610cf6838361387f565b90506000610d04898361387f565b905060008286610d166127108e61387f565b610d20919061387f565b610d2a91906132da565b9050808281610d3b57610d3b6137e3565b049850505050610d5f565b604051633dce448b60e11b815260040160405180910390fd5b50505093509350939050565b606060038054610d7a90613845565b80601f0160208091040260200160405190810160405280929190818152602001828054610da690613845565b8015610df35780601f10610dc857610100808354040283529160200191610df3565b820191906000526020600020905b815481529060010190602001808311610dd657829003601f168201915b5050505050905090565b60008060004790506000601154601454610e1791906132da565b90506000610e23610f1f565b90506000601254601554610e3791906132da565b905082841015610e48576000610e52565b610e52838561380d565b955080821015610e63576000610e6d565b610e6d818361380d565b9450505050509091565b600033610e85818585612a08565b60019150505b92915050565b6017546001600160a01b0316336001600160a01b031614610ed157335b60405163472511eb60e11b8152600401610ec89190613456565b60405180910390fd5b6101f4811115610ef457604051630adad23360e31b815260040160405180910390fd5b601355565b600033610f07858285612a15565b610f12858585612752565b60019150505b9392505050565b6000610f2a3061119e565b905090565b610f393382612a62565b50565b610f4461241e565b80804210610f65576040516338e5e54b60e21b815260040160405180910390fd5b600080610f70610dfd565b915091506000610f7d3390565b90506000806000610f908a8a8789612448565b9250925092508060156000828254610fa891906132da565b90915550610fb99050826000612522565b610fc484308c612a98565b610fce8484612aa3565b610fd66127b1565b836001600160a01b0316600080516020614c868339815191528b600080876000604051611007959493929190613820565b60405180910390a2505050505050506110206001600755565b505050565b6017546001600160a01b0316336001600160a01b0316146110465733610eae565b6110508282612b55565b60405161105c906132b7565b604051809103906000f080158015611078573d6000803e3d6000fd5b50600a80546001600160a01b0319166001600160a01b03929092169182179055604051634cd88b76906110af908590602001613896565b60408051601f19818403018152828201825260038352620424c560ec1b602084015290516001600160e01b031960e085901b1681526110f192906004016138c3565b600060405180830381600087803b15801561110b57600080fd5b505af115801561111f573d6000803e3d6000fd5b505050505050565b600a54600160a81b900460ff161561115257604051631360e86560e31b815260040160405180910390fd5b600a8054600160a81b60ff60a81b19909116179055600e8054640100000000600160c01b031916600160201b6001600160a01b0384811682029290921792839055610f39920416612c92565b6001600160a01b031660009081526020819052604090205490565b6017546001600160a01b0316336001600160a01b0316146111da5733610eae565b6111e46000612c92565b565b6017546001600160a01b0316336001600160a01b0316146112075733610eae565b6009610bdf8282613937565b6017546001600160a01b0316336001600160a01b0316146112345733610eae565b6001600160a01b038216158061125257506001600160a01b03821630145b8061126757506001600160a01b03821661dead145b156112855760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b6112bb823383612a15565b610bdf8282612a62565b6017546001600160a01b0316336001600160a01b0316146112e65733610eae565b612710811115611309576040516326dd075560e01b815260040160405180910390fd5b60105460ff168015611319575080155b15611337576040516326dd075560e01b815260040160405180910390fd5b600f55565b60135460009061271090829061135390601e6132da565b61135f9061271061380d565b905061136b828261387f565b905060008411801561137d5750600085115b15610d4657600082612710611392898961387f565b61139c919061387f565b6113a6919061387f565b90506000826113b5898861380d565b6113bf919061387f565b90508082816113d0576113d06137e3565b046001019450505050509392505050565b6017546001600160a01b0316336001600160a01b0316146114025733610eae565b8460000361142357604051635e85ae7360e01b815260040160405180910390fd5b600061142e60025490565b111561144d57604051630a87463f60e21b815260040160405180910390fd5b6001600160a01b038416611474576040516349e27cff60e01b815260040160405180910390fd5b8115611490576010805460ff19166001179055611490826112c5565b600961149c8282613937565b506114a683610e91565b6114af84612c92565b601680546001600160a01b0319166001600160a01b0386161790556114d48486612ce4565b5050505050565b606060048054610d7a90613845565b60006114f461241e565b81804210611515576040516338e5e54b60e21b815260040160405180910390fd5b600a543390600160a01b900460ff1615801561153f57506017546001600160a01b03828116911614155b1561155d5760405163aae677e160e01b815260040160405180910390fd5b851580611568575034155b1561158657604051635e85ae7360e01b815260040160405180910390fd5b600080611591610dfd565b90925090506115a0348361380d565b91506000600a60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b91906139f6565b9050348960008390036116cd57600061163c611637838561387f565b612d1a565b905061164a6103e88261380d565b600a546040516340c10f1960e01b8152919a506001600160a01b0316906340c10f19906116819061dead906103e890600401613a0f565b600060405180830381600087803b15801561169b57600080fd5b505af11580156116af573d6000803e3d6000fd5b5050600a805460ff60a01b1916600160a01b179055506117c9915050565b8415806116d8575083155b156116f657604051633dce448b60e11b815260040160405180910390fd5b84611701858461387f565b61170b91906137f9565b905060006117198686612e02565b9050818c101561174657604051633885308960e21b8152600481018d905260248101839052604401610ec8565b61177886611754868661387f565b61175e91906137f9565b86611769878661387f565b61177391906137f9565b612e0e565b9850600061178684886132da565b9050600061179484886132da565b905060006117a2838361387f565b9050838110156117c45760405162bfbd3d60e31b815260040160405180910390fd5b505050505b876000036117ea57604051633489be7560e21b815260040160405180910390fd5b600a546040516340c10f1960e01b81526001600160a01b03909116906340c10f199061181c908d908c90600401613a0f565b600060405180830381600087803b15801561183657600080fd5b505af115801561184a573d6000803e3d6000fd5b50505050611859863083612a98565b6118616127b1565b604080518981523460208201529081018290526001600160a01b03808c1691908816907f2f3289d16dbc3007471d28c4936df3a95222bc938112449400d049637e3309ce9060600160405180910390a350505050505050610f186001600755565b600080826000036118e657604051635e85ae7360e01b815260040160405180910390fd5b6000806118f1610dfd565b915091508160001480611902575080155b1561192057604051633dce448b60e11b815260040160405180910390fd5b600a54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa15801561196a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198e91906139f6565b9050806000036119b15760405163bb55fd2760e01b815260040160405180910390fd5b806119bc848861387f565b6119c691906137f9565b9450806119d3838861387f565b6119dd91906137f9565b93508415806119ea575083155b15611a085760405163bb55fd2760e01b815260040160405180910390fd5b505050915091565b6017546001600160a01b0316336001600160a01b031614611a315733610eae565b6001600160a01b038116611a585760405163e6c4247b60e01b815260040160405180910390fd5b601680546001600160a01b0319166001600160a01b0392909216919091179055565b6017546001600160a01b0316336001600160a01b031614611a9b5733610eae565b808015611aa85750600f54155b15611ac6576040516326dd075560e01b815260040160405180910390fd5b6010805460ff1916911515919091179055565b60006001600160a01b03831630148015611b0357503360009081526008602052604090205460ff16155b15611b2a57611b2282611b17846000610a9c565b61063f4260b46132da565b506001610e8b565b611b34838361268a565b610f188383612e24565b600080611b4961241e565b82804210611b6a576040516338e5e54b60e21b815260040160405180910390fd5b600a543390600160a01b900460ff16611b965760405163aae677e160e01b815260040160405180910390fd5b600a546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611bc7908590600401613456565b602060405180830381865afa158015611be4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0891906139f6565b905080600003611c2b57604051635a5ec44f60e01b815260040160405180910390fd5b80881115611c4c5760405163bb55fd2760e01b815260040160405180910390fd5b611c55886118c2565b600a5460405163079cc67960e41b81529297509095506001600160a01b0316906379cc679090611c8b9085908c90600401613a0f565b600060405180830381600087803b158015611ca557600080fd5b505af1158015611cb9573d6000803e3d6000fd5b50505050611cc78786612aa3565b611cd2308886612752565b60408051898152602081018790529081018590526001600160a01b0380891691908416907feb755d537a0caac69ccb1ac1dc2b7397a32bb19f93bd06013c57ac0b2e5dd69c9060600160405180910390a3611d2b6127b1565b505050611d386001600755565b935093915050565b6016546001600160a01b0316336001600160a01b031614611d615733610eae565b6014546015543382158015611d74575081155b15611d925760405163211b631760e21b815260040160405180910390fd5b6000601455611d9f610f1f565b821115611db157611dae610f1f565b91505b6000601555611dc08184612aa3565b611dcb308284612752565b60408051848152602081018490526001600160a01b038316917f2e4fb6077d4acf86e12bb7411fb82b2b3eaa6a49787f4b1e17b423e7ea841169910160405180910390a2505050565b42841015611e385760405163313c898160e11b815260048101859052602401610ec8565b6005546001600160a01b038816600090815260066020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b919087611e8b83613a28565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e00160405160208183030381529060405280519060200120604051602001611f0492919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015611f6f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580611fa45750886001600160a01b0316816001600160a01b031614155b15611fd5576040516325c0072360e11b81526001600160a01b0380831660048301528a166024820152604401610ec8565b611fe0898989612a08565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6017546001600160a01b0316336001600160a01b0316146120375733610eae565b600a805460ff60b01b1916600160b01b179055565b61205461241e565b61205c612e32565b600a54600160a01b900460ff166120865760405163aae677e160e01b815260040160405180910390fd5b600a54600160b01b900460ff166120b057604051637e99d8bb60e01b815260040160405180910390fd5b831580156120bc575082155b156120da57604051635e85ae7360e01b815260040160405180910390fd5b6001600160a01b03851615806120f857506001600160a01b03851630145b1561211657604051634e46966960e11b815260040160405180910390fd5b600080612121610dfd565b915091508186118061213257508085115b156121505760405163bb55fd2760e01b815260040160405180910390fd5b338615612161576121618888612aa3565b851561217c57612171888761268a565b61217c308988612752565b60405163f3438c1760e01b81526001600160a01b0389169063f3438c17906121b09084908b908b908b908b90600401613a41565b600060405180830381600087803b1580156121ca57600080fd5b505af11580156121de573d6000803e3d6000fd5b505050506000806121ed610dfd565b91509150600085831161220157600061220b565b61220b868461380d565b9050600085831161221d576000612227565b612227868461380d565b905081158015612235575080155b156122535760405163e2ddc74960e01b815260040160405180910390fd5b6000601354601e61226491906132da565b90506000612272828561387f565b61227e6127108861387f565b612288919061380d565b90506000612296838561387f565b6122a26127108861387f565b6122ac919061380d565b90506122bb6002612710613b71565b6122c58a8c61387f565b6122cf919061387f565b6122d9828461387f565b10156122f75760405162bfbd3d60e31b815260040160405180910390fd5b505050612303826129e3565b6014600082825461231491906132da565b909155506123239050816129e3565b6015600082825461233491906132da565b9091555061234d90506123468361292b565b6001612522565b6123606123598261292b565b6000612522565b6123686127b1565b846001600160a01b0316600080516020614c8683398151915282848d8f6001604051612398959493929190613820565b60405180910390a2505050505050506123c3336000908152600860205260409020805460ff19169055565b6114d46001600755565b6017546001600160a01b0316336001600160a01b0316146123ee5733610eae565b6001600160a01b038116612415576040516349e27cff60e01b815260040160405180910390fd5b610f3981612c92565b60026007540361244157604051633ee5aeb560e01b815260040160405180910390fd5b6002600755565b6000806000612458878686612e7f565b60006124648686612e02565b9050612471888787610c71565b91955093509150600084900361249a5760405163271a700960e01b815260040160405180910390fd5b868410156124bb5760405163339454fb60e11b815260040160405180910390fd5b6000836124c8848b61380d565b6124d2919061380d565b6124dc90886132da565b905060006124ea868861380d565b9050826124f78383612e02565b10156125155760405162bfbd3d60e31b815260040160405180910390fd5b5050509450945094915050565b600e54600160201b90046001600160a01b031615610bdf576000600e60049054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa15801561258f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b39190613b80565b90506000600e60049054906101000a90046001600160a01b03166001600160a01b031663ef973d476040518163ffffffff1660e01b8152600401602060405180830381865afa15801561260a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262e91906139f6565b90506001600160a01b0382161561268457821561266257836011600082825461265791906132da565b9091555061267a9050565b836012600082825461267491906132da565b90915550505b6126848282612f1d565b50505050565b60105460ff16612698575050565b6001600160a01b0382163014806126b657506001600160a01b038216155b806126cb57506001600160a01b03821661dead145b806126ee57506001600160a01b0382166000908152600b602052604090205460ff165b156126f7575050565b6000612710600f5461270860025490565b612712919061387f565b61271c91906137f9565b905080826127298561119e565b61273391906132da565b11156110205760405163a9a44dff60e01b815260040160405180910390fd5b6001600160a01b03831661277c576000604051634b637e8f60e11b8152600401610ec89190613456565b6001600160a01b0382166127a657600060405163ec442f0560e01b8152600401610ec89190613456565b611020838383613037565b6000806127bc610dfd565b9150915081600014806127cd575080155b156127eb57604051633dce448b60e11b815260040160405180910390fd5b60006127fb600160201b42613b9d565b600e549091506000906128149063ffffffff1683613bb1565b905060008163ffffffff1611801561282b57508315155b801561283657508215155b156128d857600160701b60008461284d838861387f565b61285791906137f9565b9050600086612866848861387f565b61287091906137f9565b905061288263ffffffff85168361387f565b600c600082825461289391906132da565b909155506128a9905063ffffffff85168261387f565b600d60008282546128ba91906132da565b9091555050600e805463ffffffff191663ffffffff87161790555050505b600c54600d54600e5460408051938452602084019290925263ffffffff1682820152517f1d0b407d784b19534f95cb221efeda97b16fcb4171eb57280723bad5ccfce40d9181900360600190a150505050565b600e54600090600160201b90046001600160a01b031661294d57506000919050565b612710600e60049054906101000a90046001600160a01b03166001600160a01b031663978bbdb96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c791906139f6565b6129d1908461387f565b6129db91906137f9565b90505b919050565b60006013546000036129f757506000919050565b612710601354836129d1919061387f565b611020838383600161314e565b6000612a218484611feb565b905060001981146126845781811015612a5357828183604051637dc7a0d960e11b8152600401610ec893929190613bd5565b6126848484848403600061314e565b6001600160a01b038216612a8c576000604051634b637e8f60e11b8152600401610ec89190613456565b610bdf82600083613037565b611020838383612752565b80600003612aaf575050565b6001600160a01b038216612ad65760405163e6c4247b60e01b815260040160405180910390fd5b47811115612ae15750475b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612b2e576040519150601f19603f3d011682016040523d82523d6000602084013e612b33565b606091505b505090508061102057604051634173d3a560e11b815260040160405180910390fd5b81511580612b6257508051155b15612b80576040516379db2df160e11b815260040160405180910390fd5b60038054612b8d90613845565b1515905080612ba9575060048054612ba490613845565b151590505b15612bc757604051634a8cdeb560e01b815260040160405180910390fd5b6003612bd38382613937565b506004612be08282613937565b507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6003604051612c119190613bf6565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206005555050565b601780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216612d0e57600060405163ec442f0560e01b8152600401610ec89190613456565b610bdf60008383613037565b600081600003612d2c57506000919050565b60006001612d3984613223565b901c6001901b90506001818481612d5257612d526137e3565b048201901c90506001818481612d6a57612d6a6137e3565b048201901c90506001818481612d8257612d826137e3565b048201901c90506001818481612d9a57612d9a6137e3565b048201901c90506001818481612db257612db26137e3565b048201901c90506001818481612dca57612dca6137e3565b048201901c90506001818481612de257612de26137e3565b048201901c9050610f1881828581612dfc57612dfc6137e3565b04612e0e565b6000610f18828461387f565b6000818310612e1d5781610f18565b5090919050565b600033610e85818585612752565b3360009081526008602052604090205460ff1615612e6357604051631584469560e11b815260040160405180910390fd5b336000908152600860205260409020805460ff19166001179055565b600a54600160a01b900460ff16612ea95760405163aae677e160e01b815260040160405180910390fd5b600a54600160b01b900460ff16612ed357604051637e99d8bb60e01b815260040160405180910390fd5b82600003612ef457604051635e85ae7360e01b815260040160405180910390fd5b811580612eff575080155b1561102057604051633dce448b60e11b815260040160405180910390fd5b60115460125460008083158015612f32575082155b15612f3f57505050505050565b600084118015612f4f5750848410155b15612f5e576000601155600191505b8215612fbc57600080612f6f610dfd565b9092509050600081612f81848861387f565b612f8b91906137f9565b9050878110612fb857612f9c610f1f565b861115612fae57612fab610f1f565b95505b6000601255600193505b5050505b8115612fcc57612fcc8685612aa3565b8015612fdd57612fdd308785612752565b8180612fe65750805b1561111f5760408051858152602081018590526001600160a01b038816917f85da6ab72d2b48932522aea80adb8ca4fab6cdeb87bc2e7f6c03fd78d3b2100e910160405180910390a2505050505050565b6001600160a01b03831661306257806002600082825461305791906132da565b909155506130c19050565b6001600160a01b038316600090815260208190526040902054818110156130a25783818360405163391434e360e21b8152600401610ec893929190613bd5565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166130dd576002805482900390556130fc565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161314191815260200190565b60405180910390a3505050565b6001600160a01b03841661317857600060405163e602df0560e01b8152600401610ec89190613456565b6001600160a01b0383166131a2576000604051634a1406b160e11b8152600401610ec89190613456565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561268457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161321591815260200190565b60405180910390a350505050565b600080608083901c1561323857608092831c92015b604083901c1561324a57604092831c92015b602083901c1561325c57602092831c92015b601083901c1561326e57601092831c92015b600883901c1561328057600892831c92015b600483901c1561329257600492831c92015b600283901c156132a457600292831c92015b600183901c15610e8b5760010192915050565b61101980613c6d83390190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e8b57610e8b6132c4565b60005b838110156133085781810151838201526020016132f0565b50506000910152565b600081518084526133298160208601602086016132ed565b601f01601f19169290920160200192915050565b602081526000610f186020830184613311565b60008060006060848603121561336557600080fd5b505081359360208301359350604090920135919050565b6001600160a01b0381168114610f3957600080fd5b600080604083850312156133a457600080fd5b82356133af8161337c565b946020939093013593505050565b600080604083850312156133d057600080fd5b50508035926020909101359150565b6000602082840312156133f157600080fd5b8135610f188161337c565b60006020828403121561340e57600080fd5b5035919050565b60008060006060848603121561342a57600080fd5b83356134358161337c565b925060208401356134458161337c565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261349157600080fd5b81356001600160401b03808211156134ab576134ab61346a565b604051601f8301601f19908116603f011681019082821181831017156134d3576134d361346a565b816040528381528660208588010111156134ec57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561351f57600080fd5b82356001600160401b038082111561353657600080fd5b61354286838701613480565b9350602085013591508082111561355857600080fd5b5061356585828601613480565b9150509250929050565b60006020828403121561358157600080fd5b81356001600160401b0381111561359757600080fd5b6135a384828501613480565b949350505050565b803580151581146129de57600080fd5b600080604083850312156135ce57600080fd5b82356135d98161337c565b91506135e7602084016135ab565b90509250929050565b600080600080600060a0868803121561360857600080fd5b85359450602086013561361a8161337c565b9350604086013592506060860135915060808601356001600160401b0381111561364357600080fd5b61364f88828901613480565b9150509295509295909350565b60008060006060848603121561367157600080fd5b8335925060208401356134458161337c565b60006020828403121561369557600080fd5b610f18826135ab565b600080600080600080600060e0888a0312156136b957600080fd5b87356136c48161337c565b965060208801356136d48161337c565b95506040880135945060608801359350608088013560ff811681146136f857600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561372857600080fd5b82356137338161337c565b915060208301356137438161337c565b809150509250929050565b60008060008060006080868803121561376657600080fd5b85356137718161337c565b9450602086013593506040860135925060608601356001600160401b038082111561379b57600080fd5b818801915088601f8301126137af57600080fd5b8135818111156137be57600080fd5b8960208285010111156137d057600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052601260045260246000fd5b600082613808576138086137e3565b500490565b81810381811115610e8b57610e8b6132c4565b9485526020850193909352604084019190915260608301521515608082015260a00190565b600181811c9082168061385957607f821691505b60208210810361387957634e487b7160e01b600052602260045260246000fd5b50919050565b8082028115828204841417610e8b57610e8b6132c4565b600082516138a88184602087016132ed565b68102628102a37b5b2b760b91b920191825250600901919050565b6040815260006138d66040830185613311565b82810360208401526138e88185613311565b95945050505050565b601f82111561102057600081815260208120601f850160051c810160208610156139185750805b601f850160051c820191505b8181101561111f57828155600101613924565b81516001600160401b038111156139505761395061346a565b6139648161395e8454613845565b846138f1565b602080601f83116001811461399957600084156139815750858301515b600019600386901b1c1916600185901b17855561111f565b600085815260208120601f198616915b828110156139c8578886015182559484019460019091019084016139a9565b50858210156139e65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215613a0857600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b600060018201613a3a57613a3a6132c4565b5060010190565b60018060a01b038616815284602082015283604082015260806060820152816080820152818360a0830137600081830160a090810191909152601f909201601f19160101949350505050565b600181815b80851115613ac8578160001904821115613aae57613aae6132c4565b80851615613abb57918102915b93841c9390800290613a92565b509250929050565b600082613adf57506001610e8b565b81613aec57506000610e8b565b8160018114613b025760028114613b0c57613b28565b6001915050610e8b565b60ff841115613b1d57613b1d6132c4565b50506001821b610e8b565b5060208310610133831016604e8410600b8410161715613b4b575081810a610e8b565b613b558383613a8d565b8060001904821115613b6957613b696132c4565b029392505050565b6000610f1860ff841683613ad0565b600060208284031215613b9257600080fd5b8151610f188161337c565b600082613bac57613bac6137e3565b500690565b63ffffffff828116828216039080821115613bce57613bce6132c4565b5092915050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000808354613c0481613845565b60018281168015613c1c5760018114613c3157613c60565b60ff1984168752821515830287019450613c60565b8760005260208060002060005b85811015613c575781548a820152908401908201613c3e565b50505082870194505b5092969550505050505056fe60a060405234801561001057600080fd5b50336080819052610fdc61003d600039600081816101cd0152818161037f01526103ef0152610fdc6000f3fe608060405234801561001057600080fd5b50600436106100f65760003560e01c80634837e204116100925780634837e204146101c85780634cd88b76146101fc57806370a082311461020f57806379cc6790146102385780637ecebe001461024b57806395d89b411461026b578063a9059cbb14610273578063d505accf14610286578063dd62ed3e1461029957600080fd5b806306fdde03146100fb578063095ea7b31461011957806318160ddd1461013c57806323b872dd1461014e57806330adf81f14610161578063313ce567146101885780633644e5151461019757806340c10f19146101a057806342966c68146101b5575b600080fd5b6101036102ac565b6040516101109190610ab9565b60405180910390f35b61012c610127366004610b23565b61033e565b6040519015158152602001610110565b6002545b604051908152602001610110565b61012c61015c366004610b4d565b610358565b6101407f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160128152602001610110565b61014060055481565b6101b36101ae366004610b23565b61037c565b005b6101b36101c3366004610b89565b6103df565b6101ef7f000000000000000000000000000000000000000000000000000000000000000081565b6040516101109190610ba2565b6101b361020a366004610c59565b6103ec565b61014061021d366004610cbd565b6001600160a01b031660009081526020819052604090205490565b6101b3610246366004610b23565b61042c565b610140610259366004610cbd565b60066020526000908152604090205481565b610103610441565b61012c610281366004610b23565b610450565b6101b3610294366004610cdf565b61045e565b6101406102a7366004610d52565b610635565b6060600380546102bb90610d85565b80601f01602080910402602001604051908101604052809291908181526020018280546102e790610d85565b80156103345780601f1061030957610100808354040283529160200191610334565b820191906000526020600020905b81548152906001019060200180831161031757829003601f168201915b5050505050905090565b60003361034c818585610660565b60019150505b92915050565b600033610366858285610672565b6103718585856106c5565b506001949350505050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146103d157335b60405163472511eb60e11b81526004016103c89190610ba2565b60405180910390fd5b6103db8282610724565b5050565b6103e9338261075a565b50565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461042257336103ae565b6103db8282610790565b610437823383610672565b6103db828261075a565b6060600480546102bb90610d85565b60003361034c8185856106c5565b428410156104825760405163313c898160e11b8152600481018590526024016103c8565b6005546001600160a01b038816600090815260066020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190876104d583610dd5565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161054e92919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156105b9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615806105ee5750886001600160a01b0316816001600160a01b031614155b1561061f576040516325c0072360e11b81526001600160a01b0380831660048301528a1660248201526044016103c8565b61062a898989610660565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61066d83838360016108cd565b505050565b600061067e8484610635565b905060001981146106bf57818110156106b057828183604051637dc7a0d960e11b81526004016103c893929190610dee565b6106bf848484840360006108cd565b50505050565b6001600160a01b0383166106ef576000604051634b637e8f60e11b81526004016103c89190610ba2565b6001600160a01b03821661071957600060405163ec442f0560e01b81526004016103c89190610ba2565b61066d8383836109a2565b6001600160a01b03821661074e57600060405163ec442f0560e01b81526004016103c89190610ba2565b6103db600083836109a2565b6001600160a01b038216610784576000604051634b637e8f60e11b81526004016103c89190610ba2565b6103db826000836109a2565b8151158061079d57508051155b156107bb576040516379db2df160e11b815260040160405180910390fd5b600380546107c890610d85565b15159050806107e45750600480546107df90610d85565b151590505b1561080257604051634a8cdeb560e01b815260040160405180910390fd5b600361080e8382610e5d565b50600461081b8282610e5d565b507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600360405161084c9190610f1d565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206005555050565b6001600160a01b0384166108f757600060405163e602df0560e01b81526004016103c89190610ba2565b6001600160a01b038316610921576000604051634a1406b160e11b81526004016103c89190610ba2565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156106bf57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161099491815260200190565b60405180910390a350505050565b6001600160a01b0383166109cd5780600260008282546109c29190610f93565b90915550610a2c9050565b6001600160a01b03831660009081526020819052604090205481811015610a0d5783818360405163391434e360e21b81526004016103c893929190610dee565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610a4857600280548290039055610a67565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610aac91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b81811015610ae657858101830151858201604001528201610aca565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b1e57600080fd5b919050565b60008060408385031215610b3657600080fd5b610b3f83610b07565b946020939093013593505050565b600080600060608486031215610b6257600080fd5b610b6b84610b07565b9250610b7960208501610b07565b9150604084013590509250925092565b600060208284031215610b9b57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610bdd57600080fd5b813567ffffffffffffffff80821115610bf857610bf8610bb6565b604051601f8301601f19908116603f01168101908282118183101715610c2057610c20610bb6565b81604052838152866020858801011115610c3957600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215610c6c57600080fd5b823567ffffffffffffffff80821115610c8457600080fd5b610c9086838701610bcc565b93506020850135915080821115610ca657600080fd5b50610cb385828601610bcc565b9150509250929050565b600060208284031215610ccf57600080fd5b610cd882610b07565b9392505050565b600080600080600080600060e0888a031215610cfa57600080fd5b610d0388610b07565b9650610d1160208901610b07565b95506040880135945060608801359350608088013560ff81168114610d3557600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610d6557600080fd5b610d6e83610b07565b9150610d7c60208401610b07565b90509250929050565b600181811c90821680610d9957607f821691505b602082108103610db957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600060018201610de757610de7610dbf565b5060010190565b6001600160a01b039390931683526020830191909152604082015260600190565b601f82111561066d57600081815260208120601f850160051c81016020861015610e365750805b601f850160051c820191505b81811015610e5557828155600101610e42565b505050505050565b815167ffffffffffffffff811115610e7757610e77610bb6565b610e8b81610e858454610d85565b84610e0f565b602080601f831160018114610ec05760008415610ea85750858301515b600019600386901b1c1916600185901b178555610e55565b600085815260208120601f198616915b82811015610eef57888601518255948401946001909101908401610ed0565b5085821015610f0d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808354610f2b81610d85565b60018281168015610f435760018114610f5857610f87565b60ff1984168752821515830287019450610f87565b8760005260208060002060005b85811015610f7e5781548a820152908401908201610f65565b50505082870194505b50929695505050505050565b8082018082111561035257610352610dbf56fea2646970667358221220926f32d9ccd0b0e0016b302e43ae94cf0d0bc86d8bb2a06238ff8affbe7ed29964736f6c63430008140033d44b536c8222cd875ef4b7f421435c474a3e1035e29c64e5f039af6944de4beaa2646970667358221220026305719e357a9f9ba8c82fbf9ab3ef295548dc9c2f3b65cd4f68f253557cb164736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.