ACSPriceFeed

Description:

Smart contract deployed on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract ACSPriceFeed {
    int256 private currentPrice; // Store the price in ACS tokens per ETH
    address private owner;

    event PriceUpdated(int256 newPrice);

    constructor() {
        owner = msg.sender;
        // Initialize with your current price (e.g., 200 ACS per ETH)
        currentPrice = 200 * 10 ** 8; // 8 decimal places
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "Only owner can update");
        _;
    }

    // Function to set the price (call by the owner/admin)
    function setPrice(int256 _price) external onlyOwner {
        require(_price > 0, "Price must be positive");
        currentPrice = _price;
        emit PriceUpdated(_price);
    }

    // Function to get the latest price
    function getLatestPrice() external view returns (int256) {
        return currentPrice;
    }

    // Optional: get decimals (8 for this example)
    function decimals() external pure returns (uint8) {
        return 8;
    }
}

Tags:
addr:0x2863c25c8ce5b74f1fe73e09016132d21ac98783|verified:true|block:23555825|tx:0xb9f849b585b556076bfaa8f43160f6e7b2225326697b4719a05b637ddd6fb944|first_check:1760280363

Submitted on: 2025-10-12 16:46:06

Comments

Log in to comment.

No comments yet.