ACSPriceFeed

Description:

Smart contract deployed on Ethereum with Factory, Oracle features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

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

/**
 * @title ACS PriceFeed - FIXED VERSION
 * @dev Now includes latestRoundData() for Chainlink compatibility
 */
contract ACSPriceFeed {
    
    address public owner;
    int256 private price;
    
    event PriceUpdated(int256 newPrice, uint256 timestamp);
    
    modifier onlyOwner() {
        require(msg.sender == owner, "Only owner can update");
        _;
    }
    
    constructor() {
        owner = msg.sender;
        price = 78000000; // Default $780.00 (8 decimals)
    }
    
    /**
     * @dev Returns the number of decimals
     */
    function decimals() external pure returns (uint8) {
        return 8;
    }
    
    /**
     * @dev Get current price (your original function)
     */
    function getPrice() external view returns (int256) {
        return price;
    }
    
    /**
     * @dev Update price (your original function)
     */
    function updatePrice(int256 newPrice) external onlyOwner {
        require(newPrice > 0, "Price must be positive");
        price = newPrice;
        emit PriceUpdated(newPrice, block.timestamp);
    }
    
    // ============================================================
    // ⭐ NEW FUNCTION - THIS IS WHAT WAS MISSING! ⭐
    // ============================================================
    
    /**
     * @dev Get latest round data - Chainlink AggregatorV3Interface compatible
     * THIS IS THE FUNCTION YOUR ACS TOKEN NEEDS!
     */
    function latestRoundData() external view returns (
        uint80 roundId,
        int256 answer,
        uint256 startedAt,
        uint256 updatedAtTimestamp,
        uint80 answeredInRound
    ) {
        return (
            1,                  // roundId
            price,              // answer - THE PRICE!
            block.timestamp,    // startedAt
            block.timestamp,    // updatedAt
            1                   // answeredInRound
        );
    }
    
    // ============================================================
    // END OF NEW FUNCTION
    // ============================================================
}

/**
 * INSTRUCTIONS:
 * 
 * 1. Copy this ENTIRE code
 * 2. Paste in Remix (replace your old code)
 * 3. Compile with Solidity 0.8.30
 * 4. Deploy to Ethereum Mainnet (this creates a NEW contract)
 * 5. Verify on Etherscan
 * 6. Update your ACS token to use the NEW address
 * 7. Delete/abandon your old PriceFeed contract
 */

Tags:
Factory, Oracle|addr:0x359767f0ce82592eed2f13f19b0252eb539c2a2d|verified:true|block:23556061|tx:0x6b11127a3b776b47e02f24962c0439d66127792d080926957abc477f9c763bc5|first_check:1760280986

Submitted on: 2025-10-12 16:56:29

Comments

Log in to comment.

No comments yet.