Contract 0x0a6851514dcfd58cf4652ed591198ba99103a46d

Contract Overview

Balance:
0 FTM
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x59a600b34d44d0afcaa31a2c409333f22b76f35d2ca657672834fd556762dc810x6080604098932912022-07-27 12:08:3569 days 7 hrs ago0x97ea4a24535b5b52c3e15912071f469ac2ebcfb7 IN  Contract Creation0 FTM0.000646930999
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x59a600b34d44d0afcaa31a2c409333f22b76f35d2ca657672834fd556762dc8198932912022-07-27 12:08:3569 days 7 hrs ago 0x97ea4a24535b5b52c3e15912071f469ac2ebcfb7  Contract Creation0 FTM
[ Download CSV Export 
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x349f2f6330Aa379C4cA3325a230D306921bCDD91

Contract Name:
FantomPriceFeed

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license
/**
 *Submitted for verification at FtmScan.com on 2021-10-12
*/

pragma solidity 0.6.12;


// SPDX-License-Identifier: MIT
/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

interface IFantomAddressRegistry {
    function tokenRegistry() external view returns (address);
}

interface IFantomTokenRegistry {
    function enabled(address) external returns (bool);
}

interface IOracle {
    function decimals() external view returns (uint8);

    function latestAnswer() external view returns (int256);
}

contract FantomPriceFeed is Ownable {
    /// @notice keeps track of oracles for each tokens
    mapping(address => address) public oracles;

    /// @notice fantom address registry contract
    address public addressRegistry;

    /// @notice wrapped FTM contract
    address public wFTM;

    constructor(address _addressRegistry, address _wFTM) public {
        addressRegistry = _addressRegistry;
        wFTM = _wFTM;
    }

    /**
     @notice Register oracle contract to token
     @dev Only owner can register oracle
     @param _token ERC20 token address
     @param _oracle Oracle address
     */
    function registerOracle(address _token, address _oracle)
        external
        onlyOwner
    {
        IFantomTokenRegistry tokenRegistry = IFantomTokenRegistry(
            IFantomAddressRegistry(addressRegistry).tokenRegistry()
        );
        require(tokenRegistry.enabled(_token), "invalid token");
        require(oracles[_token] == address(0), "oracle already set");

        oracles[_token] = _oracle;
    }

    /**
     @notice Update oracle address for token
     @dev Only owner can update oracle
     @param _token ERC20 token address
     @param _oracle Oracle address
     */
    function updateOracle(address _token, address _oracle) external onlyOwner {
        require(oracles[_token] != address(0), "oracle not set");

        oracles[_token] = _oracle;
    }

    /**
     @notice Get current price for token
     @dev return current price or if oracle is not registered returns 0
     @param _token ERC20 token address
     */
    function getPrice(address _token) external view returns (int256, uint8) {
        if (oracles[_token] == address(0)) {
            return (0, 0);
        }

        IOracle oracle = IOracle(oracles[_token]);
        return (oracle.latestAnswer(), oracle.decimals());
    }

    /**
     @notice Update address registry contract
     @dev Only admin
     */
    function updateAddressRegistry(address _addressRegistry)
        external
        onlyOwner
    {
        addressRegistry = _addressRegistry;
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_addressRegistry","type":"address"},{"internalType":"address","name":"_wFTM","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"addressRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getPrice","outputs":[{"internalType":"int256","name":"","type":"int256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"oracles","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_oracle","type":"address"}],"name":"registerOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addressRegistry","type":"address"}],"name":"updateAddressRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_oracle","type":"address"}],"name":"updateOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wFTM","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516109f03803806109f08339818101604052604081101561003357600080fd5b50805160209091015160006100466100c1565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600280546001600160a01b039384166001600160a01b031991821617909155600380549290931691161790556100c5565b3390565b61091c806100d46000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c806388270e0c1161006657806388270e0c146101665780638da5cb5b14610194578063addd50991461019c578063f2fde38b146101c2578063f3ad65f4146101e85761009e565b8063050d63ec146100a357806341976e09146100c757806368e79e8914610108578063715018a61461013057806383d998ae14610138575b600080fd5b6100ab6101f0565b604080516001600160a01b039092168252519081900360200190f35b6100ed600480360360208110156100dd57600080fd5b50356001600160a01b03166101ff565b6040805192835260ff90911660208301528051918290030190f35b61012e6004803603602081101561011e57600080fd5b50356001600160a01b0316610324565b005b61012e6103a8565b61012e6004803603604081101561014e57600080fd5b506001600160a01b0381358116916020013516610454565b61012e6004803603604081101561017c57600080fd5b506001600160a01b0381358116916020013516610541565b6100ab610761565b6100ab600480360360208110156101b257600080fd5b50356001600160a01b0316610770565b61012e600480360360208110156101d857600080fd5b50356001600160a01b031661078b565b6100ab61088d565b6003546001600160a01b031681565b6001600160a01b03818116600090815260016020526040812054909182911661022d5750600090508061031f565b6001600160a01b038084166000908152600160209081526040918290205482516350d25bcd60e01b8152925193169283926350d25bcd926004808301939192829003018186803b15801561028057600080fd5b505afa158015610294573d6000803e3d6000fd5b505050506040513d60208110156102aa57600080fd5b50516040805163313ce56760e01b815290516001600160a01b0384169163313ce567916004808301926020929190829003018186803b1580156102ec57600080fd5b505afa158015610300573d6000803e3d6000fd5b505050506040513d602081101561031657600080fd5b50519093509150505b915091565b61032c61089c565b6001600160a01b031661033d610761565b6001600160a01b031614610386576040805162461bcd60e51b815260206004820181905260248201526000805160206108c7833981519152604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6103b061089c565b6001600160a01b03166103c1610761565b6001600160a01b03161461040a576040805162461bcd60e51b815260206004820181905260248201526000805160206108c7833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b61045c61089c565b6001600160a01b031661046d610761565b6001600160a01b0316146104b6576040805162461bcd60e51b815260206004820181905260248201526000805160206108c7833981519152604482015290519081900360640190fd5b6001600160a01b0382811660009081526001602052604090205416610513576040805162461bcd60e51b815260206004820152600e60248201526d1bdc9858db19481b9bdd081cd95d60921b604482015290519081900360640190fd5b6001600160a01b03918216600090815260016020526040902080546001600160a01b03191691909216179055565b61054961089c565b6001600160a01b031661055a610761565b6001600160a01b0316146105a3576040805162461bcd60e51b815260206004820181905260248201526000805160206108c7833981519152604482015290519081900360640190fd5b60025460408051639d23c4c760e01b815290516000926001600160a01b031691639d23c4c7916004808301926020929190829003018186803b1580156105e857600080fd5b505afa1580156105fc573d6000803e3d6000fd5b505050506040513d602081101561061257600080fd5b5051604080516398afdfe360e01b81526001600160a01b0386811660048301529151929350908316916398afdfe3916024808201926020929091908290030181600087803b15801561066357600080fd5b505af1158015610677573d6000803e3d6000fd5b505050506040513d602081101561068d57600080fd5b50516106d0576040805162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b2103a37b5b2b760991b604482015290519081900360640190fd5b6001600160a01b038381166000908152600160205260409020541615610732576040805162461bcd60e51b81526020600482015260126024820152711bdc9858db1948185b1c9958591e481cd95d60721b604482015290519081900360640190fd5b506001600160a01b03918216600090815260016020526040902080546001600160a01b03191691909216179055565b6000546001600160a01b031690565b6001602052600090815260409020546001600160a01b031681565b61079361089c565b6001600160a01b03166107a4610761565b6001600160a01b0316146107ed576040805162461bcd60e51b815260206004820181905260248201526000805160206108c7833981519152604482015290519081900360640190fd5b6001600160a01b0381166108325760405162461bcd60e51b81526004018080602001828103825260268152602001806108a16026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031681565b339056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122003dc2aee8111cacccdac596e5e96a04b7960804e6f3ba92260eac1aae73b213564736f6c634300060c00330000000000000000000000003bce445b7d448d37fd984138590408bdfd201854000000000000000000000000f1277d1ed8ad466beddf92ef448a132661956621

Deployed ByteCode Sourcemap

3525:2149:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3802:19;;;:::i;:::-;;;;-1:-1:-1;;;;;3802:19:0;;;;;;;;;;;;;;5145:279;;;;;;;;;;;;;;;;-1:-1:-1;5145:279:0;-1:-1:-1;;;;;5145:279:0;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;5519:152;;;;;;;;;;;;;;;;-1:-1:-1;5519:152:0;-1:-1:-1;;;;;5519:152:0;;:::i;:::-;;2627:148;;;:::i;4777:187::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;4777:187:0;;;;;;;;;;:::i;4158:431::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;4158:431:0;;;;;;;;;;:::i;1976:87::-;;;:::i;3624:42::-;;;;;;;;;;;;;;;;-1:-1:-1;3624:42:0;-1:-1:-1;;;;;3624:42:0;;:::i;2930:244::-;;;;;;;;;;;;;;;;-1:-1:-1;2930:244:0;-1:-1:-1;;;;;2930:244:0;;:::i;3725:30::-;;;:::i;3802:19::-;;;-1:-1:-1;;;;;3802:19:0;;:::o;5145:279::-;-1:-1:-1;;;;;5232:15:0;;;5202:6;5232:15;;;:7;:15;;;;;;5202:6;;;;5232:15;5228:75;;-1:-1:-1;5286:1:0;;-1:-1:-1;5286:1:0;5278:13;;5228:75;-1:-1:-1;;;;;5340:15:0;;;5315:14;5340:15;;;:7;:15;;;;;;;;;;5375:21;;-1:-1:-1;;;5375:21:0;;;;5340:15;;;;;5375:19;;:21;;;;;5340:15;;5375:21;;;;;5340:15;5375:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5375:21:0;5398:17;;;-1:-1:-1;;;5398:17:0;;;;-1:-1:-1;;;;;5398:15:0;;;;;:17;;;;;5375:21;;5398:17;;;;;;;:15;:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5398:17:0;5367:49;;-1:-1:-1;5398:17:0;-1:-1:-1;;5145:279:0;;;;:::o;5519:152::-;2207:12;:10;:12::i;:::-;-1:-1:-1;;;;;2196:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;2196:23:0;;2188:68;;;;;-1:-1:-1;;;2188:68:0;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;2188:68:0;;;;;;;;;;;;;;;5629:15:::1;:34:::0;;-1:-1:-1;;;;;;5629:34:0::1;-1:-1:-1::0;;;;;5629:34:0;;;::::1;::::0;;;::::1;::::0;;5519:152::o;2627:148::-;2207:12;:10;:12::i;:::-;-1:-1:-1;;;;;2196:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;2196:23:0;;2188:68;;;;;-1:-1:-1;;;2188:68:0;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;2188:68:0;;;;;;;;;;;;;;;2734:1:::1;2718:6:::0;;2697:40:::1;::::0;-1:-1:-1;;;;;2718:6:0;;::::1;::::0;2697:40:::1;::::0;2734:1;;2697:40:::1;2765:1;2748:19:::0;;-1:-1:-1;;;;;;2748:19:0::1;::::0;;2627:148::o;4777:187::-;2207:12;:10;:12::i;:::-;-1:-1:-1;;;;;2196:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;2196:23:0;;2188:68;;;;;-1:-1:-1;;;2188:68:0;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;2188:68:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;4870:15:0;;::::1;4897:1;4870:15:::0;;;:7:::1;:15;::::0;;;;;::::1;4862:56;;;::::0;;-1:-1:-1;;;4862:56:0;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;4862:56:0;;;;;;;;;;;;;::::1;;-1:-1:-1::0;;;;;4931:15:0;;::::1;;::::0;;;:7:::1;:15;::::0;;;;:25;;-1:-1:-1;;;;;;4931:25:0::1;::::0;;;::::1;;::::0;;4777:187::o;4158:431::-;2207:12;:10;:12::i;:::-;-1:-1:-1;;;;;2196:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;2196:23:0;;2188:68;;;;;-1:-1:-1;;;2188:68:0;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;2188:68:0;;;;;;;;;;;;;;;4363:15:::1;::::0;4340:55:::1;::::0;;-1:-1:-1;;;4340:55:0;;;;4268:34:::1;::::0;-1:-1:-1;;;;;4363:15:0::1;::::0;4340:53:::1;::::0;:55:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;4363:15;4340:55;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;4340:55:0;4425:29:::1;::::0;;-1:-1:-1;;;4425:29:0;;-1:-1:-1;;;;;4425:29:0;;::::1;;::::0;::::1;::::0;;;4340:55;;-1:-1:-1;4425:21:0;;::::1;::::0;::::1;::::0;:29;;;;;4340:55:::1;::::0;4425:29;;;;;;;;-1:-1:-1;4425:21:0;:29;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;4425:29:0;4417:55:::1;;;::::0;;-1:-1:-1;;;4417:55:0;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;4417:55:0;;;;;;;;;;;;;::::1;;-1:-1:-1::0;;;;;4491:15:0;;::::1;4518:1;4491:15:::0;;;:7:::1;:15;::::0;;;;;::::1;:29:::0;4483:60:::1;;;::::0;;-1:-1:-1;;;4483:60:0;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;4483:60:0;;;;;;;;;;;;;::::1;;-1:-1:-1::0;;;;;;4556:15:0;;::::1;;::::0;;;:7:::1;:15;::::0;;;;:25;;-1:-1:-1;;;;;;4556:25:0::1;::::0;;;::::1;;::::0;;4158:431::o;1976:87::-;2022:7;2049:6;-1:-1:-1;;;;;2049:6:0;1976:87;:::o;3624:42::-;;;;;;;;;;;;-1:-1:-1;;;;;3624:42:0;;:::o;2930:244::-;2207:12;:10;:12::i;:::-;-1:-1:-1;;;;;2196:23:0;:7;:5;:7::i;:::-;-1:-1:-1;;;;;2196:23:0;;2188:68;;;;;-1:-1:-1;;;2188:68:0;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;2188:68:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;3019:22:0;::::1;3011:73;;;;-1:-1:-1::0;;;3011:73:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3121:6;::::0;;3100:38:::1;::::0;-1:-1:-1;;;;;3100:38:0;;::::1;::::0;3121:6;::::1;::::0;3100:38:::1;::::0;::::1;3149:6;:17:::0;;-1:-1:-1;;;;;;3149:17:0::1;-1:-1:-1::0;;;;;3149:17:0;;;::::1;::::0;;;::::1;::::0;;2930:244::o;3725:30::-;;;-1:-1:-1;;;;;3725:30:0;;:::o;605:106::-;693:10;605:106;:::o

Swarm Source

ipfs://03dc2aee8111cacccdac596e5e96a04b7960804e6f3ba92260eac1aae73b2135
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading