Sonic Blaze Testnet

Contract

0xf44f2527d964EF4a8a38c0E676c05a1dc8574fFa
Transaction Hash
Method
Block
From
To
Swap251040812025-03-07 16:10:215 days ago1741363821IN
0xf44f2527...dc8574fFa
0 S0.000074521.1
Add Liquidity249500682025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.00008231
Add Liquidity249500682025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.000082351
Add Liquidity249500682025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.000082351
Add Liquidity249500682025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.000082331
Add Liquidity249500682025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.000082351
Add Liquidity249500682025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.000082331
Add Liquidity249500682025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.000081671
Add Liquidity249500682025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.000082331
Add Liquidity249500662025-03-06 18:38:336 days ago1741286313IN
0xf44f2527...dc8574fFa
0 S0.00008231

Latest 11 internal transactions

Parent Transaction Hash Block From To
251040812025-03-07 16:10:215 days ago1741363821
0xf44f2527...dc8574fFa
0 S
251040812025-03-07 16:10:215 days ago1741363821
0xf44f2527...dc8574fFa
0 S
249500682025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
249500682025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
249500682025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
249500682025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
249500682025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
249500682025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
249500682025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
249500682025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
249500662025-03-06 18:38:336 days ago1741286313
0xf44f2527...dc8574fFa
0 S
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x5844Cf8B...31330cA3D
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Core

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

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

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract Core {
    event Swap(
        address indexed sender,
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 amountOut
    );
    event LiquidityAdded(
        address indexed provider,
        address token,
        uint256 amount
    );
    event LiquidityRemoved(
        address indexed provider,
        address token,
        uint256 amount
    );

    mapping(address => uint256) public liquidity;

    function addLiquidity(address token, uint256 amount) external {
        require(amount > 0, "Amount must be greater than zero");
        require(
            IERC20(token).transferFrom(msg.sender, address(this), amount),
            "Transfer failed"
        );
        liquidity[token] += amount;
        emit LiquidityAdded(msg.sender, token, amount);
    }

    function removeLiquidity(address token, uint256 amount) external {
        require(liquidity[token] >= amount, "Insufficient liquidity");
        liquidity[token] -= amount;
        require(IERC20(token).transfer(msg.sender, amount), "Transfer failed");
        emit LiquidityRemoved(msg.sender, token, amount);
    }

    function getLiquidity(address token) external view returns (uint256) {
        return liquidity[token];
    }

    function swap(
        address tokenIn,
        address tokenOut,
        uint256 amountIn
    ) external returns (uint256 amountOut) {
        require(
            tokenIn != address(0) && tokenOut != address(0),
            "Invalid token address"
        );
        require(amountIn > 0, "Amount must be greater than zero");
        require(
            liquidity[tokenIn] > 0 && liquidity[tokenOut] > 0,
            "Insufficient liquidity"
        );

        uint256 reserveIn = liquidity[tokenIn];
        uint256 reserveOut = liquidity[tokenOut];
        require(reserveIn > 0 && reserveOut > 0, "Invalid reserves");

        // Swap formula: x * y = k
        uint256 amountInWithFee = (amountIn * 997) / 1000; // 0.3% fee
        amountOut =
            (amountInWithFee * reserveOut) /
            (reserveIn + amountInWithFee);
        require(amountOut > 0, "Swap amount must be greater than zero");

        // Update liquidity
        liquidity[tokenIn] += amountIn;
        liquidity[tokenOut] -= amountOut;

        require(
            IERC20(tokenIn).transferFrom(msg.sender, address(this), amountIn),
            "Token transfer failed"
        );
        require(
            IERC20(tokenOut).transfer(msg.sender, amountOut),
            "Token transfer failed"
        );

        emit Swap(msg.sender, tokenIn, tokenOut, amountIn, amountOut);
    }
}

