账户
0x8e...3659
0x8E...3659

0x8E...3659

$500
此合同的源代码已经过验证!
合同元数据
编译器
0.8.25+commit.b61c2a91
语言
Solidity
合同源代码
文件 1 的 1:FunEventTracker.sol
// SPDX-License-Identifier: MIT

// Fun event tracker --> visit https://www.base.fun/ for full experience
// Powered by DX --> https://www.dx.app/

pragma solidity ^0.8.17;

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
    address public owner;

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

    /**
     * @dev The Ownable constructor sets the original `owner` of the contract to the sender
     * account.
     */
    constructor() {
        owner = msg.sender;
    }

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

    /**
     * @dev Allows the current owner to relinquish control of the contract.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipRenounced(owner);
        owner = address(0);
    }

    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param _newOwner The address to transfer ownership to.
     */
    function transferOwnership(address _newOwner) public onlyOwner {
        _transferOwnership(_newOwner);
    }

    /**
     * @dev Transfers control of the contract to a newOwner.
     * @param _newOwner The address to transfer ownership to.
     */
    function _transferOwnership(address _newOwner) internal {
        require(_newOwner != address(0));
        emit OwnershipTransferred(owner, _newOwner);
        owner = _newOwner;
    }
}

interface funRegistryInterface {
    function getFunContractIndex(address _funContract)
        external
        returns (uint256);
}

contract FunEventTracker is Ownable {
    address public funRegistry;
    mapping(address => bool) public funContractValid;
    mapping(address => bool) public funContractDeployer;
    mapping(address => address) public funContractCreatedByDeployer;
    mapping(address => uint256) public funContractIndex;
    uint256 public buyEventCount;
    uint256 public sellEventCount;
    event buyCall(
        address indexed buyer,
        address indexed funContract,
        uint256 buyAmount,
        uint256 tokenReceived,
        uint256 index,
        uint256 timestamp
    );
    event sellCall(
        address indexed seller,
        address indexed funContract,
        uint256 sellAmount,
        uint256 nativeReceived,
        uint256 index,
        uint256 timestamp
    );
    event tradeCall(
        address indexed caller,
        address indexed funContract,
        uint256 outAmount,
        uint256 inAmount,
        uint256 index,
        uint256 timestamp,
        string tradeType
    );
    event funCreated(
        address indexed creator,
        address indexed funContract,
        address indexed tokenAddress,
        string name,
        string symbol,
        string data,
        uint256 totalSupply,
        uint256 initialReserve,
        uint256 timestamp
    );

    event listed(
        address indexed user,
        address indexed tokenAddress,
        address indexed router,
        uint256 liquidityAmount,
        uint256 tokenAmount,
        uint256 time,
        uint256 totalVolume
    );

    constructor(address _funStorage) {
        funRegistry = _funStorage;
    }

    function buyEvent(
        address _buyer,
        address _funContract,
        uint256 _buyAmount,
        uint256 _tokenRecieved
    ) public {
        require(funContractValid[msg.sender], "invalid fun contract");
        uint256 funIndex;
        funIndex = funRegistryInterface(funRegistry).getFunContractIndex(
            _funContract
        );
        emit buyCall(
            _buyer,
            _funContract,
            _buyAmount,
            _tokenRecieved,
            funIndex,
            block.timestamp
        );
        emit tradeCall(
            _buyer,
            _funContract,
            _buyAmount,
            _tokenRecieved,
            funIndex,
            block.timestamp,
            "buy"
        );
        buyEventCount++;
    }

    function sellEvent(
        address _seller,
        address _funContract,
        uint256 _sellAmount,
        uint256 _nativeRecieved
    ) public {
        require(funContractValid[msg.sender], "invalid fun contract");
        uint256 funIndex;
        funIndex = funRegistryInterface(funRegistry).getFunContractIndex(
            _funContract
        );
        emit sellCall(
            _seller,
            _funContract,
            _sellAmount,
            _nativeRecieved,
            funIndex,
            block.timestamp
        );
        emit tradeCall(
            _seller,
            _funContract,
            _sellAmount,
            _nativeRecieved,
            funIndex,
            block.timestamp,
            "sell"
        );
        sellEventCount++;
    }

    function createFunEvent(
        address creator,
        address funContract,
        address tokenAddress,
        string memory name,
        string memory symbol,
        string memory data,
        uint256 totalSupply,
        uint256 initialReserve,
        uint256 timestamp
    ) public {
        require(funContractDeployer[msg.sender], "invalid deployer");
        funContractCreatedByDeployer[funContract] = msg.sender;
        funContractIndex[funContract] = funRegistryInterface(funRegistry)
            .getFunContractIndex(funContract);
        emit funCreated(
            creator,
            funContract,
            tokenAddress,
            name,
            symbol,
            data,
            totalSupply,
            initialReserve,
            timestamp
        );
    }

    function listEvent(
        address user,
        address tokenAddress,
        address router,
        uint256 liquidityAmount,
        uint256 tokenAmount,
        uint256 _time,
        uint256 totalVolume
        ) public {

            require(funContractValid[msg.sender], "invalid fun contract");
            emit listed(user,tokenAddress,router,liquidityAmount,tokenAmount,_time,totalVolume);

        }

    function callerValidate(address _newFunContract) public {
        require(funContractDeployer[msg.sender], "invalid deployer");
        funContractValid[_newFunContract] = true;
    }

    function addDeployer(address _newDeployer) public onlyOwner {
        funContractDeployer[_newDeployer] = true;
    }
}
设置
{
  "compilationTarget": {
    "FunEventTracker.sol": "FunEventTracker"
  },
  "evmVersion": "cancun",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"inputs":[{"internalType":"address","name":"_funStorage","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","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":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"funContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"buyAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"buyCall","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"funContract","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"string","name":"data","type":"string"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"initialReserve","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"funCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"address","name":"router","type":"address"},{"indexed":false,"internalType":"uint256","name":"liquidityAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalVolume","type":"uint256"}],"name":"listed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"address","name":"funContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"sellAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nativeReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"sellCall","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"funContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"outAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"string","name":"tradeType","type":"string"}],"name":"tradeCall","type":"event"},{"inputs":[{"internalType":"address","name":"_newDeployer","type":"address"}],"name":"addDeployer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_buyer","type":"address"},{"internalType":"address","name":"_funContract","type":"address"},{"internalType":"uint256","name":"_buyAmount","type":"uint256"},{"internalType":"uint256","name":"_tokenRecieved","type":"uint256"}],"name":"buyEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyEventCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newFunContract","type":"address"}],"name":"callerValidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"funContract","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"data","type":"string"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"initialReserve","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"createFunEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"funContractCreatedByDeployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"funContractDeployer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"funContractIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"funContractValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"funRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"liquidityAmount","type":"uint256"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"uint256","name":"_time","type":"uint256"},{"internalType":"uint256","name":"totalVolume","type":"uint256"}],"name":"listEvent","outputs":[],"stateMutability":"nonpayable","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":"_seller","type":"address"},{"internalType":"address","name":"_funContract","type":"address"},{"internalType":"uint256","name":"_sellAmount","type":"uint256"},{"internalType":"uint256","name":"_nativeRecieved","type":"uint256"}],"name":"sellEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellEventCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]