Sonic Blaze Testnet

Contract

0xeAb0539E1894bB35785a5Afb2278392667ABB3A9

Overview

S Balance

Sonic Blaze LogoSonic Blaze LogoSonic Blaze Logo3 S

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Create Token And...233684042025-02-27 7:17:072 days ago1740640627IN
0xeAb0539E...667ABB3A9
1 S0.001777061
Create Token And...233682572025-02-27 7:16:132 days ago1740640573IN
0xeAb0539E...667ABB3A9
1 S0.001777061
Create Token And...233680952025-02-27 7:15:152 days ago1740640515IN
0xeAb0539E...667ABB3A9
1 S0.001811261

Latest 21 internal transactions

Parent Transaction Hash Block From To
233684042025-02-27 7:17:072 days ago1740640627
0xeAb0539E...667ABB3A9
0 S
233684042025-02-27 7:17:072 days ago1740640627
0xeAb0539E...667ABB3A9
0 S
233684042025-02-27 7:17:072 days ago1740640627
0xeAb0539E...667ABB3A9
0 S
233684042025-02-27 7:17:072 days ago1740640627
0xeAb0539E...667ABB3A9
0 S
233684042025-02-27 7:17:072 days ago1740640627
0xeAb0539E...667ABB3A9
0 S
233684042025-02-27 7:17:072 days ago1740640627
0xeAb0539E...667ABB3A9
 Contract Creation0 S
233684042025-02-27 7:17:072 days ago1740640627
0xeAb0539E...667ABB3A9
 Contract Creation0 S
233682572025-02-27 7:16:132 days ago1740640573
0xeAb0539E...667ABB3A9
0 S
233682572025-02-27 7:16:132 days ago1740640573
0xeAb0539E...667ABB3A9
0 S
233682572025-02-27 7:16:132 days ago1740640573
0xeAb0539E...667ABB3A9
0 S
233682572025-02-27 7:16:132 days ago1740640573
0xeAb0539E...667ABB3A9
0 S
233682572025-02-27 7:16:132 days ago1740640573
0xeAb0539E...667ABB3A9
0 S
233682572025-02-27 7:16:132 days ago1740640573
0xeAb0539E...667ABB3A9
 Contract Creation0 S
233682572025-02-27 7:16:132 days ago1740640573
0xeAb0539E...667ABB3A9
 Contract Creation0 S
233680952025-02-27 7:15:152 days ago1740640515
0xeAb0539E...667ABB3A9
0 S
233680952025-02-27 7:15:152 days ago1740640515
0xeAb0539E...667ABB3A9
0 S
233680952025-02-27 7:15:152 days ago1740640515
0xeAb0539E...667ABB3A9
0 S
233680952025-02-27 7:15:152 days ago1740640515
0xeAb0539E...667ABB3A9
0 S
233680952025-02-27 7:15:152 days ago1740640515
0xeAb0539E...667ABB3A9
0 S
233680952025-02-27 7:15:152 days ago1740640515
0xeAb0539E...667ABB3A9
 Contract Creation0 S
233680952025-02-27 7:15:152 days ago1740640515
0xeAb0539E...667ABB3A9
 Contract Creation0 S
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Factory

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : Factory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./BondingCurve.sol";
import "./ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title Factory
 * @dev Factory contract for creating Token and Bonding Curve pairs
 */
contract Factory is Ownable {
    // Constants
    uint256 public constant FIXED_INITIAL_SUPPLY = 1_000_000_000 * 10**18; // 1 billion tokens
    uint256 public constant CURVE_ALLOCATION = 800000; // 80% for bonding curve
    uint256 public constant CREATOR_ALLOCATION = 200000; // 20% for creator
    uint256 public constant CREATION_FEE = 1 ether; // Fixed creation fee
    uint256 public constant FUNDING_GOAL = 400000 ether; // 400,000 ETH funding goal

    // Mappings for token tracking
    mapping(address => address) public tokenToCurve;
    mapping(address => address) public curveToToken;
    mapping(address => bool) public isTokenRegistered;
    mapping(address => uint256) public curveFundingRaised; // Track funding for each curve
    mapping(address => bool) public fundingGoalReached; // Track if funding goal reached
    
    // Arrays to store created contracts
    address[] public allTokens;
    address[] public allCurves;
    
    // Events
    event TokenAndCurveCreated(
        address indexed token,
        address indexed bondingCurve,
        string name,
        string symbol,
        uint256 initialSupply,
        uint256 timestamp
    );
    event FundingGoalReached(address indexed curve, uint256 timestamp);
    event FundingRaised(address indexed curve, uint256 amount);

    constructor() Ownable(msg.sender) {}

    /**
     * @dev Create new Token and its Bonding Curve
     * @param name Token name
     * @param symbol Token symbol
     */
    function createTokenAndCurve(
        string memory name,
        string memory symbol
    ) external payable {
        require(msg.value >= CREATION_FEE, "Insufficient creation fee");

        // Calculate allocations
        uint256 bondingCurveAllocation = (FIXED_INITIAL_SUPPLY * CURVE_ALLOCATION) / 1000000;
        uint256 creatorAllocation = (FIXED_INITIAL_SUPPLY * CREATOR_ALLOCATION) / 1000000;

        // Deploy Token
        ContractErc20 newToken = new ContractErc20(
            name, 
            symbol,
            FIXED_INITIAL_SUPPLY
        );
        
        // Deploy Bonding Curve
        BondingCurve newCurve = new BondingCurve (
            address(newToken),
            FUNDING_GOAL
        );

        // Initialize funding tracking
        curveFundingRaised[address(newCurve)] = 0;
        fundingGoalReached[address(newCurve)] = false;

        // Setup initial allocations
        newToken.approve(address(newCurve), bondingCurveAllocation);
        
        // Transfer allocations
        newToken.transfer(address(newCurve), bondingCurveAllocation);
        newToken.transfer(msg.sender, creatorAllocation);

        // Register token-curve pair
        tokenToCurve[address(newToken)] = address(newCurve);
        curveToToken[address(newCurve)] = address(newToken);
        isTokenRegistered[address(newToken)] = true;

        // Add to tracking arrays
        allTokens.push(address(newToken));
        allCurves.push(address(newCurve));

        // Transfer ownership
        newToken.transferOwnership(msg.sender);
        newCurve.transferOwnership(msg.sender);

        emit TokenAndCurveCreated(
            address(newToken),
            address(newCurve),
            name,
            symbol,
            FIXED_INITIAL_SUPPLY,
            block.timestamp
        );

        // Refund excess ETH
        uint256 excess = msg.value - CREATION_FEE;
        if (excess > 0) {
            (bool success, ) = msg.sender.call{value: excess}("");
            require(success, "ETH refund failed");
        }
    }

    /**
     * @dev Update funding raised when tokens are bought
     */
    function updateFundingRaised(uint256 amount) external {
        require(curveToToken[msg.sender] != address(0), "Not a registered curve");
        
        curveFundingRaised[msg.sender] += amount;
        emit FundingRaised(msg.sender, amount);

        // Check if funding goal is reached
        if (curveFundingRaised[msg.sender] >= FUNDING_GOAL && !fundingGoalReached[msg.sender]) {
            fundingGoalReached[msg.sender] = true;
            emit FundingGoalReached(msg.sender, block.timestamp);
        }
    }

    /**
     * @dev Get funding progress for a curve
     */
    function getFundingProgress(address curve) external view returns (uint256) {
        require(curveToToken[curve] != address(0), "Not a registered curve");
        return (curveFundingRaised[curve] * 10000) / FUNDING_GOAL; // Returns percentage with 2 decimals
    }

    /**
     * @dev Get total number of tokens created
     */
    function getTotalTokens() external view returns (uint256) {
        return allTokens.length;
    }

    /**
     * @dev Get latest created token and curve
     */
    function getLatestToken() external view returns (address token, address curve) {
        require(allTokens.length > 0, "No tokens created");
        token = allTokens[allTokens.length - 1];
        curve = allCurves[allCurves.length - 1];
    }

    /**
     * @dev Withdraw collected fees
     */
    function withdrawFees() external onlyOwner {
        uint256 balance = address(this).balance;
        require(balance > 0, "No fees to withdraw");
        
        (bool success, ) = msg.sender.call{value: balance}("");
        require(success, "Fee withdrawal failed");
    }

    receive() external payable {}
}