File 2 of 2 : 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);
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": true,
  "libraries": {}
}

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LiquidityRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"liquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"removeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x60806040526004361015610011575f80fd5b5f3560e01c806356688700146104c0578063a201ccf6146103be578063a747b93b14610387578063b8c876b1146103875763df791e5014610050575f80fd5b34610383576060366003190112610383576100696105b2565b6024356001600160a01b038116919082900361038357604435906001600160a01b03168015158061037a575b1561033d5781156100a681156105c8565b815f525f60205260405f2054151580610327575b6100c3906106ac565b5f8281526020819052604080822054868352912054918115158061031e575b156102e6576103e58502908582046103e51417156102d2576103e890048281029281840414811517156102d2576101189161069f565b9081156102be570491821561026b57815f525f60205260405f2061013d82825461069f565b9055835f525f60205260405f206101558482546106f1565b90556040516323b872dd60e01b8152336004820152306024820152604481018290526020816064815f875af1801561024757610198915f91610252575b506106fe565b60405163a9059cbb60e01b815233600482015260248101849052936020856044815f855af1948515610247576020956101d7915f9161021a57506106fe565b6040519283528483015260408201528160608201527fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e4606260803392a2604051908152f35b61023a9150873d8911610240575b6102328183610613565b810190610649565b5f610192565b503d610228565b6040513d5f823e3d90fd5b61023a915060203d602011610240576102328183610613565b60405162461bcd60e51b815260206004820152602560248201527f5377617020616d6f756e74206d7573742062652067726561746572207468616e604482015264207a65726f60d81b6064820152608490fd5b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b60405162461bcd60e51b815260206004820152601060248201526f496e76616c696420726573657276657360801b6044820152606490fd5b508215156100e2565b505f8481526020819052604090205415156100ba565b60405162461bcd60e51b8152602060048201526015602482015274496e76616c696420746f6b656e206164647265737360581b6044820152606490fd5b50821515610095565b5f80fd5b34610383576020366003190112610383576001600160a01b036103a86105b2565b165f525f602052602060405f2054604051908152f35b34610383576040366003190112610383576103d76105b2565b60243560018060a01b03821690815f525f6020526103fb8160405f205410156106ac565b815f525f60205260405f206104118282546106f1565b905560405163a9059cbb60e01b81523360048201526024810182905291602090839060449082905f905af19081156102475761047961049c927f983e86fda8e7b1e2eae380201830eaf1cac55772e8e39583da349865e8178863945f916104a1575b50610661565b604080516001600160a01b03909516855260208501919091523393918291820190565b0390a2005b6104ba915060203d602011610240576102328183610613565b86610473565b34610383576040366003190112610383576104d96105b2565b6024356104e78115156105c8565b6040516323b872dd60e01b815233600482015230602482015260448101829052906001600160a01b038316906020836064815f865af19182156102475761055961049c937f9d278c56ba6dc86a12eefe6b43112bd6e06648eb4ec0b950ee2d783d40e2acb4955f916105935750610661565b5f525f60205260405f2061056e82825461069f565b9055604080516001600160a01b03909516855260208501919091523393918291820190565b6105ac915060203d602011610240576102328183610613565b87610473565b600435906001600160a01b038216820361038357565b156105cf57565b606460405162461bcd60e51b815260206004820152602060248201527f416d6f756e74206d7573742062652067726561746572207468616e207a65726f6044820152fd5b90601f8019910116810190811067ffffffffffffffff82111761063557604052565b634e487b7160e01b5f52604160045260245ffd5b90816020910312610383575180151581036103835790565b1561066857565b60405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606490fd5b919082018092116102d257565b156106b357565b60405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e74206c697175696469747960501b6044820152606490fd5b919082039182116102d257565b1561070557565b60405162461bcd60e51b8152602060048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b6044820152606490fdfea264697066735822122024398d0caa7b1af3e737a3e71b2768b14a9c86ffb9a37a7d0849ffc11cde81e564736f6c634300081c0033

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.