ETH Price: $3,097.38 (-0.45%)
Gas: 3 Gwei

Contract

0x5604D3F5c78e5ce9762aD8aceA254956f0c087D6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Set Price164180052023-01-16 7:58:11541 days ago1673855891IN
0x5604D3F5...6f0c087D6
0 ETH0.0004819115.49674333
Set Price161392402022-12-08 9:57:11580 days ago1670493431IN
0x5604D3F5...6f0c087D6
0 ETH0.0004148213.34458142
Set Price159136812022-11-06 21:31:23612 days ago1667770283IN
0x5604D3F5...6f0c087D6
0 ETH0.0003232410.39445997
Set Price150308652022-06-26 20:58:35745 days ago1656277115IN
0x5604D3F5...6f0c087D6
0 ETH0.0009088229.23590588
Set Price150090052022-06-22 18:39:38749 days ago1655923178IN
0x5604D3F5...6f0c087D6
0 ETH0.0019455762.56274956
Set Price148939342022-06-02 23:56:43769 days ago1654214203IN
0x5604D3F5...6f0c087D6
0 ETH0.0015507149.88475989
Set Price148877512022-06-01 23:51:47770 days ago1654127507IN
0x5604D3F5...6f0c087D6
0 ETH0.0018800560.45582756
0x60806040145585562022-04-10 14:46:06822 days ago1649601966IN
 Create: PriceStrategyExp
0 ETH0.0134670840

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PriceStrategyExp

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 4 : PriceStrategyExp.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "contracts/IPriceStrategy.sol";

contract PriceStrategyExp is IPriceStrategy, Ownable {
    uint256 private _step;
    uint256 private _initial;

    constructor() {
        setPrice(3e16, 2000); // 0.03eth, +0.03 every 2000
    }

    function setPrice(uint256 initial, uint256 step) public override onlyOwner {
        require(step != 0, "step assert");
        _initial = initial;
        _step = step;
    }

    function getPrice(uint256 num) external override view returns (uint256)
    {
        uint256 steps = num / _step;
        return _initial * (steps + 1);
    }
}

File 2 of 4 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @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() {
        _transferOwnership(_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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 4 : IPriceStrategy.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

interface IPriceStrategy {
    function getPrice(uint256 num) external view returns (uint256);
    function setPrice(uint256 initial, uint256 step) external;
}

File 4 of 4 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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 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) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"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":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"initial","type":"uint256"},{"internalType":"uint256","name":"step","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061001a33610032565b61002d666a94d74f4300006107d0610082565b610127565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146100e15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b8061011c5760405162461bcd60e51b815260206004820152600b60248201526a1cdd195c08185cdcd95c9d60aa1b60448201526064016100d8565b600291909155600155565b6103d1806101366000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b14610066578063e757223014610086578063f2fde38b146100a7578063f7d97577146100ba575b600080fd5b6100646100cd565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100996100943660046102c0565b61010c565b60405190815260200161007d565b6100646100b5366004610299565b61013e565b6100646100c83660046102d8565b6101d9565b6000546001600160a01b031633146101005760405162461bcd60e51b81526004016100f7906102f9565b60405180910390fd5b61010a6000610249565b565b6000806001548361011d9190610346565b905061012a81600161032e565b6002546101379190610366565b9392505050565b6000546001600160a01b031633146101685760405162461bcd60e51b81526004016100f7906102f9565b6001600160a01b0381166101cd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016100f7565b6101d681610249565b50565b6000546001600160a01b031633146102035760405162461bcd60e51b81526004016100f7906102f9565b8061023e5760405162461bcd60e51b815260206004820152600b60248201526a1cdd195c08185cdcd95c9d60aa1b60448201526064016100f7565b600291909155600155565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156102aa578081fd5b81356001600160a01b0381168114610137578182fd5b6000602082840312156102d1578081fd5b5035919050565b600080604083850312156102ea578081fd5b50508035926020909101359150565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561034157610341610385565b500190565b60008261036157634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561038057610380610385565b500290565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220e0435041f9ffc6f721c0cde2333c964556a433a0feef23871fb605423174b2ee64736f6c63430008040033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b14610066578063e757223014610086578063f2fde38b146100a7578063f7d97577146100ba575b600080fd5b6100646100cd565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100996100943660046102c0565b61010c565b60405190815260200161007d565b6100646100b5366004610299565b61013e565b6100646100c83660046102d8565b6101d9565b6000546001600160a01b031633146101005760405162461bcd60e51b81526004016100f7906102f9565b60405180910390fd5b61010a6000610249565b565b6000806001548361011d9190610346565b905061012a81600161032e565b6002546101379190610366565b9392505050565b6000546001600160a01b031633146101685760405162461bcd60e51b81526004016100f7906102f9565b6001600160a01b0381166101cd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016100f7565b6101d681610249565b50565b6000546001600160a01b031633146102035760405162461bcd60e51b81526004016100f7906102f9565b8061023e5760405162461bcd60e51b815260206004820152600b60248201526a1cdd195c08185cdcd95c9d60aa1b60448201526064016100f7565b600291909155600155565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156102aa578081fd5b81356001600160a01b0381168114610137578182fd5b6000602082840312156102d1578081fd5b5035919050565b600080604083850312156102ea578081fd5b50508035926020909101359150565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561034157610341610385565b500190565b60008261036157634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561038057610380610385565b500290565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220e0435041f9ffc6f721c0cde2333c964556a433a0feef23871fb605423174b2ee64736f6c63430008040033

Block Transaction Difficulty 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
Loading...
Loading
[ 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.