Overview
AVAX Balance
AVAX Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
BurstToken
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 125 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import "../BIFKN314.sol"; /** * @title BurstToken * @dev This contract extends the BIFKN314 contract to implement a token with a bonding curve mechanism. * It includes functionalities to manage the bonding curve phase and restrict certain operations during this phase. * * Key functionalities include: * - Initializing the Burst Factory address. * - Marking the bonding curve as complete. * - Overriding the `_update` function to include bonding curve restrictions. * * The contract uses the following custom errors for better error handling: * - `StillBonding`: Indicates that an operation cannot be performed because the bonding period is still active. * - `Unauthorized`: Indicates that the caller is not authorized to perform the operation. * - `InvalidAddress`: Indicates that an invalid address was provided. * - `AlreadyInitialized`: Indicates that the Burst Factory address has already been initialized. */ contract BurstToken is BIFKN314 { // Address of Burst Factory address public burstFactory; // Bonding Curve Complete bool public curveComplete; modifier onlyBurstFactory() { if (msg.sender != burstFactory) revert Unauthorized(msg.sender); _; } /** * @dev Error to indicate that an operation cannot be performed because the bonding period is still active. */ error StillBonding(); /** * @dev Constructor function for the BurstToken contract. * It initializes the contract by calling the constructor of the BIFKN314 contract. */ constructor() BIFKN314() {} /** * @dev Initializes the Burst Token. * @param burstFactory_ The new address of the Burst Factory. * @notice Only the contract owner can call this function. * @notice Reverts if the provided address is invalid (address(0)). */ function initializeBurstToken(address burstFactory_) external onlyOwner { if (burstFactory_ == address(0)) revert InvalidAddress(); if (burstFactory != address(0)) revert AlreadyInitialized(); burstFactory = burstFactory_; } /** * @notice Marks the curve as complete. * @dev This function can only be called by the BurstFactory contract. * @dev Sets the `curveComplete` state variable to true. * @dev External function. */ function completeTheCurve() external onlyBurstFactory { curveComplete = true; } /** * @dev Internal function to update token transfers. * Overrides the `_update` function from the parent contract. * * This function performs the following actions: * 1. Calls the parent contract's `_update` function to handle the basic transfer logic. * 2. Checks if the bonding curve phase is still active (`curveComplete` is false). * 3. If the bonding curve phase is active, it ensures that the transfer is not between certain restricted addresses. * * @param from The address from which tokens are being transferred. * @param to The address to which tokens are being transferred. * @param amount The amount of tokens being transferred. * * @notice Reverts with `StillBonding` if the bonding curve phase is active and the transfer involves restricted addresses. */ function _update( address from, address to, uint256 amount ) internal virtual override { // Is still in bonding curve phase if (!curveComplete) { if ( from != burstFactory && from != address(0) && to != burstFactory && to != DEAD_ADDRESS && to != address(0) ) revert StillBonding(); } super._update(from, to, amount); } }
// 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 "@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 { 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 public 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 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. */ uint256 public price0CumulativeLast; /** * @dev Represents the last cumulative price of the token. */ uint256 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. * 15 represents a trading fee of 0.15%. * 100 represents a trading fee of 1%. * 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 virtual { // Check if the factory contract has already been initialized // if the address of the factory contract is not the zero address, revert if (address(factory) != address(0)) revert AlreadyInitialized(); 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 (_checkAndPerformAutoSwap(recipient, amount)) { success = true; } else { _checkMaxWallet(recipient, amount); success = super.transfer(recipient, amount); } } /** * @dev Transfers tokens from one address to another using an allowance. * Overrides the transferFrom function from the inherited contract. * Includes a max wallet check to ensure the recipient's balance does not exceed the limit. * @param sender The address sending the tokens. * @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 transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool success) { if (_checkAndPerformAutoSwap(recipient, amount)) { success = true; } else { _checkMaxWallet(recipient, amount); success = super.transferFrom(sender, 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 Internal function to be called before any transfer of tokens. * Checks to see if an autoswap condition is true, if so it swaps tokens * @param to The address receiving the tokens. * @param amount The amount of tokens to transfer. * @return swapped A boolean indicating whether the tokens were swapped. */ function _checkAndPerformAutoSwap( address to, uint256 amount ) internal returns (bool swapped) { if (to == address(this) && !_autoSwapIsPrevented()) { swapTokenToNative( amount, _calculateAutoSwapSlippage(amount, false), block.timestamp + 3 minutes ); swapped = true; } } /** * @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(); 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) returns (uint256[] memory amounts) { (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(); amounts = new uint256[](2); amounts[0] = nativeIn; amounts[1] = tokensBought; 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) returns (uint256[] memory amounts) { (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(); amounts = new uint256[](2); amounts[0] = tokensSold; amounts[1] = nativeBought; 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 ( !isExempt && (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 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) (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; 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; 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 AlreadyInitialized(); }
// 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); function deployBIFKN314( string memory tokenName, string memory tokenSymbol, uint256 totalSupply, address owner_, uint256 tradingFee, uint256 maxWalletPercent, string memory metadataURI ) external payable returns (address contractAddress, address liquidityTokenAddress); function deployBIFKN314WithSalt( string memory tokenName, string memory tokenSymbol, uint256 totalSupply, address owner_, uint256 tradingFee, uint256 maxWalletPercent, string memory metadataURI, bytes32 salt ) external payable returns (address contractAddress, address liquidityTokenAddress); function getDeterministicAddress( bytes32 salt ) external view returns (address clone); function calculateDeterministicAddress( uint256 occur, address desiredPrefix, uint8 bytesDesired, bytes32 startSalt ) external view returns (bytes32 salt); event TokenCreated( address indexed deployer, string name, string symbol, address ammAddress, address lpAddress, uint256 allAMMLength ); event TokenRemoved( 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(); error PreviousFactoryNotSet(); error InvalidRange(); error OutOfBounds(); }
// 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]; } }
// 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 // 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.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) (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); }
{ "optimizer": { "enabled": true, "runs": 125 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "remappings": [], "evmVersion": "paris" }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"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":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"SlippageToleranceExceeded","type":"error"},{"inputs":[],"name":"StillBonding","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":"DEAD_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"burstFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"completeTheCurve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"curveComplete","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"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":"burstFactory_","type":"address"}],"name":"initializeBurstToken","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":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"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":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"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":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","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
60806040523480156200001157600080fd5b5060016007553362000023816200002a565b506200007c565b601780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b615099806200008c6000396000f3fe60806040526004361061037c5760003560e01c80635a3d5493116101cd578063a42dce8011610108578063ce4b5bbe116100ab578063dd62ed3e1161007a578063dd62ed3e14610af7578063e01df1a814610b17578063e156afd514610b2d578063e6cb316614610b42578063f2fde38b14610b6257600080fd5b8063ce4b5bbe14610a92578063d045a32914610aa8578063d294f09314610ac2578063d505accf14610ad757600080fd5b8063a42dce8014610983578063a614ff75146109a3578063a9059cbb146109c3578063ba9a7a56146109e3578063c415b95c146109f9578063c45a015514610a19578063c4ccdeea14610a40578063c5700a0214610a6057600080fd5b806385f8c2591161017057806385f8c259146108af5780638b19d6cf146108cf5780638da5cb5b146108ef5780638f017f921461090f57806392f6576e1461092557806395d89b411461093b5780639aa5d46214610950578063a10d2e3d1461096357600080fd5b80635a3d5493146107b757806370a08231146107cd578063715018a6146107ed578063750521f5146108025780637537ccb61461082257806379cc6790146108425780637ecebe001461086257806382bf293c1461088f57600080fd5b8063355cf34b116102b857806343cd8f7e1161025b5780634dacb6231161022a5780634dacb623146107355780634e6fd6c414610755578063538a3f0e1461076b5780635909c0d51461078b5780635a2b6c07146107a157600080fd5b806343cd8f7e146106a75780634ada218b146106d45780634b224583146106f55780634cd88b761461071557600080fd5b8063355cf34b146103bf5780633644e515146105fa578063392e53cd146106105780633a244650146106315780633c2f1806146106465780633d9a3d191461065b57806340ed04c71461067157806342966c681461068757600080fd5b80631091f67c116103205780631091f67c146104fe57806318160ddd1461051e5780631ab52a6c1461053357806320f1b9121461054957806323b872dd1461056a5780632783b5ba1461058a57806330adf81f146105aa578063313ce567146105de57600080fd5b8062813371146103bf57806303ee438c146103e7578063054d50d41461040957806306fdde03146104445780630902f1ac14610459578063095ea7b3146104835780630b52820a146104b35780630bd11f8a146104ce57600080fd5b366103ba573360009081526008602052604090205460ff166103b8576103b66103a6346001610b82565b6103b14260b4613659565b610bdc565b505b005b600080fd5b3480156103cb57600080fd5b506103d4601e81565b6040519081526020015b60405180910390f35b3480156103f357600080fd5b506103fc610d41565b6040516103de91906136bc565b34801561041557600080fd5b506104296104243660046136cf565b610dcf565b604080519384526020840192909252908201526060016103de565b34801561045057600080fd5b506103fc610ec9565b34801561046557600080fd5b5061046e610f5b565b604080519283526020830191909152016103de565b34801561048f57600080fd5b506104a361049e366004613710565b610fd5565b60405190151581526020016103de565b6104c16103b136600461373c565b6040516103de919061375e565b3480156104da57600080fd5b506104a36104e93660046137a2565b600b6020526000908152604090205460ff1681565b34801561050a57600080fd5b506103b86105193660046137bf565b610fed565b34801561052a57600080fd5b506002546103d4565b34801561053f57600080fd5b506103d460115481565b34801561055557600080fd5b506018546104a390600160a01b900460ff1681565b34801561057657600080fd5b506104a36105853660046137d8565b611055565b34801561059657600080fd5b506103b86105a53660046137a2565b61108d565b3480156105b657600080fd5b506103d47f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b3480156105ea57600080fd5b50604051601281526020016103de565b34801561060657600080fd5b506103d460055481565b34801561061c57600080fd5b50600a546104a390600160a01b900460ff1681565b34801561063d57600080fd5b506103b8611120565b34801561065257600080fd5b506103d4611162565b34801561066757600080fd5b506103d4600f5481565b34801561067d57600080fd5b506103d460125481565b34801561069357600080fd5b506103b86106a23660046137bf565b611172565b3480156106b357600080fd5b50600a546106c7906001600160a01b031681565b6040516103de9190613819565b3480156106e057600080fd5b50600a546104a390600160a81b900460ff1681565b34801561070157600080fd5b506104c16107103660046136cf565b61117f565b34801561072157600080fd5b506103b86107303660046138d0565b6112d9565b34801561074157600080fd5b506018546106c7906001600160a01b031681565b34801561076157600080fd5b506106c761dead81565b34801561077757600080fd5b506103b86107863660046137a2565b6113db565b34801561079757600080fd5b506103d4600c5481565b3480156107ad57600080fd5b506103d460145481565b3480156107c357600080fd5b506103d4600d5481565b3480156107d957600080fd5b506103d46107e83660046137a2565b611442565b3480156107f957600080fd5b506103b861145d565b34801561080e57600080fd5b506103b861081d366004613934565b61148a565b34801561082e57600080fd5b506103b861083d366004613981565b6114bb565b34801561084e57600080fd5b506103b861085d366004613710565b611561565b34801561086e57600080fd5b506103d461087d3660046137a2565b60066020526000908152604090205481565b34801561089b57600080fd5b506103b86108aa3660046137bf565b611576565b3480156108bb57600080fd5b506103d46108ca3660046136cf565b6115ed565b3480156108db57600080fd5b506103b86108ea3660046139b6565b611692565b3480156108fb57600080fd5b506017546106c7906001600160a01b031681565b34801561091b57600080fd5b506103d460155481565b34801561093157600080fd5b506103d46101f481565b34801561094757600080fd5b506103fc61178c565b6103d461095e366004613a23565b61179b565b34801561096f57600080fd5b5061046e61097e3660046137bf565b611b2c565b34801561098f57600080fd5b506103b861099e3660046137a2565b611c7a565b3480156109af57600080fd5b506103b86109be366004613a4a565b611ce4565b3480156109cf57600080fd5b506104a36109de366004613710565b611d43565b3480156109ef57600080fd5b506103d46103e881565b348015610a0557600080fd5b506016546106c7906001600160a01b031681565b348015610a2557600080fd5b50600e546106c790600160201b90046001600160a01b031681565b348015610a4c57600080fd5b5061046e610a5b366004613a23565b611d70565b348015610a6c57600080fd5b50600e54610a7d9063ffffffff1681565b60405163ffffffff90911681526020016103de565b348015610a9e57600080fd5b506103d461271081565b348015610ab457600080fd5b506010546104a39060ff1681565b348015610ace57600080fd5b506103b8611f72565b348015610ae357600080fd5b506103b8610af2366004613a65565b612046565b348015610b0357600080fd5b506103d4610b12366004613adc565b61221d565b348015610b2357600080fd5b506103d460135481565b348015610b3957600080fd5b506103b8612248565b348015610b4e57600080fd5b506103b8610b5d366004613b15565b61227e565b348015610b6e57600080fd5b506103b8610b7d3660046137a2565b61260f565b6000806000610b8f610f5b565b915091506000610bb78686610ba45783610ba6565b845b87610bb15785610dcf565b84610dcf565b50509050601481610bc89190613bc1565b610bd29082613bd5565b9695505050505050565b6060610be6612660565b81804210610c07576040516338e5e54b60e21b815260040160405180910390fd5b600080610c12610f5b565b90925090503433610c238285613bd5565b93506000806000610c36858c898961268a565b9250925092508060146000828254610c4e9190613659565b90915550610c5f9050826001612764565b610c6984846128cc565b610c74308585612999565b610c7c6129f8565b60408051600280825260608201835290916020830190803683370190505098508489600081518110610cb057610cb0613be8565b6020026020010181815250508289600181518110610cd057610cd0613be8565b6020908102919091018101919091526040805160008082529281018890529081018590526060810182905260808101919091526001600160a01b038516906000805160206150448339815191529060a00160405180910390a25050505050505050610d3b6001600755565b92915050565b60098054610d4e90613bfe565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7a90613bfe565b8015610dc75780601f10610d9c57610100808354040283529160200191610dc7565b820191906000526020600020905b815481529060010190602001808311610daa57829003601f168201915b505050505081565b60008060008061271090506000601354601e610deb9190613659565b610df790612710613bd5565b90506000610e05838a613c38565b9050600088118015610e175750600087115b15610ea45782610e2682612b72565b610e309190613bc1565b945082610e3c82612c2a565b610e469190613bc1565b93506000610e548383613c38565b90506000610e628983613c38565b905060008286610e746127108e613c38565b610e7e9190613c38565b610e889190613659565b9050808281610e9957610e99613bab565b049850505050610ebd565b604051633dce448b60e11b815260040160405180910390fd5b50505093509350939050565b606060038054610ed890613bfe565b80601f0160208091040260200160405190810160405280929190818152602001828054610f0490613bfe565b8015610f515780601f10610f2657610100808354040283529160200191610f51565b820191906000526020600020905b815481529060010190602001808311610f3457829003601f168201915b5050505050905090565b60008060004790506000601154601454610f759190613659565b90506000610f81611162565b90506000601254601554610f959190613659565b905082841015610fa6576000610fb0565b610fb08385613bd5565b955080821015610fc1576000610fcb565b610fcb8183613bd5565b9450505050509091565b600033610fe3818585612c4f565b5060019392505050565b6017546001600160a01b0316336001600160a01b03161461102d57335b60405163472511eb60e11b81526004016110249190613819565b60405180910390fd5b6101f481111561105057604051630adad23360e31b815260040160405180910390fd5b601355565b60006110618383612c5c565b1561106e57506001611086565b61107883836128cc565b611083848484612ca5565b90505b9392505050565b6017546001600160a01b0316336001600160a01b0316146110ae573361100a565b6001600160a01b0381166110d55760405163e6c4247b60e01b815260040160405180910390fd5b6018546001600160a01b0316156110fe5760405162dc149f60e41b815260040160405180910390fd5b601880546001600160a01b0319166001600160a01b0392909216919091179055565b6018546001600160a01b0316331461114d573360405163472511eb60e11b81526004016110249190613819565b6018805460ff60a01b1916600160a01b179055565b600061116d30611442565b905090565b61117c3382612cc9565b50565b6060611189612660565b818042106111aa576040516338e5e54b60e21b815260040160405180910390fd5b6000806111b5610f5b565b9150915060006111c23390565b905060008060006111d58b8b878961268a565b92509250925080601560008282546111ed9190613659565b909155506111fe9050826000612764565b61120984308d612cff565b6112138484612d0a565b61121b6129f8565b60408051600280825260608201835290916020830190803683370190505097508a8860008151811061124f5761124f613be8565b602002602001018181525050828860018151811061126f5761126f613be8565b602090810291909101810191909152604080518d815260009281018390529081018290526060810185905260808101919091526001600160a01b038516906000805160206150448339815191529060a00160405180910390a2505050505050506110866001600755565b6017546001600160a01b0316336001600160a01b0316146112fa573361100a565b6113048282612dbc565b60405161131090613636565b604051809103906000f08015801561132c573d6000803e3d6000fd5b50600a80546001600160a01b0319166001600160a01b03929092169182179055604051634cd88b7690611363908590602001613c4f565b60408051601f19818403018152828201825260038352620424c560ec1b602084015290516001600160e01b031960e085901b1681526113a59290600401613c7c565b600060405180830381600087803b1580156113bf57600080fd5b505af11580156113d3573d6000803e3d6000fd5b505050505050565b600e54600160201b90046001600160a01b03161561140b5760405162dc149f60e41b815260040160405180910390fd5b600e8054640100000000600160c01b031916600160201b6001600160a01b038481168202929092179283905561117c920416612ef9565b6001600160a01b031660009081526020819052604090205490565b6017546001600160a01b0316336001600160a01b03161461147e573361100a565b6114886000612ef9565b565b6017546001600160a01b0316336001600160a01b0316146114ab573361100a565b60096114b78282613cf0565b5050565b6017546001600160a01b0316336001600160a01b0316146114dc573361100a565b8015801561151857506001600160a01b038216158061150357506001600160a01b03821630145b8061151857506001600160a01b03821661dead145b156115365760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b61156c823383612f4b565b6114b78282612cc9565b6017546001600160a01b0316336001600160a01b031614611597573361100a565b6127108111156115ba576040516326dd075560e01b815260040160405180910390fd5b60105460ff1680156115ca575080155b156115e8576040516326dd075560e01b815260040160405180910390fd5b600f55565b60135460009061271090829061160490601e613659565b61161090612710613bd5565b905061161c8282613c38565b905060008411801561162e5750600085115b15610ea4576000826127106116438989613c38565b61164d9190613c38565b6116579190613c38565b90506000826116668988613bd5565b6116709190613c38565b905080828161168157611681613bab565b046001019450505050509392505050565b6017546001600160a01b0316336001600160a01b0316146116b3573361100a565b846000036116d457604051635e85ae7360e01b815260040160405180910390fd5b60006116df60025490565b11156116fe57604051630a87463f60e21b815260040160405180910390fd5b6001600160a01b038416611725576040516349e27cff60e01b815260040160405180910390fd5b8115611741576010805460ff1916600117905561174182611576565b600961174d8282613cf0565b5061175783610fed565b61176084612ef9565b601680546001600160a01b0319166001600160a01b0386161790556117858486612fab565b5050505050565b606060048054610ed890613bfe565b60006117a5612660565b818042106117c6576040516338e5e54b60e21b815260040160405180910390fd5b338515806117d2575034155b156117f057604051635e85ae7360e01b815260040160405180910390fd5b6000806117fb610f5b565b909250905061180a3483613bd5565b91506000600a60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611861573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118859190613db0565b9050348960008390036119375760006118a66118a18385613c38565b612fe1565b90506118b46103e882613bd5565b600a546040516340c10f1960e01b8152919a506001600160a01b0316906340c10f19906118eb9061dead906103e890600401613dc9565b600060405180830381600087803b15801561190557600080fd5b505af1158015611919573d6000803e3d6000fd5b5050600a805460ff60a01b1916600160a01b17905550611a33915050565b841580611942575083155b1561196057604051633dce448b60e11b815260040160405180910390fd5b8461196b8584613c38565b6119759190613bc1565b9050600061198386866130c9565b9050818c10156119b057604051633885308960e21b8152600481018d905260248101839052604401611024565b6119e2866119be8686613c38565b6119c89190613bc1565b866119d38786613c38565b6119dd9190613bc1565b6130d5565b985060006119f08488613659565b905060006119fe8488613659565b90506000611a0c8383613c38565b905083811015611a2e5760405162bfbd3d60e31b815260040160405180910390fd5b505050505b87600003611a5457604051633489be7560e21b815260040160405180910390fd5b600a546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990611a86908d908c90600401613dc9565b600060405180830381600087803b158015611aa057600080fd5b505af1158015611ab4573d6000803e3d6000fd5b50505050611ac3863083612cff565b611acb6129f8565b604080518981523460208201529081018290526001600160a01b03808c1691908816907f2f3289d16dbc3007471d28c4936df3a95222bc938112449400d049637e3309ce9060600160405180910390a3505050505050506110866001600755565b60008082600003611b5057604051635e85ae7360e01b815260040160405180910390fd5b600080611b5b610f5b565b915091508160001480611b6c575080155b15611b8a57604051633dce448b60e11b815260040160405180910390fd5b600a54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015611bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf89190613db0565b905080600003611c1b5760405163bb55fd2760e01b815260040160405180910390fd5b80611c268488613c38565b611c309190613bc1565b945080611c3d8388613c38565b611c479190613bc1565b9350841580611c54575083155b15611c725760405163bb55fd2760e01b815260040160405180910390fd5b505050915091565b6017546001600160a01b0316336001600160a01b031614611c9b573361100a565b6001600160a01b038116611cc25760405163e6c4247b60e01b815260040160405180910390fd5b601680546001600160a01b0319166001600160a01b0392909216919091179055565b6017546001600160a01b0316336001600160a01b031614611d05573361100a565b808015611d125750600f54155b15611d30576040516326dd075560e01b815260040160405180910390fd5b6010805460ff1916911515919091179055565b6000611d4f8383612c5c565b15611d5c57506001610d3b565b611d6683836128cc565b61108683836130eb565b600080611d7b612660565b82804210611d9c576040516338e5e54b60e21b815260040160405180910390fd5b600a543390600160a01b900460ff16611dc85760405163aae677e160e01b815260040160405180910390fd5b600a546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611df9908590600401613819565b602060405180830381865afa158015611e16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3a9190613db0565b905080600003611e5d57604051635a5ec44f60e01b815260040160405180910390fd5b80881115611e7e5760405163bb55fd2760e01b815260040160405180910390fd5b611e8788611b2c565b600a5460405163079cc67960e41b81529297509095506001600160a01b0316906379cc679090611ebd9085908c90600401613dc9565b600060405180830381600087803b158015611ed757600080fd5b505af1158015611eeb573d6000803e3d6000fd5b50505050611ef98786612d0a565b611f04308886612999565b60408051898152602081018790529081018590526001600160a01b0380891691908416907feb755d537a0caac69ccb1ac1dc2b7397a32bb19f93bd06013c57ac0b2e5dd69c9060600160405180910390a3611f5d6129f8565b505050611f6a6001600755565b935093915050565b6016546001600160a01b0316336001600160a01b031614611f93573361100a565b6014546015543382158015611fa6575081155b15611fc45760405163211b631760e21b815260040160405180910390fd5b6000601455611fd1611162565b821115611fe357611fe0611162565b91505b6000601555611ff28184612d0a565b611ffd308284612999565b60408051848152602081018490526001600160a01b038316917f2e4fb6077d4acf86e12bb7411fb82b2b3eaa6a49787f4b1e17b423e7ea841169910160405180910390a2505050565b4284101561206a5760405163313c898160e11b815260048101859052602401611024565b6005546001600160a01b038816600090815260066020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190876120bd83613de2565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161213692919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156121a1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615806121d65750886001600160a01b0316816001600160a01b031614155b15612207576040516325c0072360e11b81526001600160a01b0380831660048301528a166024820152604401611024565b612212898989612c4f565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6017546001600160a01b0316336001600160a01b031614612269573361100a565b600a805460ff60a81b1916600160a81b179055565b612286612660565b61228e6130f9565b600a54600160a01b900460ff166122b85760405163aae677e160e01b815260040160405180910390fd5b600a54600160a81b900460ff166122e257604051637e99d8bb60e01b815260040160405180910390fd5b831580156122ee575082155b1561230c57604051635e85ae7360e01b815260040160405180910390fd5b6001600160a01b038516158061232a57506001600160a01b03851630145b1561234857604051634e46966960e11b815260040160405180910390fd5b600080612353610f5b565b915091508186118061236457508085115b156123825760405163bb55fd2760e01b815260040160405180910390fd5b338615612393576123938888612d0a565b85156123ae576123a388876128cc565b6123ae308988612999565b60405163f3438c1760e01b81526001600160a01b0389169063f3438c17906123e29084908b908b908b908b90600401613dfb565b600060405180830381600087803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b5050505060008061241f610f5b565b91509150600085831161243357600061243d565b61243d8684613bd5565b9050600085831161244f576000612459565b6124598684613bd5565b905081158015612467575080155b156124855760405163e2ddc74960e01b815260040160405180910390fd5b6000601354601e6124969190613659565b905060006124a48285613c38565b6124b061271088613c38565b6124ba9190613bd5565b905060006124c88385613c38565b6124d461271088613c38565b6124de9190613bd5565b90506124ed6002612710613f2b565b6124f78a8c613c38565b6125019190613c38565b61250b8284613c38565b10156125295760405162bfbd3d60e31b815260040160405180910390fd5b50505061253582612c2a565b601460008282546125469190613659565b90915550612555905081612c2a565b601560008282546125669190613659565b9091555061257f905061257883612b72565b6001612764565b61259261258b82612b72565b6000612764565b61259a6129f8565b60408051828152602081018490529081018b9052606081018c9052600160808201526001600160a01b038616906000805160206150448339815191529060a00160405180910390a250505050505050612605336000908152600860205260409020805460ff19169055565b6117856001600755565b6017546001600160a01b0316336001600160a01b031614612630573361100a565b6001600160a01b038116612657576040516349e27cff60e01b815260040160405180910390fd5b61117c81612ef9565b60026007540361268357604051633ee5aeb560e01b815260040160405180910390fd5b6002600755565b600080600061269a878686613146565b60006126a686866130c9565b90506126b3888787610dcf565b9195509350915060008490036126dc5760405163271a700960e01b815260040160405180910390fd5b868410156126fd5760405163339454fb60e11b815260040160405180910390fd5b60008361270a848b613bd5565b6127149190613bd5565b61271e9088613659565b9050600061272c8688613bd5565b90508261273983836130c9565b10156127575760405162bfbd3d60e31b815260040160405180910390fd5b5050509450945094915050565b600e54600160201b90046001600160a01b0316156114b7576000600e60049054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f59190613f3a565b90506000600e60049054906101000a90046001600160a01b03166001600160a01b031663ef973d476040518163ffffffff1660e01b8152600401602060405180830381865afa15801561284c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128709190613db0565b90506001600160a01b038216156128c65782156128a45783601160008282546128999190613659565b909155506128bc9050565b83601260008282546128b69190613659565b90915550505b6128c682826131e4565b50505050565b60105460ff166128da575050565b6001600160a01b0382163014806128f857506001600160a01b038216155b8061290d57506001600160a01b03821661dead145b8061293057506001600160a01b0382166000908152600b602052604090205460ff165b15612939575050565b6000612710600f5461294a60025490565b6129549190613c38565b61295e9190613bc1565b9050808261296b85611442565b6129759190613659565b11156129945760405163a9a44dff60e01b815260040160405180910390fd5b505050565b6001600160a01b0383166129c3576000604051634b637e8f60e11b81526004016110249190613819565b6001600160a01b0382166129ed57600060405163ec442f0560e01b81526004016110249190613819565b6129948383836132fe565b600080612a03610f5b565b915091508160001480612a14575080155b15612a3257604051633dce448b60e11b815260040160405180910390fd5b6000612a42600160201b42613f57565b600e54909150600090612a5b9063ffffffff1683613f6b565b905060008163ffffffff16118015612a7257508315155b8015612a7d57508215155b15612b1f57600160701b600084612a948388613c38565b612a9e9190613bc1565b9050600086612aad8488613c38565b612ab79190613bc1565b9050612ac963ffffffff851683613c38565b600c6000828254612ada9190613659565b90915550612af0905063ffffffff851682613c38565b600d6000828254612b019190613659565b9091555050600e805463ffffffff191663ffffffff87161790555050505b600c54600d54600e5460408051938452602084019290925263ffffffff1682820152517f1d0b407d784b19534f95cb221efeda97b16fcb4171eb57280723bad5ccfce40d9181900360600190a150505050565b600e54600090600160201b90046001600160a01b0316612b9457506000919050565b612710600e60049054906101000a90046001600160a01b03166001600160a01b031663978bbdb96040518163ffffffff1660e01b8152600401602060405180830381865afa158015612bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c0e9190613db0565b612c189084613c38565b612c229190613bc1565b90505b919050565b6000601354600003612c3e57506000919050565b61271060135483612c189190613c38565b61299483838360016133a3565b60006001600160a01b03831630148015612c8657503360009081526008602052604090205460ff16155b15610d3b57610fe382612c9a846000610b82565b6107104260b4613659565b600033612cb3858285612f4b565b612cbe858585612999565b506001949350505050565b6001600160a01b038216612cf3576000604051634b637e8f60e11b81526004016110249190613819565b6114b7826000836132fe565b612994838383612999565b80600003612d16575050565b6001600160a01b038216612d3d5760405163e6c4247b60e01b815260040160405180910390fd5b47811115612d485750475b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612d95576040519150601f19603f3d011682016040523d82523d6000602084013e612d9a565b606091505b505090508061299457604051634173d3a560e11b815260040160405180910390fd5b81511580612dc957508051155b15612de7576040516379db2df160e11b815260040160405180910390fd5b60038054612df490613bfe565b1515905080612e10575060048054612e0b90613bfe565b151590505b15612e2e57604051634a8cdeb560e01b815260040160405180910390fd5b6003612e3a8382613cf0565b506004612e478282613cf0565b507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6003604051612e789190613f8f565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206005555050565b601780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000612f57848461221d565b905060001981146128c65781811015612f9c57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401611024565b6128c6848484840360006133a3565b6001600160a01b038216612fd557600060405163ec442f0560e01b81526004016110249190613819565b6114b7600083836132fe565b600081600003612ff357506000919050565b6000600161300084613478565b901c6001901b9050600181848161301957613019613bab565b048201901c9050600181848161303157613031613bab565b048201901c9050600181848161304957613049613bab565b048201901c9050600181848161306157613061613bab565b048201901c9050600181848161307957613079613bab565b048201901c9050600181848161309157613091613bab565b048201901c905060018184816130a9576130a9613bab565b048201901c9050611086818285816130c3576130c3613bab565b046130d5565b60006110868284613c38565b60008183106130e45781611086565b5090919050565b600033610fe3818585612999565b3360009081526008602052604090205460ff161561312a57604051631584469560e11b815260040160405180910390fd5b336000908152600860205260409020805460ff19166001179055565b600a54600160a01b900460ff166131705760405163aae677e160e01b815260040160405180910390fd5b600a54600160a81b900460ff1661319a57604051637e99d8bb60e01b815260040160405180910390fd5b826000036131bb57604051635e85ae7360e01b815260040160405180910390fd5b8115806131c6575080155b1561299457604051633dce448b60e11b815260040160405180910390fd5b601154601254600080831580156131f9575082155b1561320657505050505050565b6000841180156132165750848410155b15613225576000601155600191505b821561328357600080613236610f5b565b90925090506000816132488488613c38565b6132529190613bc1565b905087811061327f57613263611162565b86111561327557613272611162565b95505b6000601255600193505b5050505b8115613293576132938685612d0a565b80156132a4576132a4308785612999565b81806132ad5750805b156113d35760408051858152602081018590526001600160a01b038816917f85da6ab72d2b48932522aea80adb8ca4fab6cdeb87bc2e7f6c03fd78d3b2100e910160405180910390a2505050505050565b601854600160a01b900460ff16613398576018546001600160a01b0384811691161480159061333557506001600160a01b03831615155b801561334f57506018546001600160a01b03838116911614155b801561336657506001600160a01b03821661dead14155b801561337a57506001600160a01b03821615155b156133985760405163188acae760e11b815260040160405180910390fd5b61299483838361350c565b6001600160a01b0384166133cd57600060405163e602df0560e01b81526004016110249190613819565b6001600160a01b0383166133f7576000604051634a1406b160e11b81526004016110249190613819565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156128c657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161346a91815260200190565b60405180910390a350505050565b600080608083901c1561348d57608092831c92015b604083901c1561349f57604092831c92015b602083901c156134b157602092831c92015b601083901c156134c357601092831c92015b600883901c156134d557600892831c92015b600483901c156134e757600492831c92015b600283901c156134f957600292831c92015b600183901c15610d3b5760010192915050565b6001600160a01b03831661353757806002600082825461352c9190613659565b909155506135a99050565b6001600160a01b0383166000908152602081905260409020548181101561358a5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401611024565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166135c5576002805482900390556135e4565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161362991815260200190565b60405180910390a3505050565b61103e8061400683390190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610d3b57610d3b613643565b60005b8381101561368757818101518382015260200161366f565b50506000910152565b600081518084526136a881602086016020860161366c565b601f01601f19169290920160200192915050565b6020815260006110866020830184613690565b6000806000606084860312156136e457600080fd5b505081359360208301359350604090920135919050565b6001600160a01b038116811461117c57600080fd5b6000806040838503121561372357600080fd5b823561372e816136fb565b946020939093013593505050565b6000806040838503121561374f57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156137965783518352928401929184019160010161377a565b50909695505050505050565b6000602082840312156137b457600080fd5b8135611086816136fb565b6000602082840312156137d157600080fd5b5035919050565b6000806000606084860312156137ed57600080fd5b83356137f8816136fb565b92506020840135613808816136fb565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261385457600080fd5b813567ffffffffffffffff8082111561386f5761386f61382d565b604051601f8301601f19908116603f011681019082821181831017156138975761389761382d565b816040528381528660208588010111156138b057600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080604083850312156138e357600080fd5b823567ffffffffffffffff808211156138fb57600080fd5b61390786838701613843565b9350602085013591508082111561391d57600080fd5b5061392a85828601613843565b9150509250929050565b60006020828403121561394657600080fd5b813567ffffffffffffffff81111561395d57600080fd5b61396984828501613843565b949350505050565b80358015158114612c2557600080fd5b6000806040838503121561399457600080fd5b823561399f816136fb565b91506139ad60208401613971565b90509250929050565b600080600080600060a086880312156139ce57600080fd5b8535945060208601356139e0816136fb565b93506040860135925060608601359150608086013567ffffffffffffffff811115613a0a57600080fd5b613a1688828901613843565b9150509295509295909350565b600080600060608486031215613a3857600080fd5b833592506020840135613808816136fb565b600060208284031215613a5c57600080fd5b61108682613971565b600080600080600080600060e0888a031215613a8057600080fd5b8735613a8b816136fb565b96506020880135613a9b816136fb565b95506040880135945060608801359350608088013560ff81168114613abf57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215613aef57600080fd5b8235613afa816136fb565b91506020830135613b0a816136fb565b809150509250929050565b600080600080600060808688031215613b2d57600080fd5b8535613b38816136fb565b94506020860135935060408601359250606086013567ffffffffffffffff80821115613b6357600080fd5b818801915088601f830112613b7757600080fd5b813581811115613b8657600080fd5b896020828501011115613b9857600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052601260045260246000fd5b600082613bd057613bd0613bab565b500490565b81810381811115610d3b57610d3b613643565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680613c1257607f821691505b602082108103613c3257634e487b7160e01b600052602260045260246000fd5b50919050565b8082028115828204841417610d3b57610d3b613643565b60008251613c6181846020870161366c565b68102628102a37b5b2b760b91b920191825250600901919050565b604081526000613c8f6040830185613690565b8281036020840152613ca18185613690565b95945050505050565b601f82111561299457600081815260208120601f850160051c81016020861015613cd15750805b601f850160051c820191505b818110156113d357828155600101613cdd565b815167ffffffffffffffff811115613d0a57613d0a61382d565b613d1e81613d188454613bfe565b84613caa565b602080601f831160018114613d535760008415613d3b5750858301515b600019600386901b1c1916600185901b1785556113d3565b600085815260208120601f198616915b82811015613d8257888601518255948401946001909101908401613d63565b5085821015613da05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215613dc257600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b600060018201613df457613df4613643565b5060010190565b60018060a01b038616815284602082015283604082015260806060820152816080820152818360a0830137600081830160a090810191909152601f909201601f19160101949350505050565b600181815b80851115613e82578160001904821115613e6857613e68613643565b80851615613e7557918102915b93841c9390800290613e4c565b509250929050565b600082613e9957506001610d3b565b81613ea657506000610d3b565b8160018114613ebc5760028114613ec657613ee2565b6001915050610d3b565b60ff841115613ed757613ed7613643565b50506001821b610d3b565b5060208310610133831016604e8410600b8410161715613f05575081810a610d3b565b613f0f8383613e47565b8060001904821115613f2357613f23613643565b029392505050565b600061108660ff841683613e8a565b600060208284031215613f4c57600080fd5b8151611086816136fb565b600082613f6657613f66613bab565b500690565b63ffffffff828116828216039080821115613f8857613f88613643565b5092915050565b6000808354613f9d81613bfe565b60018281168015613fb55760018114613fca57613ff9565b60ff1984168752821515830287019450613ff9565b8760005260208060002060005b85811015613ff05781548a820152908401908201613fd7565b50505082870194505b5092969550505050505056fe60a060405234801561001057600080fd5b5033608081905261100161003d600039600081816101ed0152818161039f015261040f01526110016000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80634837e204116100a25780637ecebe00116100715780637ecebe001461026b57806395d89b411461028b578063a9059cbb14610293578063d505accf146102a6578063dd62ed3e146102b957600080fd5b80634837e204146101e85780634cd88b761461021c57806370a082311461022f57806379cc67901461025857600080fd5b806330adf81f116100e957806330adf81f14610181578063313ce567146101a85780633644e515146101b757806340c10f19146101c057806342966c68146101d557600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c57806323b872dd1461016e575b600080fd5b6101236102cc565b6040516101309190610aff565b60405180910390f35b61014c610147366004610b69565b61035e565b6040519015158152602001610130565b6002545b604051908152602001610130565b61014c61017c366004610b93565b610378565b6101607f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160128152602001610130565b61016060055481565b6101d36101ce366004610b69565b61039c565b005b6101d36101e3366004610bcf565b6103ff565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516101309190610be8565b6101d361022a366004610c9f565b61040c565b61016061023d366004610d03565b6001600160a01b031660009081526020819052604090205490565b6101d3610266366004610b69565b61044c565b610160610279366004610d03565b60066020526000908152604090205481565b610123610461565b61014c6102a1366004610b69565b610470565b6101d36102b4366004610d25565b61047e565b6101606102c7366004610d98565b610655565b6060600380546102db90610dcb565b80601f016020809104026020016040519081016040528092919081815260200182805461030790610dcb565b80156103545780601f1061032957610100808354040283529160200191610354565b820191906000526020600020905b81548152906001019060200180831161033757829003601f168201915b5050505050905090565b60003361036c818585610680565b60019150505b92915050565b600033610386858285610692565b6103918585856106f8565b506001949350505050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146103f157335b60405163472511eb60e11b81526004016103e89190610be8565b60405180910390fd5b6103fb8282610757565b5050565b610409338261078d565b50565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461044257336103ce565b6103fb82826107c3565b610457823383610692565b6103fb828261078d565b6060600480546102db90610dcb565b60003361036c8185856106f8565b428410156104a25760405163313c898160e11b8152600481018590526024016103e8565b6005546001600160a01b038816600090815260066020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190876104f583610e1b565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161056e92919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156105d9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158061060e5750886001600160a01b0316816001600160a01b031614155b1561063f576040516325c0072360e11b81526001600160a01b0380831660048301528a1660248201526044016103e8565b61064a898989610680565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61068d8383836001610900565b505050565b600061069e8484610655565b905060001981146106f257818110156106e357604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016103e8565b6106f284848484036000610900565b50505050565b6001600160a01b038316610722576000604051634b637e8f60e11b81526004016103e89190610be8565b6001600160a01b03821661074c57600060405163ec442f0560e01b81526004016103e89190610be8565b61068d8383836109d5565b6001600160a01b03821661078157600060405163ec442f0560e01b81526004016103e89190610be8565b6103fb600083836109d5565b6001600160a01b0382166107b7576000604051634b637e8f60e11b81526004016103e89190610be8565b6103fb826000836109d5565b815115806107d057508051155b156107ee576040516379db2df160e11b815260040160405180910390fd5b600380546107fb90610dcb565b151590508061081757506004805461081290610dcb565b151590505b1561083557604051634a8cdeb560e01b815260040160405180910390fd5b60036108418382610e82565b50600461084e8282610e82565b507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600360405161087f9190610f42565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206005555050565b6001600160a01b03841661092a57600060405163e602df0560e01b81526004016103e89190610be8565b6001600160a01b038316610954576000604051634a1406b160e11b81526004016103e89190610be8565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156106f257826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516109c791815260200190565b60405180910390a350505050565b6001600160a01b038316610a005780600260008282546109f59190610fb8565b90915550610a729050565b6001600160a01b03831660009081526020819052604090205481811015610a535760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016103e8565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610a8e57600280548290039055610aad565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610af291815260200190565b60405180910390a3505050565b600060208083528351808285015260005b81811015610b2c57858101830151858201604001528201610b10565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b6457600080fd5b919050565b60008060408385031215610b7c57600080fd5b610b8583610b4d565b946020939093013593505050565b600080600060608486031215610ba857600080fd5b610bb184610b4d565b9250610bbf60208501610b4d565b9150604084013590509250925092565b600060208284031215610be157600080fd5b5035919050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610c2357600080fd5b813567ffffffffffffffff80821115610c3e57610c3e610bfc565b604051601f8301601f19908116603f01168101908282118183101715610c6657610c66610bfc565b81604052838152866020858801011115610c7f57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215610cb257600080fd5b823567ffffffffffffffff80821115610cca57600080fd5b610cd686838701610c12565b93506020850135915080821115610cec57600080fd5b50610cf985828601610c12565b9150509250929050565b600060208284031215610d1557600080fd5b610d1e82610b4d565b9392505050565b600080600080600080600060e0888a031215610d4057600080fd5b610d4988610b4d565b9650610d5760208901610b4d565b95506040880135945060608801359350608088013560ff81168114610d7b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610dab57600080fd5b610db483610b4d565b9150610dc260208401610b4d565b90509250929050565b600181811c90821680610ddf57607f821691505b602082108103610dff57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600060018201610e2d57610e2d610e05565b5060010190565b601f82111561068d57600081815260208120601f850160051c81016020861015610e5b5750805b601f850160051c820191505b81811015610e7a57828155600101610e67565b505050505050565b815167ffffffffffffffff811115610e9c57610e9c610bfc565b610eb081610eaa8454610dcb565b84610e34565b602080601f831160018114610ee55760008415610ecd5750858301515b600019600386901b1c1916600185901b178555610e7a565b600085815260208120601f198616915b82811015610f1457888601518255948401946001909101908401610ef5565b5085821015610f325787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808354610f5081610dcb565b60018281168015610f685760018114610f7d57610fac565b60ff1984168752821515830287019450610fac565b8760005260208060002060005b85811015610fa35781548a820152908401908201610f8a565b50505082870194505b50929695505050505050565b8082018082111561037257610372610e0556fea2646970667358221220ade3b1eb5ec4f757871c03ac2e9df92f938c8ced574713ab8e3bf22bdbff0cf064736f6c63430008140033d44b536c8222cd875ef4b7f421435c474a3e1035e29c64e5f039af6944de4beaa26469706673582212206f5ca01486e6ba1bf006e045a68529672db43abafbc78a2d463fa5524a7ec92864736f6c63430008140033
Deployed Bytecode
0x60806040526004361061037c5760003560e01c80635a3d5493116101cd578063a42dce8011610108578063ce4b5bbe116100ab578063dd62ed3e1161007a578063dd62ed3e14610af7578063e01df1a814610b17578063e156afd514610b2d578063e6cb316614610b42578063f2fde38b14610b6257600080fd5b8063ce4b5bbe14610a92578063d045a32914610aa8578063d294f09314610ac2578063d505accf14610ad757600080fd5b8063a42dce8014610983578063a614ff75146109a3578063a9059cbb146109c3578063ba9a7a56146109e3578063c415b95c146109f9578063c45a015514610a19578063c4ccdeea14610a40578063c5700a0214610a6057600080fd5b806385f8c2591161017057806385f8c259146108af5780638b19d6cf146108cf5780638da5cb5b146108ef5780638f017f921461090f57806392f6576e1461092557806395d89b411461093b5780639aa5d46214610950578063a10d2e3d1461096357600080fd5b80635a3d5493146107b757806370a08231146107cd578063715018a6146107ed578063750521f5146108025780637537ccb61461082257806379cc6790146108425780637ecebe001461086257806382bf293c1461088f57600080fd5b8063355cf34b116102b857806343cd8f7e1161025b5780634dacb6231161022a5780634dacb623146107355780634e6fd6c414610755578063538a3f0e1461076b5780635909c0d51461078b5780635a2b6c07146107a157600080fd5b806343cd8f7e146106a75780634ada218b146106d45780634b224583146106f55780634cd88b761461071557600080fd5b8063355cf34b146103bf5780633644e515146105fa578063392e53cd146106105780633a244650146106315780633c2f1806146106465780633d9a3d191461065b57806340ed04c71461067157806342966c681461068757600080fd5b80631091f67c116103205780631091f67c146104fe57806318160ddd1461051e5780631ab52a6c1461053357806320f1b9121461054957806323b872dd1461056a5780632783b5ba1461058a57806330adf81f146105aa578063313ce567146105de57600080fd5b8062813371146103bf57806303ee438c146103e7578063054d50d41461040957806306fdde03146104445780630902f1ac14610459578063095ea7b3146104835780630b52820a146104b35780630bd11f8a146104ce57600080fd5b366103ba573360009081526008602052604090205460ff166103b8576103b66103a6346001610b82565b6103b14260b4613659565b610bdc565b505b005b600080fd5b3480156103cb57600080fd5b506103d4601e81565b6040519081526020015b60405180910390f35b3480156103f357600080fd5b506103fc610d41565b6040516103de91906136bc565b34801561041557600080fd5b506104296104243660046136cf565b610dcf565b604080519384526020840192909252908201526060016103de565b34801561045057600080fd5b506103fc610ec9565b34801561046557600080fd5b5061046e610f5b565b604080519283526020830191909152016103de565b34801561048f57600080fd5b506104a361049e366004613710565b610fd5565b60405190151581526020016103de565b6104c16103b136600461373c565b6040516103de919061375e565b3480156104da57600080fd5b506104a36104e93660046137a2565b600b6020526000908152604090205460ff1681565b34801561050a57600080fd5b506103b86105193660046137bf565b610fed565b34801561052a57600080fd5b506002546103d4565b34801561053f57600080fd5b506103d460115481565b34801561055557600080fd5b506018546104a390600160a01b900460ff1681565b34801561057657600080fd5b506104a36105853660046137d8565b611055565b34801561059657600080fd5b506103b86105a53660046137a2565b61108d565b3480156105b657600080fd5b506103d47f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b3480156105ea57600080fd5b50604051601281526020016103de565b34801561060657600080fd5b506103d460055481565b34801561061c57600080fd5b50600a546104a390600160a01b900460ff1681565b34801561063d57600080fd5b506103b8611120565b34801561065257600080fd5b506103d4611162565b34801561066757600080fd5b506103d4600f5481565b34801561067d57600080fd5b506103d460125481565b34801561069357600080fd5b506103b86106a23660046137bf565b611172565b3480156106b357600080fd5b50600a546106c7906001600160a01b031681565b6040516103de9190613819565b3480156106e057600080fd5b50600a546104a390600160a81b900460ff1681565b34801561070157600080fd5b506104c16107103660046136cf565b61117f565b34801561072157600080fd5b506103b86107303660046138d0565b6112d9565b34801561074157600080fd5b506018546106c7906001600160a01b031681565b34801561076157600080fd5b506106c761dead81565b34801561077757600080fd5b506103b86107863660046137a2565b6113db565b34801561079757600080fd5b506103d4600c5481565b3480156107ad57600080fd5b506103d460145481565b3480156107c357600080fd5b506103d4600d5481565b3480156107d957600080fd5b506103d46107e83660046137a2565b611442565b3480156107f957600080fd5b506103b861145d565b34801561080e57600080fd5b506103b861081d366004613934565b61148a565b34801561082e57600080fd5b506103b861083d366004613981565b6114bb565b34801561084e57600080fd5b506103b861085d366004613710565b611561565b34801561086e57600080fd5b506103d461087d3660046137a2565b60066020526000908152604090205481565b34801561089b57600080fd5b506103b86108aa3660046137bf565b611576565b3480156108bb57600080fd5b506103d46108ca3660046136cf565b6115ed565b3480156108db57600080fd5b506103b86108ea3660046139b6565b611692565b3480156108fb57600080fd5b506017546106c7906001600160a01b031681565b34801561091b57600080fd5b506103d460155481565b34801561093157600080fd5b506103d46101f481565b34801561094757600080fd5b506103fc61178c565b6103d461095e366004613a23565b61179b565b34801561096f57600080fd5b5061046e61097e3660046137bf565b611b2c565b34801561098f57600080fd5b506103b861099e3660046137a2565b611c7a565b3480156109af57600080fd5b506103b86109be366004613a4a565b611ce4565b3480156109cf57600080fd5b506104a36109de366004613710565b611d43565b3480156109ef57600080fd5b506103d46103e881565b348015610a0557600080fd5b506016546106c7906001600160a01b031681565b348015610a2557600080fd5b50600e546106c790600160201b90046001600160a01b031681565b348015610a4c57600080fd5b5061046e610a5b366004613a23565b611d70565b348015610a6c57600080fd5b50600e54610a7d9063ffffffff1681565b60405163ffffffff90911681526020016103de565b348015610a9e57600080fd5b506103d461271081565b348015610ab457600080fd5b506010546104a39060ff1681565b348015610ace57600080fd5b506103b8611f72565b348015610ae357600080fd5b506103b8610af2366004613a65565b612046565b348015610b0357600080fd5b506103d4610b12366004613adc565b61221d565b348015610b2357600080fd5b506103d460135481565b348015610b3957600080fd5b506103b8612248565b348015610b4e57600080fd5b506103b8610b5d366004613b15565b61227e565b348015610b6e57600080fd5b506103b8610b7d3660046137a2565b61260f565b6000806000610b8f610f5b565b915091506000610bb78686610ba45783610ba6565b845b87610bb15785610dcf565b84610dcf565b50509050601481610bc89190613bc1565b610bd29082613bd5565b9695505050505050565b6060610be6612660565b81804210610c07576040516338e5e54b60e21b815260040160405180910390fd5b600080610c12610f5b565b90925090503433610c238285613bd5565b93506000806000610c36858c898961268a565b9250925092508060146000828254610c4e9190613659565b90915550610c5f9050826001612764565b610c6984846128cc565b610c74308585612999565b610c7c6129f8565b60408051600280825260608201835290916020830190803683370190505098508489600081518110610cb057610cb0613be8565b6020026020010181815250508289600181518110610cd057610cd0613be8565b6020908102919091018101919091526040805160008082529281018890529081018590526060810182905260808101919091526001600160a01b038516906000805160206150448339815191529060a00160405180910390a25050505050505050610d3b6001600755565b92915050565b60098054610d4e90613bfe565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7a90613bfe565b8015610dc75780601f10610d9c57610100808354040283529160200191610dc7565b820191906000526020600020905b815481529060010190602001808311610daa57829003601f168201915b505050505081565b60008060008061271090506000601354601e610deb9190613659565b610df790612710613bd5565b90506000610e05838a613c38565b9050600088118015610e175750600087115b15610ea45782610e2682612b72565b610e309190613bc1565b945082610e3c82612c2a565b610e469190613bc1565b93506000610e548383613c38565b90506000610e628983613c38565b905060008286610e746127108e613c38565b610e7e9190613c38565b610e889190613659565b9050808281610e9957610e99613bab565b049850505050610ebd565b604051633dce448b60e11b815260040160405180910390fd5b50505093509350939050565b606060038054610ed890613bfe565b80601f0160208091040260200160405190810160405280929190818152602001828054610f0490613bfe565b8015610f515780601f10610f2657610100808354040283529160200191610f51565b820191906000526020600020905b815481529060010190602001808311610f3457829003601f168201915b5050505050905090565b60008060004790506000601154601454610f759190613659565b90506000610f81611162565b90506000601254601554610f959190613659565b905082841015610fa6576000610fb0565b610fb08385613bd5565b955080821015610fc1576000610fcb565b610fcb8183613bd5565b9450505050509091565b600033610fe3818585612c4f565b5060019392505050565b6017546001600160a01b0316336001600160a01b03161461102d57335b60405163472511eb60e11b81526004016110249190613819565b60405180910390fd5b6101f481111561105057604051630adad23360e31b815260040160405180910390fd5b601355565b60006110618383612c5c565b1561106e57506001611086565b61107883836128cc565b611083848484612ca5565b90505b9392505050565b6017546001600160a01b0316336001600160a01b0316146110ae573361100a565b6001600160a01b0381166110d55760405163e6c4247b60e01b815260040160405180910390fd5b6018546001600160a01b0316156110fe5760405162dc149f60e41b815260040160405180910390fd5b601880546001600160a01b0319166001600160a01b0392909216919091179055565b6018546001600160a01b0316331461114d573360405163472511eb60e11b81526004016110249190613819565b6018805460ff60a01b1916600160a01b179055565b600061116d30611442565b905090565b61117c3382612cc9565b50565b6060611189612660565b818042106111aa576040516338e5e54b60e21b815260040160405180910390fd5b6000806111b5610f5b565b9150915060006111c23390565b905060008060006111d58b8b878961268a565b92509250925080601560008282546111ed9190613659565b909155506111fe9050826000612764565b61120984308d612cff565b6112138484612d0a565b61121b6129f8565b60408051600280825260608201835290916020830190803683370190505097508a8860008151811061124f5761124f613be8565b602002602001018181525050828860018151811061126f5761126f613be8565b602090810291909101810191909152604080518d815260009281018390529081018290526060810185905260808101919091526001600160a01b038516906000805160206150448339815191529060a00160405180910390a2505050505050506110866001600755565b6017546001600160a01b0316336001600160a01b0316146112fa573361100a565b6113048282612dbc565b60405161131090613636565b604051809103906000f08015801561132c573d6000803e3d6000fd5b50600a80546001600160a01b0319166001600160a01b03929092169182179055604051634cd88b7690611363908590602001613c4f565b60408051601f19818403018152828201825260038352620424c560ec1b602084015290516001600160e01b031960e085901b1681526113a59290600401613c7c565b600060405180830381600087803b1580156113bf57600080fd5b505af11580156113d3573d6000803e3d6000fd5b505050505050565b600e54600160201b90046001600160a01b03161561140b5760405162dc149f60e41b815260040160405180910390fd5b600e8054640100000000600160c01b031916600160201b6001600160a01b038481168202929092179283905561117c920416612ef9565b6001600160a01b031660009081526020819052604090205490565b6017546001600160a01b0316336001600160a01b03161461147e573361100a565b6114886000612ef9565b565b6017546001600160a01b0316336001600160a01b0316146114ab573361100a565b60096114b78282613cf0565b5050565b6017546001600160a01b0316336001600160a01b0316146114dc573361100a565b8015801561151857506001600160a01b038216158061150357506001600160a01b03821630145b8061151857506001600160a01b03821661dead145b156115365760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b61156c823383612f4b565b6114b78282612cc9565b6017546001600160a01b0316336001600160a01b031614611597573361100a565b6127108111156115ba576040516326dd075560e01b815260040160405180910390fd5b60105460ff1680156115ca575080155b156115e8576040516326dd075560e01b815260040160405180910390fd5b600f55565b60135460009061271090829061160490601e613659565b61161090612710613bd5565b905061161c8282613c38565b905060008411801561162e5750600085115b15610ea4576000826127106116438989613c38565b61164d9190613c38565b6116579190613c38565b90506000826116668988613bd5565b6116709190613c38565b905080828161168157611681613bab565b046001019450505050509392505050565b6017546001600160a01b0316336001600160a01b0316146116b3573361100a565b846000036116d457604051635e85ae7360e01b815260040160405180910390fd5b60006116df60025490565b11156116fe57604051630a87463f60e21b815260040160405180910390fd5b6001600160a01b038416611725576040516349e27cff60e01b815260040160405180910390fd5b8115611741576010805460ff1916600117905561174182611576565b600961174d8282613cf0565b5061175783610fed565b61176084612ef9565b601680546001600160a01b0319166001600160a01b0386161790556117858486612fab565b5050505050565b606060048054610ed890613bfe565b60006117a5612660565b818042106117c6576040516338e5e54b60e21b815260040160405180910390fd5b338515806117d2575034155b156117f057604051635e85ae7360e01b815260040160405180910390fd5b6000806117fb610f5b565b909250905061180a3483613bd5565b91506000600a60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611861573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118859190613db0565b9050348960008390036119375760006118a66118a18385613c38565b612fe1565b90506118b46103e882613bd5565b600a546040516340c10f1960e01b8152919a506001600160a01b0316906340c10f19906118eb9061dead906103e890600401613dc9565b600060405180830381600087803b15801561190557600080fd5b505af1158015611919573d6000803e3d6000fd5b5050600a805460ff60a01b1916600160a01b17905550611a33915050565b841580611942575083155b1561196057604051633dce448b60e11b815260040160405180910390fd5b8461196b8584613c38565b6119759190613bc1565b9050600061198386866130c9565b9050818c10156119b057604051633885308960e21b8152600481018d905260248101839052604401611024565b6119e2866119be8686613c38565b6119c89190613bc1565b866119d38786613c38565b6119dd9190613bc1565b6130d5565b985060006119f08488613659565b905060006119fe8488613659565b90506000611a0c8383613c38565b905083811015611a2e5760405162bfbd3d60e31b815260040160405180910390fd5b505050505b87600003611a5457604051633489be7560e21b815260040160405180910390fd5b600a546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990611a86908d908c90600401613dc9565b600060405180830381600087803b158015611aa057600080fd5b505af1158015611ab4573d6000803e3d6000fd5b50505050611ac3863083612cff565b611acb6129f8565b604080518981523460208201529081018290526001600160a01b03808c1691908816907f2f3289d16dbc3007471d28c4936df3a95222bc938112449400d049637e3309ce9060600160405180910390a3505050505050506110866001600755565b60008082600003611b5057604051635e85ae7360e01b815260040160405180910390fd5b600080611b5b610f5b565b915091508160001480611b6c575080155b15611b8a57604051633dce448b60e11b815260040160405180910390fd5b600a54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015611bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf89190613db0565b905080600003611c1b5760405163bb55fd2760e01b815260040160405180910390fd5b80611c268488613c38565b611c309190613bc1565b945080611c3d8388613c38565b611c479190613bc1565b9350841580611c54575083155b15611c725760405163bb55fd2760e01b815260040160405180910390fd5b505050915091565b6017546001600160a01b0316336001600160a01b031614611c9b573361100a565b6001600160a01b038116611cc25760405163e6c4247b60e01b815260040160405180910390fd5b601680546001600160a01b0319166001600160a01b0392909216919091179055565b6017546001600160a01b0316336001600160a01b031614611d05573361100a565b808015611d125750600f54155b15611d30576040516326dd075560e01b815260040160405180910390fd5b6010805460ff1916911515919091179055565b6000611d4f8383612c5c565b15611d5c57506001610d3b565b611d6683836128cc565b61108683836130eb565b600080611d7b612660565b82804210611d9c576040516338e5e54b60e21b815260040160405180910390fd5b600a543390600160a01b900460ff16611dc85760405163aae677e160e01b815260040160405180910390fd5b600a546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611df9908590600401613819565b602060405180830381865afa158015611e16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3a9190613db0565b905080600003611e5d57604051635a5ec44f60e01b815260040160405180910390fd5b80881115611e7e5760405163bb55fd2760e01b815260040160405180910390fd5b611e8788611b2c565b600a5460405163079cc67960e41b81529297509095506001600160a01b0316906379cc679090611ebd9085908c90600401613dc9565b600060405180830381600087803b158015611ed757600080fd5b505af1158015611eeb573d6000803e3d6000fd5b50505050611ef98786612d0a565b611f04308886612999565b60408051898152602081018790529081018590526001600160a01b0380891691908416907feb755d537a0caac69ccb1ac1dc2b7397a32bb19f93bd06013c57ac0b2e5dd69c9060600160405180910390a3611f5d6129f8565b505050611f6a6001600755565b935093915050565b6016546001600160a01b0316336001600160a01b031614611f93573361100a565b6014546015543382158015611fa6575081155b15611fc45760405163211b631760e21b815260040160405180910390fd5b6000601455611fd1611162565b821115611fe357611fe0611162565b91505b6000601555611ff28184612d0a565b611ffd308284612999565b60408051848152602081018490526001600160a01b038316917f2e4fb6077d4acf86e12bb7411fb82b2b3eaa6a49787f4b1e17b423e7ea841169910160405180910390a2505050565b4284101561206a5760405163313c898160e11b815260048101859052602401611024565b6005546001600160a01b038816600090815260066020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190876120bd83613de2565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161213692919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156121a1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615806121d65750886001600160a01b0316816001600160a01b031614155b15612207576040516325c0072360e11b81526001600160a01b0380831660048301528a166024820152604401611024565b612212898989612c4f565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6017546001600160a01b0316336001600160a01b031614612269573361100a565b600a805460ff60a81b1916600160a81b179055565b612286612660565b61228e6130f9565b600a54600160a01b900460ff166122b85760405163aae677e160e01b815260040160405180910390fd5b600a54600160a81b900460ff166122e257604051637e99d8bb60e01b815260040160405180910390fd5b831580156122ee575082155b1561230c57604051635e85ae7360e01b815260040160405180910390fd5b6001600160a01b038516158061232a57506001600160a01b03851630145b1561234857604051634e46966960e11b815260040160405180910390fd5b600080612353610f5b565b915091508186118061236457508085115b156123825760405163bb55fd2760e01b815260040160405180910390fd5b338615612393576123938888612d0a565b85156123ae576123a388876128cc565b6123ae308988612999565b60405163f3438c1760e01b81526001600160a01b0389169063f3438c17906123e29084908b908b908b908b90600401613dfb565b600060405180830381600087803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b5050505060008061241f610f5b565b91509150600085831161243357600061243d565b61243d8684613bd5565b9050600085831161244f576000612459565b6124598684613bd5565b905081158015612467575080155b156124855760405163e2ddc74960e01b815260040160405180910390fd5b6000601354601e6124969190613659565b905060006124a48285613c38565b6124b061271088613c38565b6124ba9190613bd5565b905060006124c88385613c38565b6124d461271088613c38565b6124de9190613bd5565b90506124ed6002612710613f2b565b6124f78a8c613c38565b6125019190613c38565b61250b8284613c38565b10156125295760405162bfbd3d60e31b815260040160405180910390fd5b50505061253582612c2a565b601460008282546125469190613659565b90915550612555905081612c2a565b601560008282546125669190613659565b9091555061257f905061257883612b72565b6001612764565b61259261258b82612b72565b6000612764565b61259a6129f8565b60408051828152602081018490529081018b9052606081018c9052600160808201526001600160a01b038616906000805160206150448339815191529060a00160405180910390a250505050505050612605336000908152600860205260409020805460ff19169055565b6117856001600755565b6017546001600160a01b0316336001600160a01b031614612630573361100a565b6001600160a01b038116612657576040516349e27cff60e01b815260040160405180910390fd5b61117c81612ef9565b60026007540361268357604051633ee5aeb560e01b815260040160405180910390fd5b6002600755565b600080600061269a878686613146565b60006126a686866130c9565b90506126b3888787610dcf565b9195509350915060008490036126dc5760405163271a700960e01b815260040160405180910390fd5b868410156126fd5760405163339454fb60e11b815260040160405180910390fd5b60008361270a848b613bd5565b6127149190613bd5565b61271e9088613659565b9050600061272c8688613bd5565b90508261273983836130c9565b10156127575760405162bfbd3d60e31b815260040160405180910390fd5b5050509450945094915050565b600e54600160201b90046001600160a01b0316156114b7576000600e60049054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f59190613f3a565b90506000600e60049054906101000a90046001600160a01b03166001600160a01b031663ef973d476040518163ffffffff1660e01b8152600401602060405180830381865afa15801561284c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128709190613db0565b90506001600160a01b038216156128c65782156128a45783601160008282546128999190613659565b909155506128bc9050565b83601260008282546128b69190613659565b90915550505b6128c682826131e4565b50505050565b60105460ff166128da575050565b6001600160a01b0382163014806128f857506001600160a01b038216155b8061290d57506001600160a01b03821661dead145b8061293057506001600160a01b0382166000908152600b602052604090205460ff165b15612939575050565b6000612710600f5461294a60025490565b6129549190613c38565b61295e9190613bc1565b9050808261296b85611442565b6129759190613659565b11156129945760405163a9a44dff60e01b815260040160405180910390fd5b505050565b6001600160a01b0383166129c3576000604051634b637e8f60e11b81526004016110249190613819565b6001600160a01b0382166129ed57600060405163ec442f0560e01b81526004016110249190613819565b6129948383836132fe565b600080612a03610f5b565b915091508160001480612a14575080155b15612a3257604051633dce448b60e11b815260040160405180910390fd5b6000612a42600160201b42613f57565b600e54909150600090612a5b9063ffffffff1683613f6b565b905060008163ffffffff16118015612a7257508315155b8015612a7d57508215155b15612b1f57600160701b600084612a948388613c38565b612a9e9190613bc1565b9050600086612aad8488613c38565b612ab79190613bc1565b9050612ac963ffffffff851683613c38565b600c6000828254612ada9190613659565b90915550612af0905063ffffffff851682613c38565b600d6000828254612b019190613659565b9091555050600e805463ffffffff191663ffffffff87161790555050505b600c54600d54600e5460408051938452602084019290925263ffffffff1682820152517f1d0b407d784b19534f95cb221efeda97b16fcb4171eb57280723bad5ccfce40d9181900360600190a150505050565b600e54600090600160201b90046001600160a01b0316612b9457506000919050565b612710600e60049054906101000a90046001600160a01b03166001600160a01b031663978bbdb96040518163ffffffff1660e01b8152600401602060405180830381865afa158015612bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c0e9190613db0565b612c189084613c38565b612c229190613bc1565b90505b919050565b6000601354600003612c3e57506000919050565b61271060135483612c189190613c38565b61299483838360016133a3565b60006001600160a01b03831630148015612c8657503360009081526008602052604090205460ff16155b15610d3b57610fe382612c9a846000610b82565b6107104260b4613659565b600033612cb3858285612f4b565b612cbe858585612999565b506001949350505050565b6001600160a01b038216612cf3576000604051634b637e8f60e11b81526004016110249190613819565b6114b7826000836132fe565b612994838383612999565b80600003612d16575050565b6001600160a01b038216612d3d5760405163e6c4247b60e01b815260040160405180910390fd5b47811115612d485750475b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612d95576040519150601f19603f3d011682016040523d82523d6000602084013e612d9a565b606091505b505090508061299457604051634173d3a560e11b815260040160405180910390fd5b81511580612dc957508051155b15612de7576040516379db2df160e11b815260040160405180910390fd5b60038054612df490613bfe565b1515905080612e10575060048054612e0b90613bfe565b151590505b15612e2e57604051634a8cdeb560e01b815260040160405180910390fd5b6003612e3a8382613cf0565b506004612e478282613cf0565b507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6003604051612e789190613f8f565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206005555050565b601780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000612f57848461221d565b905060001981146128c65781811015612f9c57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401611024565b6128c6848484840360006133a3565b6001600160a01b038216612fd557600060405163ec442f0560e01b81526004016110249190613819565b6114b7600083836132fe565b600081600003612ff357506000919050565b6000600161300084613478565b901c6001901b9050600181848161301957613019613bab565b048201901c9050600181848161303157613031613bab565b048201901c9050600181848161304957613049613bab565b048201901c9050600181848161306157613061613bab565b048201901c9050600181848161307957613079613bab565b048201901c9050600181848161309157613091613bab565b048201901c905060018184816130a9576130a9613bab565b048201901c9050611086818285816130c3576130c3613bab565b046130d5565b60006110868284613c38565b60008183106130e45781611086565b5090919050565b600033610fe3818585612999565b3360009081526008602052604090205460ff161561312a57604051631584469560e11b815260040160405180910390fd5b336000908152600860205260409020805460ff19166001179055565b600a54600160a01b900460ff166131705760405163aae677e160e01b815260040160405180910390fd5b600a54600160a81b900460ff1661319a57604051637e99d8bb60e01b815260040160405180910390fd5b826000036131bb57604051635e85ae7360e01b815260040160405180910390fd5b8115806131c6575080155b1561299457604051633dce448b60e11b815260040160405180910390fd5b601154601254600080831580156131f9575082155b1561320657505050505050565b6000841180156132165750848410155b15613225576000601155600191505b821561328357600080613236610f5b565b90925090506000816132488488613c38565b6132529190613bc1565b905087811061327f57613263611162565b86111561327557613272611162565b95505b6000601255600193505b5050505b8115613293576132938685612d0a565b80156132a4576132a4308785612999565b81806132ad5750805b156113d35760408051858152602081018590526001600160a01b038816917f85da6ab72d2b48932522aea80adb8ca4fab6cdeb87bc2e7f6c03fd78d3b2100e910160405180910390a2505050505050565b601854600160a01b900460ff16613398576018546001600160a01b0384811691161480159061333557506001600160a01b03831615155b801561334f57506018546001600160a01b03838116911614155b801561336657506001600160a01b03821661dead14155b801561337a57506001600160a01b03821615155b156133985760405163188acae760e11b815260040160405180910390fd5b61299483838361350c565b6001600160a01b0384166133cd57600060405163e602df0560e01b81526004016110249190613819565b6001600160a01b0383166133f7576000604051634a1406b160e11b81526004016110249190613819565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156128c657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161346a91815260200190565b60405180910390a350505050565b600080608083901c1561348d57608092831c92015b604083901c1561349f57604092831c92015b602083901c156134b157602092831c92015b601083901c156134c357601092831c92015b600883901c156134d557600892831c92015b600483901c156134e757600492831c92015b600283901c156134f957600292831c92015b600183901c15610d3b5760010192915050565b6001600160a01b03831661353757806002600082825461352c9190613659565b909155506135a99050565b6001600160a01b0383166000908152602081905260409020548181101561358a5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401611024565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166135c5576002805482900390556135e4565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161362991815260200190565b60405180910390a3505050565b61103e8061400683390190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610d3b57610d3b613643565b60005b8381101561368757818101518382015260200161366f565b50506000910152565b600081518084526136a881602086016020860161366c565b601f01601f19169290920160200192915050565b6020815260006110866020830184613690565b6000806000606084860312156136e457600080fd5b505081359360208301359350604090920135919050565b6001600160a01b038116811461117c57600080fd5b6000806040838503121561372357600080fd5b823561372e816136fb565b946020939093013593505050565b6000806040838503121561374f57600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156137965783518352928401929184019160010161377a565b50909695505050505050565b6000602082840312156137b457600080fd5b8135611086816136fb565b6000602082840312156137d157600080fd5b5035919050565b6000806000606084860312156137ed57600080fd5b83356137f8816136fb565b92506020840135613808816136fb565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261385457600080fd5b813567ffffffffffffffff8082111561386f5761386f61382d565b604051601f8301601f19908116603f011681019082821181831017156138975761389761382d565b816040528381528660208588010111156138b057600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080604083850312156138e357600080fd5b823567ffffffffffffffff808211156138fb57600080fd5b61390786838701613843565b9350602085013591508082111561391d57600080fd5b5061392a85828601613843565b9150509250929050565b60006020828403121561394657600080fd5b813567ffffffffffffffff81111561395d57600080fd5b61396984828501613843565b949350505050565b80358015158114612c2557600080fd5b6000806040838503121561399457600080fd5b823561399f816136fb565b91506139ad60208401613971565b90509250929050565b600080600080600060a086880312156139ce57600080fd5b8535945060208601356139e0816136fb565b93506040860135925060608601359150608086013567ffffffffffffffff811115613a0a57600080fd5b613a1688828901613843565b9150509295509295909350565b600080600060608486031215613a3857600080fd5b833592506020840135613808816136fb565b600060208284031215613a5c57600080fd5b61108682613971565b600080600080600080600060e0888a031215613a8057600080fd5b8735613a8b816136fb565b96506020880135613a9b816136fb565b95506040880135945060608801359350608088013560ff81168114613abf57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215613aef57600080fd5b8235613afa816136fb565b91506020830135613b0a816136fb565b809150509250929050565b600080600080600060808688031215613b2d57600080fd5b8535613b38816136fb565b94506020860135935060408601359250606086013567ffffffffffffffff80821115613b6357600080fd5b818801915088601f830112613b7757600080fd5b813581811115613b8657600080fd5b896020828501011115613b9857600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052601260045260246000fd5b600082613bd057613bd0613bab565b500490565b81810381811115610d3b57610d3b613643565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680613c1257607f821691505b602082108103613c3257634e487b7160e01b600052602260045260246000fd5b50919050565b8082028115828204841417610d3b57610d3b613643565b60008251613c6181846020870161366c565b68102628102a37b5b2b760b91b920191825250600901919050565b604081526000613c8f6040830185613690565b8281036020840152613ca18185613690565b95945050505050565b601f82111561299457600081815260208120601f850160051c81016020861015613cd15750805b601f850160051c820191505b818110156113d357828155600101613cdd565b815167ffffffffffffffff811115613d0a57613d0a61382d565b613d1e81613d188454613bfe565b84613caa565b602080601f831160018114613d535760008415613d3b5750858301515b600019600386901b1c1916600185901b1785556113d3565b600085815260208120601f198616915b82811015613d8257888601518255948401946001909101908401613d63565b5085821015613da05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215613dc257600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b600060018201613df457613df4613643565b5060010190565b60018060a01b038616815284602082015283604082015260806060820152816080820152818360a0830137600081830160a090810191909152601f909201601f19160101949350505050565b600181815b80851115613e82578160001904821115613e6857613e68613643565b80851615613e7557918102915b93841c9390800290613e4c565b509250929050565b600082613e9957506001610d3b565b81613ea657506000610d3b565b8160018114613ebc5760028114613ec657613ee2565b6001915050610d3b565b60ff841115613ed757613ed7613643565b50506001821b610d3b565b5060208310610133831016604e8410600b8410161715613f05575081810a610d3b565b613f0f8383613e47565b8060001904821115613f2357613f23613643565b029392505050565b600061108660ff841683613e8a565b600060208284031215613f4c57600080fd5b8151611086816136fb565b600082613f6657613f66613bab565b500690565b63ffffffff828116828216039080821115613f8857613f88613643565b5092915050565b6000808354613f9d81613bfe565b60018281168015613fb55760018114613fca57613ff9565b60ff1984168752821515830287019450613ff9565b8760005260208060002060005b85811015613ff05781548a820152908401908201613fd7565b50505082870194505b5092969550505050505056fe60a060405234801561001057600080fd5b5033608081905261100161003d600039600081816101ed0152818161039f015261040f01526110016000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80634837e204116100a25780637ecebe00116100715780637ecebe001461026b57806395d89b411461028b578063a9059cbb14610293578063d505accf146102a6578063dd62ed3e146102b957600080fd5b80634837e204146101e85780634cd88b761461021c57806370a082311461022f57806379cc67901461025857600080fd5b806330adf81f116100e957806330adf81f14610181578063313ce567146101a85780633644e515146101b757806340c10f19146101c057806342966c68146101d557600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c57806323b872dd1461016e575b600080fd5b6101236102cc565b6040516101309190610aff565b60405180910390f35b61014c610147366004610b69565b61035e565b6040519015158152602001610130565b6002545b604051908152602001610130565b61014c61017c366004610b93565b610378565b6101607f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160128152602001610130565b61016060055481565b6101d36101ce366004610b69565b61039c565b005b6101d36101e3366004610bcf565b6103ff565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516101309190610be8565b6101d361022a366004610c9f565b61040c565b61016061023d366004610d03565b6001600160a01b031660009081526020819052604090205490565b6101d3610266366004610b69565b61044c565b610160610279366004610d03565b60066020526000908152604090205481565b610123610461565b61014c6102a1366004610b69565b610470565b6101d36102b4366004610d25565b61047e565b6101606102c7366004610d98565b610655565b6060600380546102db90610dcb565b80601f016020809104026020016040519081016040528092919081815260200182805461030790610dcb565b80156103545780601f1061032957610100808354040283529160200191610354565b820191906000526020600020905b81548152906001019060200180831161033757829003601f168201915b5050505050905090565b60003361036c818585610680565b60019150505b92915050565b600033610386858285610692565b6103918585856106f8565b506001949350505050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146103f157335b60405163472511eb60e11b81526004016103e89190610be8565b60405180910390fd5b6103fb8282610757565b5050565b610409338261078d565b50565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461044257336103ce565b6103fb82826107c3565b610457823383610692565b6103fb828261078d565b6060600480546102db90610dcb565b60003361036c8185856106f8565b428410156104a25760405163313c898160e11b8152600481018590526024016103e8565b6005546001600160a01b038816600090815260066020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190876104f583610e1b565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161056e92919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156105d9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158061060e5750886001600160a01b0316816001600160a01b031614155b1561063f576040516325c0072360e11b81526001600160a01b0380831660048301528a1660248201526044016103e8565b61064a898989610680565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61068d8383836001610900565b505050565b600061069e8484610655565b905060001981146106f257818110156106e357604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016103e8565b6106f284848484036000610900565b50505050565b6001600160a01b038316610722576000604051634b637e8f60e11b81526004016103e89190610be8565b6001600160a01b03821661074c57600060405163ec442f0560e01b81526004016103e89190610be8565b61068d8383836109d5565b6001600160a01b03821661078157600060405163ec442f0560e01b81526004016103e89190610be8565b6103fb600083836109d5565b6001600160a01b0382166107b7576000604051634b637e8f60e11b81526004016103e89190610be8565b6103fb826000836109d5565b815115806107d057508051155b156107ee576040516379db2df160e11b815260040160405180910390fd5b600380546107fb90610dcb565b151590508061081757506004805461081290610dcb565b151590505b1561083557604051634a8cdeb560e01b815260040160405180910390fd5b60036108418382610e82565b50600461084e8282610e82565b507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600360405161087f9190610f42565b60408051918290038220828201825260018352603160f81b6020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206005555050565b6001600160a01b03841661092a57600060405163e602df0560e01b81526004016103e89190610be8565b6001600160a01b038316610954576000604051634a1406b160e11b81526004016103e89190610be8565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156106f257826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516109c791815260200190565b60405180910390a350505050565b6001600160a01b038316610a005780600260008282546109f59190610fb8565b90915550610a729050565b6001600160a01b03831660009081526020819052604090205481811015610a535760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016103e8565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610a8e57600280548290039055610aad565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610af291815260200190565b60405180910390a3505050565b600060208083528351808285015260005b81811015610b2c57858101830151858201604001528201610b10565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b6457600080fd5b919050565b60008060408385031215610b7c57600080fd5b610b8583610b4d565b946020939093013593505050565b600080600060608486031215610ba857600080fd5b610bb184610b4d565b9250610bbf60208501610b4d565b9150604084013590509250925092565b600060208284031215610be157600080fd5b5035919050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610c2357600080fd5b813567ffffffffffffffff80821115610c3e57610c3e610bfc565b604051601f8301601f19908116603f01168101908282118183101715610c6657610c66610bfc565b81604052838152866020858801011115610c7f57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215610cb257600080fd5b823567ffffffffffffffff80821115610cca57600080fd5b610cd686838701610c12565b93506020850135915080821115610cec57600080fd5b50610cf985828601610c12565b9150509250929050565b600060208284031215610d1557600080fd5b610d1e82610b4d565b9392505050565b600080600080600080600060e0888a031215610d4057600080fd5b610d4988610b4d565b9650610d5760208901610b4d565b95506040880135945060608801359350608088013560ff81168114610d7b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610dab57600080fd5b610db483610b4d565b9150610dc260208401610b4d565b90509250929050565b600181811c90821680610ddf57607f821691505b602082108103610dff57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600060018201610e2d57610e2d610e05565b5060010190565b601f82111561068d57600081815260208120601f850160051c81016020861015610e5b5750805b601f850160051c820191505b81811015610e7a57828155600101610e67565b505050505050565b815167ffffffffffffffff811115610e9c57610e9c610bfc565b610eb081610eaa8454610dcb565b84610e34565b602080601f831160018114610ee55760008415610ecd5750858301515b600019600386901b1c1916600185901b178555610e7a565b600085815260208120601f198616915b82811015610f1457888601518255948401946001909101908401610ef5565b5085821015610f325787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808354610f5081610dcb565b60018281168015610f685760018114610f7d57610fac565b60ff1984168752821515830287019450610fac565b8760005260208060002060005b85811015610fa35781548a820152908401908201610f8a565b50505082870194505b50929695505050505050565b8082018082111561037257610372610e0556fea2646970667358221220ade3b1eb5ec4f757871c03ac2e9df92f938c8ced574713ab8e3bf22bdbff0cf064736f6c63430008140033d44b536c8222cd875ef4b7f421435c474a3e1035e29c64e5f039af6944de4beaa26469706673582212206f5ca01486e6ba1bf006e045a68529672db43abafbc78a2d463fa5524a7ec92864736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.