File 2 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 15 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 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 ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-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 ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 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);
}

File 4 of 15 : IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 5 of 15 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 6 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 7 of 15 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../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 ERC-20
 * applications.
 */
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 private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual 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}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * 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:
     *
     * ```solidity
     * 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);
            }
        }
    }
}

File 8 of 15 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.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 ERC-20 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);
}

File 9 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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);
}

File 10 of 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

File 11 of 15 : Context.sol
// 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;
    }
}

File 12 of 15 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 13 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.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 EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * 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;
    }
}

File 14 of 15 : BondingCurve.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

// Interface for factory
interface IFactory {
    function updateFundingRaised(uint256 amount) external;
}

contract BondingCurve is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    // State variables
    IERC20 public token;
    uint256 public constant PRECISION = 1e18;
    uint256 public constant INITIAL_PRICE = 0.0001 ether;
    uint256 public constant INITIAL_SUPPLY = 1_000_000_000 * 1e18;
    
    // Curve parameters
    uint256 public constant CURVE_EXPONENT = 2; // Quadratic curve: y = ax^2
    uint256 public constant BUY_COEFFICIENT = 1e15;  // Buy curve coefficient
    uint256 public constant SELL_COEFFICIENT = 9e14; // Sell curve coefficient (90% of buy)
    uint256 public constant FEE_PERCENTAGE = 10;     // 10% fee
    
    uint256 public totalSupply;
    uint256 public poolBalance;    // CWEB balance in contract
    
    // Funding tracking
    uint256 public immutable fundingGoal;
    uint256 public fundingRaised;
    bool public fundingGoalReached;

    event Buy(address indexed buyer, uint256 tokenAmount, uint256 ethPaid);
    event Sell(address indexed seller, uint256 tokenAmount, uint256 ethReceived);
    event FundingGoalReached(uint256 timestamp);

    constructor(address _token, uint256 _fundingGoal) Ownable(msg.sender) {
        require(_token != address(0), "Invalid token address");
        require(_fundingGoal > 0, "Invalid funding goal");
        token = IERC20(_token);
        fundingGoal = _fundingGoal;
        totalSupply = 0;
        poolBalance = 0;
        fundingRaised = 0;
        fundingGoalReached = false;
    }

    /**
     * @dev Calculate integral of price curve to get pool balance
     * poolBalance = ∫ ax^2 dx = (a/3)x^3
     */
    function getPoolBalanceAtSupply(uint256 supply, bool isBuy) internal pure returns (uint256) {
        uint256 coefficient = isBuy ? BUY_COEFFICIENT : SELL_COEFFICIENT;
        uint256 cubed = (supply * supply * supply) / (PRECISION * PRECISION);
        return (coefficient * cubed) / (3 * PRECISION);
    }

    /**
     * @dev Calculate current price based on supply
     * price = ax^2 where x is current supply
     */
    function getCurrentPrice(bool isBuy) public view returns (uint256) {
        if (totalSupply == 0) return INITIAL_PRICE;
        
        uint256 coefficient = isBuy ? BUY_COEFFICIENT : SELL_COEFFICIENT;
        uint256 squared = (totalSupply * totalSupply) / PRECISION;
        return (coefficient * squared) / PRECISION;
    }

    /**
     * @dev Calculate tokens to receive for ETH amount
     */
    function calculateTokensForEth(uint256 ethAmount) public view returns (uint256) {
        require(ethAmount > 0, "ETH amount must be positive");

        // For first purchase
        if (totalSupply == 0) {
            return (ethAmount * PRECISION) / INITIAL_PRICE;
        }

        // Calculate using integral of price curve
        uint256 currentPoolBalance = getPoolBalanceAtSupply(totalSupply, true);

        // Binary search to find token amount
        uint256 left = 0;
        uint256 right = INITIAL_SUPPLY - totalSupply;
        uint256 tokensToReceive = 0;

        while (left <= right) {
            uint256 mid = (left + right) / 2;
            uint256 supplyAfterPurchase = totalSupply + mid;
            uint256 poolBalanceRequired = getPoolBalanceAtSupply(supplyAfterPurchase, true);
            uint256 purchaseCost = poolBalanceRequired - currentPoolBalance;

            if (purchaseCost <= ethAmount) {
                tokensToReceive = mid;
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }

        require(tokensToReceive > 0, "Amount too small");
        return tokensToReceive;
    }

    /**
     * @dev Calculate ETH to receive for token amount
     */
    function calculateEthForTokens(uint256 tokenAmount) public view returns (uint256) {
        require(tokenAmount > 0, "Token amount must be positive");
        require(tokenAmount <= totalSupply, "Insufficient supply");

        // Calculate using sell curve
        uint256 currentPoolBalance = getPoolBalanceAtSupply(totalSupply, false);
        uint256 newPoolBalance = getPoolBalanceAtSupply(totalSupply - tokenAmount, false);
        
        uint256 ethToReceive = currentPoolBalance - newPoolBalance;
        
        // Apply fee
        return (ethToReceive * (100 - FEE_PERCENTAGE)) / 100;
    }

    /**
     * @dev Buy tokens with ETH
     */
    function buy(uint256 minTokens) external payable nonReentrant {
        require(!fundingGoalReached, "Funding goal reached");
        require(fundingRaised + msg.value <= fundingGoal, "Would exceed funding goal");
        require(msg.value > 0, "Must send ETH");
        
        uint256 tokensToReceive = calculateTokensForEth(msg.value);
        require(tokensToReceive >= minTokens, "Slippage too high");
        require(tokensToReceive > 0, "No tokens to receive");

        // Check token balance
        uint256 curveBalance = token.balanceOf(address(this));
        require(curveBalance >= tokensToReceive, "Insufficient token balance");

        // Update state
        totalSupply += tokensToReceive;
        poolBalance += msg.value;
        fundingRaised += msg.value;

        // Update factory funding tracking
        IFactory(owner()).updateFundingRaised(msg.value);

        // Check funding goal
        if (fundingRaised >= fundingGoal && !fundingGoalReached) {
            fundingGoalReached = true;
            emit FundingGoalReached(block.timestamp);
        }

        // Transfer tokens
        token.safeTransfer(msg.sender, tokensToReceive);
        
        emit Buy(msg.sender, tokensToReceive, msg.value);
    }

    /**
     * @dev Sell tokens back to curve
     */
    function sell(uint256 tokenAmount, uint256 minEth) external nonReentrant {
        require(tokenAmount > 0, "Amount must be positive");
        
        uint256 ethToReceive = calculateEthForTokens(tokenAmount);
        require(ethToReceive >= minEth, "Below min return");
        require(address(this).balance >= ethToReceive, "Insufficient ETH in contract");

        // Transfer tokens from seller
        token.safeTransferFrom(msg.sender, address(this), tokenAmount);
        
        // Update state - selling affects price but not funding raised
        totalSupply -= tokenAmount;
        poolBalance -= ethToReceive;

        // Transfer ETH to seller
        (bool success,) = msg.sender.call{value: ethToReceive}("");
        require(success, "ETH transfer failed");
        
        emit Sell(msg.sender, tokenAmount, ethToReceive);
    }

    receive() external payable {}
}

File 15 of 15 : ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract ContractErc20 is ERC20, Ownable {
    constructor(
        string memory name,
        string memory symbol,
        uint256 initialSupply
    ) ERC20(name, symbol) Ownable(msg.sender) {
        _mint(msg.sender, initialSupply);
    }

    function mint(address to, uint256 amount) external onlyOwner {
        _mint(to, amount);
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"curve","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FundingGoalReached","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"curve","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundingRaised","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"bondingCurve","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"uint256","name":"initialSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"TokenAndCurveCreated","type":"event"},{"inputs":[],"name":"CREATION_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CREATOR_ALLOCATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CURVE_ALLOCATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FIXED_INITIAL_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNDING_GOAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allCurves","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"name":"createTokenAndCurve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"curveFundingRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"curveToToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"fundingGoalReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"curve","type":"address"}],"name":"getFundingProgress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestToken","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"curve","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isTokenRegistered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenToCurve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updateFundingRaised","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50338061003757604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61004081610046565b50610096565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61329a806100a56000396000f3fe608060405260043610620001475760003560e01c8063634282af11620000b9578063a146c4361162000078578063a146c43614620003c3578063a1eeba1f14620003f4578063cf763a2a1462000419578063f08b82e61462000432578063f2fde38b1462000449578063ff32ceee146200046e57600080fd5b8063634282af14620003165780636f344c50146200033b578063715018a614620003745780638da5cb5b146200038c578063a0c496a414620003ac57600080fd5b806342e49d5a116200010657806342e49d5a1462000274578063476343ee146200029457806349a2104d14620002ae5780634dcb3f0114620002cc5780636089412e14620002f157600080fd5b806306856aea14620001545780630c74fbac146200018957806324682b1114620001dc57806326aa101f14620002165780632bc73063146200025b57600080fd5b366200014f57005b600080fd5b3480156200016157600080fd5b50620001766b033b2e3c9fd0803ce800000081565b6040519081526020015b60405180910390f35b3480156200019657600080fd5b50620001c3620001a836600462000ef0565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200162000180565b348015620001e957600080fd5b50620001c3620001fb36600462000ef0565b6002602052600090815260409020546001600160a01b031681565b3480156200022357600080fd5b506200024a6200023536600462000ef0565b60036020526000908152604090205460ff1681565b604051901515815260200162000180565b3480156200026857600080fd5b506200017662030d4081565b3480156200028157600080fd5b50620001766954b40b1f852bda00000081565b348015620002a157600080fd5b50620002ac620004a2565b005b348015620002bb57600080fd5b5062000176670de0b6b3a764000081565b348015620002d957600080fd5b50620002ac620002eb36600462000f22565b6200058e565b348015620002fe57600080fd5b50620001766200031036600462000ef0565b620006e2565b3480156200032357600080fd5b50620001c36200033536600462000f22565b6200078b565b3480156200034857600080fd5b5062000353620007b6565b604080516001600160a01b0393841681529290911660208301520162000180565b3480156200038157600080fd5b50620002ac62000882565b3480156200039957600080fd5b506000546001600160a01b0316620001c3565b620002ac620003bd36600462000fe7565b6200089a565b348015620003d057600080fd5b5062000176620003e236600462000ef0565b60046020526000908152604090205481565b3480156200040157600080fd5b50620001c36200041336600462000f22565b62000e03565b3480156200042657600080fd5b5062000176620c350081565b3480156200043f57600080fd5b5060065462000176565b3480156200045657600080fd5b50620002ac6200046836600462000ef0565b62000e14565b3480156200047b57600080fd5b506200024a6200048d36600462000ef0565b60056020526000908152604090205460ff1681565b620004ac62000e55565b4780620004f65760405162461bcd60e51b81526020600482015260136024820152724e6f206665657320746f20776974686472617760681b60448201526064015b60405180910390fd5b604051600090339083908381818185875af1925050503d80600081146200053a576040519150601f19603f3d011682016040523d82523d6000602084013e6200053f565b606091505b50509050806200058a5760405162461bcd60e51b8152602060048201526015602482015274119959481dda5d1a191c985dd85b0819985a5b1959605a1b6044820152606401620004ed565b5050565b336000908152600260205260409020546001600160a01b0316620005ee5760405162461bcd60e51b81526020600482015260166024820152754e6f742061207265676973746572656420637572766560501b6044820152606401620004ed565b33600090815260046020526040812080548392906200060f90849062001068565b909155505060405181815233907f6555a9b2343ad10ae756e4d510b6884470ffccc66936f1b681beff110233c6829060200160405180910390a2336000908152600460205260409020546954b40b1f852bda000000118015906200068357503360009081526005602052604090205460ff16155b15620006df573360008181526005602052604090819020805460ff19166001179055517f40de075eddc745330ed0e9b21c9f7739ed2fa998b0b450a53a1fd4e72ed3068790620006d69042815260200190565b60405180910390a25b50565b6001600160a01b03818116600090815260026020526040812054909116620007465760405162461bcd60e51b81526020600482015260166024820152754e6f742061207265676973746572656420637572766560501b6044820152606401620004ed565b6001600160a01b0382166000908152600460205260409020546954b40b1f852bda0000009062000779906127106200107e565b62000785919062001098565b92915050565b600681815481106200079c57600080fd5b6000918252602090912001546001600160a01b0316905081565b6006546000908190620008005760405162461bcd60e51b8152602060048201526011602482015270139bc81d1bdad95b9cc818dc99585d1959607a1b6044820152606401620004ed565b600680546200081290600190620010bb565b81548110620008255762000825620010d1565b600091825260209091200154600780546001600160a01b039092169350906200085190600190620010bb565b81548110620008645762000864620010d1565b60009182526020909120015491926001600160a01b03909216919050565b6200088c62000e55565b62000898600062000e84565b565b670de0b6b3a7640000341015620008f45760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e74206372656174696f6e20666565000000000000006044820152606401620004ed565b6000620f424062000915620c35006b033b2e3c9fd0803ce80000006200107e565b62000921919062001098565b90506000620f42406200094462030d406b033b2e3c9fd0803ce80000006200107e565b62000950919062001098565b9050600084846b033b2e3c9fd0803ce8000000604051620009719062000ed4565b6200097f939291906200112f565b604051809103906000f0801580156200099c573d6000803e3d6000fd5b5090506000816954b40b1f852bda000000604051620009bb9062000ee2565b6001600160a01b0390921682526020820152604001604051809103906000f080158015620009ed573d6000803e3d6000fd5b506001600160a01b038181166000818152600460208181526040808420849055600590915291829020805460ff19169055905163095ea7b360e01b8152908101919091526024810187905291925083169063095ea7b3906044016020604051808303816000875af115801562000a67573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a8d919062001169565b5060405163a9059cbb60e01b81526001600160a01b0382811660048301526024820186905283169063a9059cbb906044016020604051808303816000875af115801562000ade573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b04919062001169565b5060405163a9059cbb60e01b8152336004820152602481018490526001600160a01b0383169063a9059cbb906044016020604051808303816000875af115801562000b53573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b79919062001169565b506001600160a01b03828116600081815260016020818152604080842080549688166001600160a01b031997881681179091558085526002835281852080548816871790558585526003909252808420805460ff191684179055600680548085019091557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180548716861790556007805493840181559093527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688909101805490941617909255905163f2fde38b60e01b815233600482015263f2fde38b90602401600060405180830381600087803b15801562000c7657600080fd5b505af115801562000c8b573d6000803e3d6000fd5b505060405163f2fde38b60e01b81523360048201526001600160a01b038416925063f2fde38b9150602401600060405180830381600087803b15801562000cd157600080fd5b505af115801562000ce6573d6000803e3d6000fd5b50505050806001600160a01b0316826001600160a01b03167f64eebeb3ec44a5a9f0b35d41a354c5cb0d5e7be8b77c04120a51733a78329b4a88886b033b2e3c9fd0803ce80000004260405162000d4194939291906200118d565b60405180910390a3600062000d5f670de0b6b3a764000034620010bb565b9050801562000dfa57604051600090339083908381818185875af1925050503d806000811462000dac576040519150601f19603f3d011682016040523d82523d6000602084013e62000db1565b606091505b505090508062000df85760405162461bcd60e51b8152602060048201526011602482015270115512081c99599d5b990819985a5b1959607a1b6044820152606401620004ed565b505b50505050505050565b600781815481106200079c57600080fd5b62000e1e62000e55565b6001600160a01b03811662000e4a57604051631e4fbdf760e01b815260006004820152602401620004ed565b620006df8162000e84565b6000546001600160a01b03163314620008985760405163118cdaa760e01b8152336004820152602401620004ed565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610dfb80620011cb83390190565b61129f8062001fc683390190565b60006020828403121562000f0357600080fd5b81356001600160a01b038116811462000f1b57600080fd5b9392505050565b60006020828403121562000f3557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011262000f6457600080fd5b813567ffffffffffffffff8082111562000f825762000f8262000f3c565b604051601f8301601f19908116603f0116810190828211818310171562000fad5762000fad62000f3c565b8160405283815286602085880101111562000fc757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121562000ffb57600080fd5b823567ffffffffffffffff808211156200101457600080fd5b620010228683870162000f52565b935060208501359150808211156200103957600080fd5b50620010488582860162000f52565b9150509250929050565b634e487b7160e01b600052601160045260246000fd5b8082018082111562000785576200078562001052565b808202811582820484141762000785576200078562001052565b600082620010b657634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111562000785576200078562001052565b634e487b7160e01b600052603260045260246000fd5b6000815180845260005b818110156200110f57602081850181015186830182015201620010f1565b506000602082860101526020601f19601f83011685010191505092915050565b606081526000620011446060830186620010e7565b8281036020840152620011588186620010e7565b915050826040830152949350505050565b6000602082840312156200117c57600080fd5b8151801515811462000f1b57600080fd5b608081526000620011a26080830187620010e7565b8281036020840152620011b68187620010e7565b60408401959095525050606001529291505056fe60806040523480156200001157600080fd5b5060405162000dfb38038062000dfb833981016040819052620000349162000330565b338383600362000045838262000432565b50600462000054828262000432565b5050506001600160a01b0381166200008757604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200009281620000a8565b506200009f3382620000fa565b50505062000526565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216620001265760405163ec442f0560e01b8152600060048201526024016200007e565b620001346000838362000138565b5050565b6001600160a01b038316620001675780600260008282546200015b9190620004fe565b90915550620001db9050565b6001600160a01b03831660009081526020819052604090205481811015620001bc5760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016200007e565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216620001f95760028054829003905562000218565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200025e91815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200029357600080fd5b81516001600160401b0380821115620002b057620002b06200026b565b604051601f8301601f19908116603f01168101908282118183101715620002db57620002db6200026b565b81604052838152602092508683858801011115620002f857600080fd5b600091505b838210156200031c5785820183015181830184015290820190620002fd565b600093810190920192909252949350505050565b6000806000606084860312156200034657600080fd5b83516001600160401b03808211156200035e57600080fd5b6200036c8783880162000281565b945060208601519150808211156200038357600080fd5b50620003928682870162000281565b925050604084015190509250925092565b600181811c90821680620003b857607f821691505b602082108103620003d957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200042d57600081815260208120601f850160051c81016020861015620004085750805b601f850160051c820191505b81811015620004295782815560010162000414565b5050505b505050565b81516001600160401b038111156200044e576200044e6200026b565b62000466816200045f8454620003a3565b84620003df565b602080601f8311600181146200049e5760008415620004855750858301515b600019600386901b1c1916600185901b17855562000429565b600085815260208120601f198616915b82811015620004cf57888601518255948401946001909101908401620004ae565b5085821015620004ee5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808201808211156200052057634e487b7160e01b600052601160045260246000fd5b92915050565b6108c580620005366000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b41146101aa578063a9059cbb146101b2578063dd62ed3e146101c5578063f2fde38b146101fe57600080fd5b806370a082311461015e578063715018a6146101875780638da5cb5b1461018f57600080fd5b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a57806340c10f1914610149575b600080fd5b6100dc610211565b6040516100e9919061070f565b60405180910390f35b610105610100366004610779565b6102a3565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046107a3565b6102bd565b604051601281526020016100e9565b61015c610157366004610779565b6102e1565b005b61011961016c3660046107df565b6001600160a01b031660009081526020819052604090205490565b61015c6102f7565b6005546040516001600160a01b0390911681526020016100e9565b6100dc61030b565b6101056101c0366004610779565b61031a565b6101196101d3366004610801565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61015c61020c3660046107df565b610328565b60606003805461022090610834565b80601f016020809104026020016040519081016040528092919081815260200182805461024c90610834565b80156102995780601f1061026e57610100808354040283529160200191610299565b820191906000526020600020905b81548152906001019060200180831161027c57829003601f168201915b5050505050905090565b6000336102b181858561036b565b60019150505b92915050565b6000336102cb85828561037d565b6102d68585856103fc565b506001949350505050565b6102e961045b565b6102f38282610488565b5050565b6102ff61045b565b61030960006104be565b565b60606004805461022090610834565b6000336102b18185856103fc565b61033061045b565b6001600160a01b03811661035f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610368816104be565b50565b6103788383836001610510565b505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198110156103f657818110156103e757604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610356565b6103f684848484036000610510565b50505050565b6001600160a01b03831661042657604051634b637e8f60e11b815260006004820152602401610356565b6001600160a01b0382166104505760405163ec442f0560e01b815260006004820152602401610356565b6103788383836105e5565b6005546001600160a01b031633146103095760405163118cdaa760e01b8152336004820152602401610356565b6001600160a01b0382166104b25760405163ec442f0560e01b815260006004820152602401610356565b6102f3600083836105e5565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03841661053a5760405163e602df0560e01b815260006004820152602401610356565b6001600160a01b03831661056457604051634a1406b160e11b815260006004820152602401610356565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156103f657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105d791815260200190565b60405180910390a350505050565b6001600160a01b038316610610578060026000828254610605919061086e565b909155506106829050565b6001600160a01b038316600090815260208190526040902054818110156106635760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610356565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661069e576002805482900390556106bd565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161070291815260200190565b60405180910390a3505050565b600060208083528351808285015260005b8181101561073c57858101830151858201604001528201610720565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461077457600080fd5b919050565b6000806040838503121561078c57600080fd5b6107958361075d565b946020939093013593505050565b6000806000606084860312156107b857600080fd5b6107c18461075d565b92506107cf6020850161075d565b9150604084013590509250925092565b6000602082840312156107f157600080fd5b6107fa8261075d565b9392505050565b6000806040838503121561081457600080fd5b61081d8361075d565b915061082b6020840161075d565b90509250929050565b600181811c9082168061084857607f821691505b60208210810361086857634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156102b757634e487b7160e01b600052601160045260246000fdfea2646970667358221220384b2d0764e6bf8251cff9420fee92c3fce6ff4886b8d84200d48a18c582cf0f64736f6c6343000814003360a060405234801561001057600080fd5b5060405161129f38038061129f83398101604081905261002f9161019c565b338061005657604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61005f8161014c565b50600180556001600160a01b0382166100ba5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420746f6b656e20616464726573730000000000000000000000604482015260640161004d565b6000811161010a5760405162461bcd60e51b815260206004820152601460248201527f496e76616c69642066756e64696e6720676f616c000000000000000000000000604482015260640161004d565b600280546001600160a01b0319166001600160a01b0393909316929092179091556080526000600381905560048190556005556006805460ff191690556101d6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156101af57600080fd5b82516001600160a01b03811681146101c657600080fd5b6020939093015192949293505050565b6080516110a06101ff60003960008181610236015281816108c00152610b8401526110a06000f3fe60806040526004361061012d5760003560e01c80638da5cb5b116100ab578063d79875eb1161006f578063d79875eb14610315578063d96a094a14610335578063e695d36614610348578063eb04c36c14610368578063f2fde38b1461037e578063fc0c546a1461039e57600080fd5b80638da5cb5b1461027257806396365d44146102a4578063aaf5eb68146102ba578063d424f628146102d6578063d701d1c81461030057600080fd5b80632863cf43116100f25780632863cf43146101d25780632ff2e9dc146101ed578063715018a61461020d5780637a3a0e84146102245780637c5e27951461025857600080fd5b80620b46f81461013957806303cf7fad1461016157806306fd9bf61461017c57806318160ddd1461019c57806320b17a0a146101b257600080fd5b3661013457005b600080fd5b34801561014557600080fd5b5061014e600a81565b6040519081526020015b60405180910390f35b34801561016d57600080fd5b5061014e66038d7ea4c6800081565b34801561018857600080fd5b5061014e610197366004610f4f565b6103be565b3480156101a857600080fd5b5061014e60035481565b3480156101be57600080fd5b5061014e6101cd366004610f4f565b61054b565b3480156101de57600080fd5b5061014e6603328b944c400081565b3480156101f957600080fd5b5061014e6b033b2e3c9fd0803ce800000081565b34801561021957600080fd5b50610222610640565b005b34801561023057600080fd5b5061014e7f000000000000000000000000000000000000000000000000000000000000000081565b34801561026457600080fd5b5061014e655af3107a400081565b34801561027e57600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610158565b3480156102b057600080fd5b5061014e60045481565b3480156102c657600080fd5b5061014e670de0b6b3a764000081565b3480156102e257600080fd5b506006546102f09060ff1681565b6040519015158152602001610158565b34801561030c57600080fd5b5061014e600281565b34801561032157600080fd5b50610222610330366004610f68565b610654565b610222610343366004610f4f565b61086c565b34801561035457600080fd5b5061014e610363366004610f8a565b610c63565b34801561037457600080fd5b5061014e60055481565b34801561038a57600080fd5b50610222610399366004610fb3565b610ce7565b3480156103aa57600080fd5b5060025461028c906001600160a01b031681565b60008082116104145760405162461bcd60e51b815260206004820152601b60248201527f45544820616d6f756e74206d75737420626520706f736974697665000000000060448201526064015b60405180910390fd5b60035460000361044757655af3107a4000610437670de0b6b3a764000084610ff2565b6104419190611009565b92915050565b60006104566003546001610d22565b90506000806003546b033b2e3c9fd0803ce8000000610475919061102b565b905060005b8183116104ff576000600261048f848661103e565b6104999190611009565b90506000816003546104ab919061103e565b905060006104ba826001610d22565b905060006104c8888361102b565b90508981116104e8578394508360016104e1919061103e565b96506104f6565b6104f360018561102b565b95505b5050505061047a565b600081116105425760405162461bcd60e51b815260206004820152601060248201526f105b5bdd5b9d081d1bdbc81cdb585b1b60821b604482015260640161040b565b95945050505050565b600080821161059c5760405162461bcd60e51b815260206004820152601d60248201527f546f6b656e20616d6f756e74206d75737420626520706f736974697665000000604482015260640161040b565b6003548211156105e45760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e7420737570706c7960681b604482015260640161040b565b60006105f36003546000610d22565b9050600061060f84600354610608919061102b565b6000610d22565b9050600061061d828461102b565b9050606461062c600a8261102b565b6106369083610ff2565b6105429190611009565b610648610d94565b6106526000610dc1565b565b61065c610e11565b600082116106ac5760405162461bcd60e51b815260206004820152601760248201527f416d6f756e74206d75737420626520706f736974697665000000000000000000604482015260640161040b565b60006106b78361054b565b9050818110156106fc5760405162461bcd60e51b815260206004820152601060248201526f2132b637bb9036b4b7103932ba3ab93760811b604482015260640161040b565b8047101561074c5760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742045544820696e20636f6e747261637400000000604482015260640161040b565b600254610764906001600160a01b0316333086610e3b565b8260036000828254610776919061102b565b92505081905550806004600082825461078f919061102b565b9091555050604051600090339083908381818185875af1925050503d80600081146107d6576040519150601f19603f3d011682016040523d82523d6000602084013e6107db565b606091505b50509050806108225760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b604482015260640161040b565b604080518581526020810184905233917fed7a144fad14804d5c249145e3e0e2b63a9eb455b76aee5bc92d711e9bba3e4a910160405180910390a2505061086860018055565b5050565b610874610e11565b60065460ff16156108be5760405162461bcd60e51b8152602060048201526014602482015273119d5b991a5b99c819dbd85b081c995858da195960621b604482015260640161040b565b7f0000000000000000000000000000000000000000000000000000000000000000346005546108ed919061103e565b111561093b5760405162461bcd60e51b815260206004820152601960248201527f576f756c64206578636565642066756e64696e6720676f616c00000000000000604482015260640161040b565b6000341161097b5760405162461bcd60e51b815260206004820152600d60248201526c09aeae6e840e6cadcc8408aa89609b1b604482015260640161040b565b6000610986346103be565b9050818110156109cc5760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b604482015260640161040b565b60008111610a135760405162461bcd60e51b81526020600482015260146024820152734e6f20746f6b656e7320746f207265636569766560601b604482015260640161040b565b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a809190611051565b905081811015610ad25760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420746f6b656e2062616c616e6365000000000000604482015260640161040b565b8160036000828254610ae4919061103e565b925050819055503460046000828254610afd919061103e565b925050819055503460056000828254610b16919061103e565b90915550506000546001600160a01b0316604051634dcb3f0160e01b81523460048201526001600160a01b039190911690634dcb3f0190602401600060405180830381600087803b158015610b6a57600080fd5b505af1158015610b7e573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000060055410158015610bb7575060065460ff16155b15610c04576006805460ff191660011790556040517fbdf8e8154212732e32053db049accdd4ff27639d7028ecf127e2353161b994bf90610bfb9042815260200190565b60405180910390a15b600254610c1b906001600160a01b03163384610ea8565b6040805183815234602082015233917f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed910160405180910390a25050610c6060018055565b50565b6000600354600003610c7c5750655af3107a4000919050565b600082610c90576603328b944c4000610c99565b66038d7ea4c680005b90506000670de0b6b3a7640000600354600354610cb69190610ff2565b610cc09190611009565b9050670de0b6b3a7640000610cd58284610ff2565b610cdf9190611009565b949350505050565b610cef610d94565b6001600160a01b038116610d1957604051631e4fbdf760e01b81526000600482015260240161040b565b610c6081610dc1565b60008082610d37576603328b944c4000610d40565b66038d7ea4c680005b90506000610d56670de0b6b3a764000080610ff2565b85610d618180610ff2565b610d6b9190610ff2565b610d759190611009565b9050610d8a670de0b6b3a76400006003610ff2565b6106368284610ff2565b6000546001600160a01b031633146106525760405163118cdaa760e01b815233600482015260240161040b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600260015403610e3457604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6040516001600160a01b038481166024830152838116604483015260648201839052610ea29186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610ede565b50505050565b6040516001600160a01b03838116602483015260448201839052610ed991859182169063a9059cbb90606401610e70565b505050565b600080602060008451602086016000885af180610f01576040513d6000823e3d81fd5b50506000513d91508115610f19578060011415610f26565b6001600160a01b0384163b155b15610ea257604051635274afe760e01b81526001600160a01b038516600482015260240161040b565b600060208284031215610f6157600080fd5b5035919050565b60008060408385031215610f7b57600080fd5b50508035926020909101359150565b600060208284031215610f9c57600080fd5b81358015158114610fac57600080fd5b9392505050565b600060208284031215610fc557600080fd5b81356001600160a01b0381168114610fac57600080fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761044157610441610fdc565b60008261102657634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561044157610441610fdc565b8082018082111561044157610441610fdc565b60006020828403121561106357600080fd5b505191905056fea264697066735822122069b35cfd94577544544f9746fa8dc4d745c04bb7fac8ce141d62f75a351b78bd64736f6c63430008140033a2646970667358221220c9df19a8ab7cc6d37fa48d59f3c2eb145189c8d2bb2c1770de5693df96f8518564736f6c63430008140033

Deployed Bytecode

0x608060405260043610620001475760003560e01c8063634282af11620000b9578063a146c4361162000078578063a146c43614620003c3578063a1eeba1f14620003f4578063cf763a2a1462000419578063f08b82e61462000432578063f2fde38b1462000449578063ff32ceee146200046e57600080fd5b8063634282af14620003165780636f344c50146200033b578063715018a614620003745780638da5cb5b146200038c578063a0c496a414620003ac57600080fd5b806342e49d5a116200010657806342e49d5a1462000274578063476343ee146200029457806349a2104d14620002ae5780634dcb3f0114620002cc5780636089412e14620002f157600080fd5b806306856aea14620001545780630c74fbac146200018957806324682b1114620001dc57806326aa101f14620002165780632bc73063146200025b57600080fd5b366200014f57005b600080fd5b3480156200016157600080fd5b50620001766b033b2e3c9fd0803ce800000081565b6040519081526020015b60405180910390f35b3480156200019657600080fd5b50620001c3620001a836600462000ef0565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200162000180565b348015620001e957600080fd5b50620001c3620001fb36600462000ef0565b6002602052600090815260409020546001600160a01b031681565b3480156200022357600080fd5b506200024a6200023536600462000ef0565b60036020526000908152604090205460ff1681565b604051901515815260200162000180565b3480156200026857600080fd5b506200017662030d4081565b3480156200028157600080fd5b50620001766954b40b1f852bda00000081565b348015620002a157600080fd5b50620002ac620004a2565b005b348015620002bb57600080fd5b5062000176670de0b6b3a764000081565b348015620002d957600080fd5b50620002ac620002eb36600462000f22565b6200058e565b348015620002fe57600080fd5b50620001766200031036600462000ef0565b620006e2565b3480156200032357600080fd5b50620001c36200033536600462000f22565b6200078b565b3480156200034857600080fd5b5062000353620007b6565b604080516001600160a01b0393841681529290911660208301520162000180565b3480156200038157600080fd5b50620002ac62000882565b3480156200039957600080fd5b506000546001600160a01b0316620001c3565b620002ac620003bd36600462000fe7565b6200089a565b348015620003d057600080fd5b5062000176620003e236600462000ef0565b60046020526000908152604090205481565b3480156200040157600080fd5b50620001c36200041336600462000f22565b62000e03565b3480156200042657600080fd5b5062000176620c350081565b3480156200043f57600080fd5b5060065462000176565b3480156200045657600080fd5b50620002ac6200046836600462000ef0565b62000e14565b3480156200047b57600080fd5b506200024a6200048d36600462000ef0565b60056020526000908152604090205460ff1681565b620004ac62000e55565b4780620004f65760405162461bcd60e51b81526020600482015260136024820152724e6f206665657320746f20776974686472617760681b60448201526064015b60405180910390fd5b604051600090339083908381818185875af1925050503d80600081146200053a576040519150601f19603f3d011682016040523d82523d6000602084013e6200053f565b606091505b50509050806200058a5760405162461bcd60e51b8152602060048201526015602482015274119959481dda5d1a191c985dd85b0819985a5b1959605a1b6044820152606401620004ed565b5050565b336000908152600260205260409020546001600160a01b0316620005ee5760405162461bcd60e51b81526020600482015260166024820152754e6f742061207265676973746572656420637572766560501b6044820152606401620004ed565b33600090815260046020526040812080548392906200060f90849062001068565b909155505060405181815233907f6555a9b2343ad10ae756e4d510b6884470ffccc66936f1b681beff110233c6829060200160405180910390a2336000908152600460205260409020546954b40b1f852bda000000118015906200068357503360009081526005602052604090205460ff16155b15620006df573360008181526005602052604090819020805460ff19166001179055517f40de075eddc745330ed0e9b21c9f7739ed2fa998b0b450a53a1fd4e72ed3068790620006d69042815260200190565b60405180910390a25b50565b6001600160a01b03818116600090815260026020526040812054909116620007465760405162461bcd60e51b81526020600482015260166024820152754e6f742061207265676973746572656420637572766560501b6044820152606401620004ed565b6001600160a01b0382166000908152600460205260409020546954b40b1f852bda0000009062000779906127106200107e565b62000785919062001098565b92915050565b600681815481106200079c57600080fd5b6000918252602090912001546001600160a01b0316905081565b6006546000908190620008005760405162461bcd60e51b8152602060048201526011602482015270139bc81d1bdad95b9cc818dc99585d1959607a1b6044820152606401620004ed565b600680546200081290600190620010bb565b81548110620008255762000825620010d1565b600091825260209091200154600780546001600160a01b039092169350906200085190600190620010bb565b81548110620008645762000864620010d1565b60009182526020909120015491926001600160a01b03909216919050565b6200088c62000e55565b62000898600062000e84565b565b670de0b6b3a7640000341015620008f45760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e74206372656174696f6e20666565000000000000006044820152606401620004ed565b6000620f424062000915620c35006b033b2e3c9fd0803ce80000006200107e565b62000921919062001098565b90506000620f42406200094462030d406b033b2e3c9fd0803ce80000006200107e565b62000950919062001098565b9050600084846b033b2e3c9fd0803ce8000000604051620009719062000ed4565b6200097f939291906200112f565b604051809103906000f0801580156200099c573d6000803e3d6000fd5b5090506000816954b40b1f852bda000000604051620009bb9062000ee2565b6001600160a01b0390921682526020820152604001604051809103906000f080158015620009ed573d6000803e3d6000fd5b506001600160a01b038181166000818152600460208181526040808420849055600590915291829020805460ff19169055905163095ea7b360e01b8152908101919091526024810187905291925083169063095ea7b3906044016020604051808303816000875af115801562000a67573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a8d919062001169565b5060405163a9059cbb60e01b81526001600160a01b0382811660048301526024820186905283169063a9059cbb906044016020604051808303816000875af115801562000ade573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b04919062001169565b5060405163a9059cbb60e01b8152336004820152602481018490526001600160a01b0383169063a9059cbb906044016020604051808303816000875af115801562000b53573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b79919062001169565b506001600160a01b03828116600081815260016020818152604080842080549688166001600160a01b031997881681179091558085526002835281852080548816871790558585526003909252808420805460ff191684179055600680548085019091557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180548716861790556007805493840181559093527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688909101805490941617909255905163f2fde38b60e01b815233600482015263f2fde38b90602401600060405180830381600087803b15801562000c7657600080fd5b505af115801562000c8b573d6000803e3d6000fd5b505060405163f2fde38b60e01b81523360048201526001600160a01b038416925063f2fde38b9150602401600060405180830381600087803b15801562000cd157600080fd5b505af115801562000ce6573d6000803e3d6000fd5b50505050806001600160a01b0316826001600160a01b03167f64eebeb3ec44a5a9f0b35d41a354c5cb0d5e7be8b77c04120a51733a78329b4a88886b033b2e3c9fd0803ce80000004260405162000d4194939291906200118d565b60405180910390a3600062000d5f670de0b6b3a764000034620010bb565b9050801562000dfa57604051600090339083908381818185875af1925050503d806000811462000dac576040519150601f19603f3d011682016040523d82523d6000602084013e62000db1565b606091505b505090508062000df85760405162461bcd60e51b8152602060048201526011602482015270115512081c99599d5b990819985a5b1959607a1b6044820152606401620004ed565b505b50505050505050565b600781815481106200079c57600080fd5b62000e1e62000e55565b6001600160a01b03811662000e4a57604051631e4fbdf760e01b815260006004820152602401620004ed565b620006df8162000e84565b6000546001600160a01b03163314620008985760405163118cdaa760e01b8152336004820152602401620004ed565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610dfb80620011cb83390190565b61129f8062001fc683390190565b60006020828403121562000f0357600080fd5b81356001600160a01b038116811462000f1b57600080fd5b9392505050565b60006020828403121562000f3557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011262000f6457600080fd5b813567ffffffffffffffff8082111562000f825762000f8262000f3c565b604051601f8301601f19908116603f0116810190828211818310171562000fad5762000fad62000f3c565b8160405283815286602085880101111562000fc757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121562000ffb57600080fd5b823567ffffffffffffffff808211156200101457600080fd5b620010228683870162000f52565b935060208501359150808211156200103957600080fd5b50620010488582860162000f52565b9150509250929050565b634e487b7160e01b600052601160045260246000fd5b8082018082111562000785576200078562001052565b808202811582820484141762000785576200078562001052565b600082620010b657634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111562000785576200078562001052565b634e487b7160e01b600052603260045260246000fd5b6000815180845260005b818110156200110f57602081850181015186830182015201620010f1565b506000602082860101526020601f19601f83011685010191505092915050565b606081526000620011446060830186620010e7565b8281036020840152620011588186620010e7565b915050826040830152949350505050565b6000602082840312156200117c57600080fd5b8151801515811462000f1b57600080fd5b608081526000620011a26080830187620010e7565b8281036020840152620011b68187620010e7565b60408401959095525050606001529291505056fe60806040523480156200001157600080fd5b5060405162000dfb38038062000dfb833981016040819052620000349162000330565b338383600362000045838262000432565b50600462000054828262000432565b5050506001600160a01b0381166200008757604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200009281620000a8565b506200009f3382620000fa565b50505062000526565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216620001265760405163ec442f0560e01b8152600060048201526024016200007e565b620001346000838362000138565b5050565b6001600160a01b038316620001675780600260008282546200015b9190620004fe565b90915550620001db9050565b6001600160a01b03831660009081526020819052604090205481811015620001bc5760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016200007e565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216620001f95760028054829003905562000218565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200025e91815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200029357600080fd5b81516001600160401b0380821115620002b057620002b06200026b565b604051601f8301601f19908116603f01168101908282118183101715620002db57620002db6200026b565b81604052838152602092508683858801011115620002f857600080fd5b600091505b838210156200031c5785820183015181830184015290820190620002fd565b600093810190920192909252949350505050565b6000806000606084860312156200034657600080fd5b83516001600160401b03808211156200035e57600080fd5b6200036c8783880162000281565b945060208601519150808211156200038357600080fd5b50620003928682870162000281565b925050604084015190509250925092565b600181811c90821680620003b857607f821691505b602082108103620003d957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200042d57600081815260208120601f850160051c81016020861015620004085750805b601f850160051c820191505b81811015620004295782815560010162000414565b5050505b505050565b81516001600160401b038111156200044e576200044e6200026b565b62000466816200045f8454620003a3565b84620003df565b602080601f8311600181146200049e5760008415620004855750858301515b600019600386901b1c1916600185901b17855562000429565b600085815260208120601f198616915b82811015620004cf57888601518255948401946001909101908401620004ae565b5085821015620004ee5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808201808211156200052057634e487b7160e01b600052601160045260246000fd5b92915050565b6108c580620005366000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b41146101aa578063a9059cbb146101b2578063dd62ed3e146101c5578063f2fde38b146101fe57600080fd5b806370a082311461015e578063715018a6146101875780638da5cb5b1461018f57600080fd5b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a57806340c10f1914610149575b600080fd5b6100dc610211565b6040516100e9919061070f565b60405180910390f35b610105610100366004610779565b6102a3565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046107a3565b6102bd565b604051601281526020016100e9565b61015c610157366004610779565b6102e1565b005b61011961016c3660046107df565b6001600160a01b031660009081526020819052604090205490565b61015c6102f7565b6005546040516001600160a01b0390911681526020016100e9565b6100dc61030b565b6101056101c0366004610779565b61031a565b6101196101d3366004610801565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61015c61020c3660046107df565b610328565b60606003805461022090610834565b80601f016020809104026020016040519081016040528092919081815260200182805461024c90610834565b80156102995780601f1061026e57610100808354040283529160200191610299565b820191906000526020600020905b81548152906001019060200180831161027c57829003601f168201915b5050505050905090565b6000336102b181858561036b565b60019150505b92915050565b6000336102cb85828561037d565b6102d68585856103fc565b506001949350505050565b6102e961045b565b6102f38282610488565b5050565b6102ff61045b565b61030960006104be565b565b60606004805461022090610834565b6000336102b18185856103fc565b61033061045b565b6001600160a01b03811661035f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610368816104be565b50565b6103788383836001610510565b505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198110156103f657818110156103e757604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610356565b6103f684848484036000610510565b50505050565b6001600160a01b03831661042657604051634b637e8f60e11b815260006004820152602401610356565b6001600160a01b0382166104505760405163ec442f0560e01b815260006004820152602401610356565b6103788383836105e5565b6005546001600160a01b031633146103095760405163118cdaa760e01b8152336004820152602401610356565b6001600160a01b0382166104b25760405163ec442f0560e01b815260006004820152602401610356565b6102f3600083836105e5565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03841661053a5760405163e602df0560e01b815260006004820152602401610356565b6001600160a01b03831661056457604051634a1406b160e11b815260006004820152602401610356565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156103f657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105d791815260200190565b60405180910390a350505050565b6001600160a01b038316610610578060026000828254610605919061086e565b909155506106829050565b6001600160a01b038316600090815260208190526040902054818110156106635760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610356565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661069e576002805482900390556106bd565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161070291815260200190565b60405180910390a3505050565b600060208083528351808285015260005b8181101561073c57858101830151858201604001528201610720565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461077457600080fd5b919050565b6000806040838503121561078c57600080fd5b6107958361075d565b946020939093013593505050565b6000806000606084860312156107b857600080fd5b6107c18461075d565b92506107cf6020850161075d565b9150604084013590509250925092565b6000602082840312156107f157600080fd5b6107fa8261075d565b9392505050565b6000806040838503121561081457600080fd5b61081d8361075d565b915061082b6020840161075d565b90509250929050565b600181811c9082168061084857607f821691505b60208210810361086857634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156102b757634e487b7160e01b600052601160045260246000fdfea2646970667358221220384b2d0764e6bf8251cff9420fee92c3fce6ff4886b8d84200d48a18c582cf0f64736f6c6343000814003360a060405234801561001057600080fd5b5060405161129f38038061129f83398101604081905261002f9161019c565b338061005657604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61005f8161014c565b50600180556001600160a01b0382166100ba5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420746f6b656e20616464726573730000000000000000000000604482015260640161004d565b6000811161010a5760405162461bcd60e51b815260206004820152601460248201527f496e76616c69642066756e64696e6720676f616c000000000000000000000000604482015260640161004d565b600280546001600160a01b0319166001600160a01b0393909316929092179091556080526000600381905560048190556005556006805460ff191690556101d6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156101af57600080fd5b82516001600160a01b03811681146101c657600080fd5b6020939093015192949293505050565b6080516110a06101ff60003960008181610236015281816108c00152610b8401526110a06000f3fe60806040526004361061012d5760003560e01c80638da5cb5b116100ab578063d79875eb1161006f578063d79875eb14610315578063d96a094a14610335578063e695d36614610348578063eb04c36c14610368578063f2fde38b1461037e578063fc0c546a1461039e57600080fd5b80638da5cb5b1461027257806396365d44146102a4578063aaf5eb68146102ba578063d424f628146102d6578063d701d1c81461030057600080fd5b80632863cf43116100f25780632863cf43146101d25780632ff2e9dc146101ed578063715018a61461020d5780637a3a0e84146102245780637c5e27951461025857600080fd5b80620b46f81461013957806303cf7fad1461016157806306fd9bf61461017c57806318160ddd1461019c57806320b17a0a146101b257600080fd5b3661013457005b600080fd5b34801561014557600080fd5b5061014e600a81565b6040519081526020015b60405180910390f35b34801561016d57600080fd5b5061014e66038d7ea4c6800081565b34801561018857600080fd5b5061014e610197366004610f4f565b6103be565b3480156101a857600080fd5b5061014e60035481565b3480156101be57600080fd5b5061014e6101cd366004610f4f565b61054b565b3480156101de57600080fd5b5061014e6603328b944c400081565b3480156101f957600080fd5b5061014e6b033b2e3c9fd0803ce800000081565b34801561021957600080fd5b50610222610640565b005b34801561023057600080fd5b5061014e7f000000000000000000000000000000000000000000000000000000000000000081565b34801561026457600080fd5b5061014e655af3107a400081565b34801561027e57600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610158565b3480156102b057600080fd5b5061014e60045481565b3480156102c657600080fd5b5061014e670de0b6b3a764000081565b3480156102e257600080fd5b506006546102f09060ff1681565b6040519015158152602001610158565b34801561030c57600080fd5b5061014e600281565b34801561032157600080fd5b50610222610330366004610f68565b610654565b610222610343366004610f4f565b61086c565b34801561035457600080fd5b5061014e610363366004610f8a565b610c63565b34801561037457600080fd5b5061014e60055481565b34801561038a57600080fd5b50610222610399366004610fb3565b610ce7565b3480156103aa57600080fd5b5060025461028c906001600160a01b031681565b60008082116104145760405162461bcd60e51b815260206004820152601b60248201527f45544820616d6f756e74206d75737420626520706f736974697665000000000060448201526064015b60405180910390fd5b60035460000361044757655af3107a4000610437670de0b6b3a764000084610ff2565b6104419190611009565b92915050565b60006104566003546001610d22565b90506000806003546b033b2e3c9fd0803ce8000000610475919061102b565b905060005b8183116104ff576000600261048f848661103e565b6104999190611009565b90506000816003546104ab919061103e565b905060006104ba826001610d22565b905060006104c8888361102b565b90508981116104e8578394508360016104e1919061103e565b96506104f6565b6104f360018561102b565b95505b5050505061047a565b600081116105425760405162461bcd60e51b815260206004820152601060248201526f105b5bdd5b9d081d1bdbc81cdb585b1b60821b604482015260640161040b565b95945050505050565b600080821161059c5760405162461bcd60e51b815260206004820152601d60248201527f546f6b656e20616d6f756e74206d75737420626520706f736974697665000000604482015260640161040b565b6003548211156105e45760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e7420737570706c7960681b604482015260640161040b565b60006105f36003546000610d22565b9050600061060f84600354610608919061102b565b6000610d22565b9050600061061d828461102b565b9050606461062c600a8261102b565b6106369083610ff2565b6105429190611009565b610648610d94565b6106526000610dc1565b565b61065c610e11565b600082116106ac5760405162461bcd60e51b815260206004820152601760248201527f416d6f756e74206d75737420626520706f736974697665000000000000000000604482015260640161040b565b60006106b78361054b565b9050818110156106fc5760405162461bcd60e51b815260206004820152601060248201526f2132b637bb9036b4b7103932ba3ab93760811b604482015260640161040b565b8047101561074c5760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742045544820696e20636f6e747261637400000000604482015260640161040b565b600254610764906001600160a01b0316333086610e3b565b8260036000828254610776919061102b565b92505081905550806004600082825461078f919061102b565b9091555050604051600090339083908381818185875af1925050503d80600081146107d6576040519150601f19603f3d011682016040523d82523d6000602084013e6107db565b606091505b50509050806108225760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b604482015260640161040b565b604080518581526020810184905233917fed7a144fad14804d5c249145e3e0e2b63a9eb455b76aee5bc92d711e9bba3e4a910160405180910390a2505061086860018055565b5050565b610874610e11565b60065460ff16156108be5760405162461bcd60e51b8152602060048201526014602482015273119d5b991a5b99c819dbd85b081c995858da195960621b604482015260640161040b565b7f0000000000000000000000000000000000000000000000000000000000000000346005546108ed919061103e565b111561093b5760405162461bcd60e51b815260206004820152601960248201527f576f756c64206578636565642066756e64696e6720676f616c00000000000000604482015260640161040b565b6000341161097b5760405162461bcd60e51b815260206004820152600d60248201526c09aeae6e840e6cadcc8408aa89609b1b604482015260640161040b565b6000610986346103be565b9050818110156109cc5760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b604482015260640161040b565b60008111610a135760405162461bcd60e51b81526020600482015260146024820152734e6f20746f6b656e7320746f207265636569766560601b604482015260640161040b565b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a809190611051565b905081811015610ad25760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420746f6b656e2062616c616e6365000000000000604482015260640161040b565b8160036000828254610ae4919061103e565b925050819055503460046000828254610afd919061103e565b925050819055503460056000828254610b16919061103e565b90915550506000546001600160a01b0316604051634dcb3f0160e01b81523460048201526001600160a01b039190911690634dcb3f0190602401600060405180830381600087803b158015610b6a57600080fd5b505af1158015610b7e573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000060055410158015610bb7575060065460ff16155b15610c04576006805460ff191660011790556040517fbdf8e8154212732e32053db049accdd4ff27639d7028ecf127e2353161b994bf90610bfb9042815260200190565b60405180910390a15b600254610c1b906001600160a01b03163384610ea8565b6040805183815234602082015233917f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed910160405180910390a25050610c6060018055565b50565b6000600354600003610c7c5750655af3107a4000919050565b600082610c90576603328b944c4000610c99565b66038d7ea4c680005b90506000670de0b6b3a7640000600354600354610cb69190610ff2565b610cc09190611009565b9050670de0b6b3a7640000610cd58284610ff2565b610cdf9190611009565b949350505050565b610cef610d94565b6001600160a01b038116610d1957604051631e4fbdf760e01b81526000600482015260240161040b565b610c6081610dc1565b60008082610d37576603328b944c4000610d40565b66038d7ea4c680005b90506000610d56670de0b6b3a764000080610ff2565b85610d618180610ff2565b610d6b9190610ff2565b610d759190611009565b9050610d8a670de0b6b3a76400006003610ff2565b6106368284610ff2565b6000546001600160a01b031633146106525760405163118cdaa760e01b815233600482015260240161040b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600260015403610e3457604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6040516001600160a01b038481166024830152838116604483015260648201839052610ea29186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610ede565b50505050565b6040516001600160a01b03838116602483015260448201839052610ed991859182169063a9059cbb90606401610e70565b505050565b600080602060008451602086016000885af180610f01576040513d6000823e3d81fd5b50506000513d91508115610f19578060011415610f26565b6001600160a01b0384163b155b15610ea257604051635274afe760e01b81526001600160a01b038516600482015260240161040b565b600060208284031215610f6157600080fd5b5035919050565b60008060408385031215610f7b57600080fd5b50508035926020909101359150565b600060208284031215610f9c57600080fd5b81358015158114610fac57600080fd5b9392505050565b600060208284031215610fc557600080fd5b81356001600160a01b0381168114610fac57600080fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761044157610441610fdc565b60008261102657634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561044157610441610fdc565b8082018082111561044157610441610fdc565b60006020828403121561106357600080fd5b505191905056fea264697066735822122069b35cfd94577544544f9746fa8dc4d745c04bb7fac8ce141d62f75a351b78bd64736f6c63430008140033a2646970667358221220c9df19a8ab7cc6d37fa48d59f3c2eb145189c8d2bb2c1770de5693df96f8518564736f6c63430008140033

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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.