S Price: $0.575085 (-3.66%)

Contract

0xC2741AA1d2497F3f94c7508D1904e7A515b8E7e5

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UsdcQuote

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 1 : swapx_pricefeed.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @dev Minimal interface to get USDC price of 1 token
 */
interface IGetAmountOut {
    function getAmountOut(
        uint256 amountIn,
        address tokenIn,
        address tokenOut
    ) external view returns (uint256 amount, bool stable);
}

contract UsdcQuote {
    address public constant QUOTER_ADDRESS = 0xF5F7231073b3B41c04BA655e1a7438b1a7b29c27; 

    address public constant USDC = 0x29219dd400f2Bf60E5a23d13Be72B486D4038894;

    uint256 public constant ONE_TOKEN = 1e18;

    IGetAmountOut public quoter;

    constructor() {
        quoter = IGetAmountOut(QUOTER_ADDRESS);
    }

    /**
     * @dev Returns how many USDC (in 18-decimal format) you'd get for exactly 1 tokenIn,
     *      ignoring the stable bool returned by the quoter.
     *
     * @param tokenIn The address of the input token
     * @return amount18 The quoted USDC amount, scaled to 1e18
     */
    function getLatestPrice(address tokenIn) external view returns (uint256 amount18) {
        (uint256 rawAmount, ) = quoter.getAmountOut(
            ONE_TOKEN,
            tokenIn,
            USDC
        );

        amount18 = rawAmount * 1e12;

        return amount18;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ONE_TOKEN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"QUOTER_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"}],"name":"getLatestPrice","outputs":[{"internalType":"uint256","name":"amount18","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoter","outputs":[{"internalType":"contract IGetAmountOut","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50600080546001600160a01b03191673f5f7231073b3b41c04ba655e1a7438b1a7b29c27179055610260806100466000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806316345f181461005c5780635880c7eb1461008257806389a30271146100b5578063c6bbd5a7146100d0578063e443348e146100e3575b600080fd5b61006f61006a3660046101a1565b6100f2565b6040519081526020015b60405180910390f35b61009d73f5f7231073b3b41c04ba655e1a7438b1a7b29c2781565b6040516001600160a01b039091168152602001610079565b61009d7329219dd400f2bf60e5a23d13be72b486d403889481565b60005461009d906001600160a01b031681565b61006f670de0b6b3a764000081565b60008054604051635e1e632560e01b8152670de0b6b3a764000060048201526001600160a01b0384811660248301527329219dd400f2bf60e5a23d13be72b486d4038894604483015283921690635e1e6325906064016040805180830381865afa158015610164573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018891906101ca565b50905061019a8164e8d4a510006101ff565b9392505050565b6000602082840312156101b357600080fd5b81356001600160a01b038116811461019a57600080fd5b600080604083850312156101dd57600080fd5b82519150602083015180151581146101f457600080fd5b809150509250929050565b808202811582820484141761022457634e487b7160e01b600052601160045260246000fd5b9291505056fea264697066735822122018a0a9f686cf5aaea2e1bdcf67e7335bfd49ef837646c9cd860283f1d248ae7464736f6c63430008140033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c806316345f181461005c5780635880c7eb1461008257806389a30271146100b5578063c6bbd5a7146100d0578063e443348e146100e3575b600080fd5b61006f61006a3660046101a1565b6100f2565b6040519081526020015b60405180910390f35b61009d73f5f7231073b3b41c04ba655e1a7438b1a7b29c2781565b6040516001600160a01b039091168152602001610079565b61009d7329219dd400f2bf60e5a23d13be72b486d403889481565b60005461009d906001600160a01b031681565b61006f670de0b6b3a764000081565b60008054604051635e1e632560e01b8152670de0b6b3a764000060048201526001600160a01b0384811660248301527329219dd400f2bf60e5a23d13be72b486d4038894604483015283921690635e1e6325906064016040805180830381865afa158015610164573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018891906101ca565b50905061019a8164e8d4a510006101ff565b9392505050565b6000602082840312156101b357600080fd5b81356001600160a01b038116811461019a57600080fd5b600080604083850312156101dd57600080fd5b82519150602083015180151581146101f457600080fd5b809150509250929050565b808202811582820484141761022457634e487b7160e01b600052601160045260246000fd5b9291505056fea264697066735822122018a0a9f686cf5aaea2e1bdcf67e7335bfd49ef837646c9cd860283f1d248ae7464736f6c63430008140033

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

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.