ETH Price: $3,515.20 (+3.47%)
Gas: 61 Gwei

Contract

0xe568B2d96a139126B2042a4e0c9fA1755bf5FB70
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60c06040170402892023-04-13 18:51:11325 days ago1681411871IN
 Create: SimpleDecayOracle
0 ETH0.0177483938.73783249

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SimpleDecayOracle

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 4 of 5 : SimpleDecayOracle.sol
/// ===============================
/// ===== Audit: NOT IN SCOPE =====
/// ===============================

pragma solidity 0.8.16;

import "./policies/DecayPolicy.sol";

/// @notice Simple oracle calculating the mothly decay for ARV locks
/// @dev The queue is processed in descending order, meaning the last index will be withdrawn from first.
contract SimpleDecayOracle is DecayPolicy {
    constructor(address _locker) DecayPolicy(_locker) {}

    function balanceOf(address _staker) external view returns (uint256) {
        (uint256 amount, uint32 lockedAt, uint32 duration) = locker.lockOf(_staker);
        return compute(amount, lockedAt, duration, 0);
    }
}

File 2 of 5 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 3 of 5 : IPolicy.sol
pragma solidity 0.8.16;

interface IPolicy {
    function compute(uint256 amount, uint32 lockedAt, uint32 duration, uint256 startingBalance)
        external
        returns (uint256 balance);
    function isExclusive() external returns (bool);
}

File 4 of 5 : ITokenLocker.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface ITokenLocker {
    struct Lock {
        uint192 amount;
        uint32 lockedAt;
        uint32 lockDuration;
    }

    // State changing methods
    function depositByMonths(uint192 _amount, uint256 _months, address _receiver) external;
    function boostToMax() external;
    function increaseAmount(uint192 _amount) external;
    function increaseByMonths(uint256 _months) external;
    function migrate(address staker) external;

    /**
     * @notice Ejects a list of lock accounts from the contract.
     * @dev    Smart contracts with locked rewardToken balances should be mindful that
     *         they may be ejected from the contract by external users.
     */
    function eject(address[] calldata _lockAccounts) external;

    // View methods
    function getLock(address _depositor) external returns (Lock memory);
    function lockOf(address account) external view returns (uint192, uint32, uint32);
    function minLockAmount() external returns (uint256);
    function maxLockDuration() external returns (uint32);
    function getLockMultiplier(uint32 _duration) external view returns (uint256);
    function getSecondsMonths() external view returns (uint256);
    function previewDepositByMonths(uint192 _amount, uint256 _months, address _receiver) external view returns (uint256);
}

File 5 of 5 : DecayPolicy.sol
// SPDX-License-Identifier: MIT

/// ===============================
/// ===== Audit: NOT IN SCOPE =====
/// ===============================

pragma solidity 0.8.16;

import "@interfaces/IPolicy.sol";
import "@interfaces/ITokenLocker.sol";
import {IERC20} from "@oz/token/ERC20/IERC20.sol";

contract DecayPolicy is IPolicy {
    ITokenLocker public immutable locker;
    uint256 public immutable AVG_SECONDS_MONTH;
    bool public exclusive = false;

    /// @notice API version.
    string public constant VERSION = "0.1";

    constructor(address _locker) {
        locker = ITokenLocker(_locker);
        AVG_SECONDS_MONTH = locker.getSecondsMonths();
    }

    function isExclusive() external view returns (bool) {
        return exclusive;
    }

    function getDecayMultiplier(uint32 lockedAt, uint32 lockDuration) public view returns (uint256) {
        // If Lock is already expired return 0
        if (uint256(lockedAt + lockDuration) <= block.timestamp) return 0;

        uint256 diff = block.timestamp - lockedAt;
        uint256 monthDelta = diff / AVG_SECONDS_MONTH;
        uint256 selectedMonth = uint256(lockDuration) / AVG_SECONDS_MONTH;

        if (monthDelta > selectedMonth) return 0;

        if (monthDelta > 0) {
            //If remaining month is < 6 the multiplier stays set at 6 months
            uint32 remainingmonths = uint32(selectedMonth - monthDelta) < 6 ? 6 : uint32(selectedMonth - monthDelta);
            uint32 duration = uint32(remainingmonths * AVG_SECONDS_MONTH);
            uint256 decayedMonthMultiplier = locker.getLockMultiplier(duration);
            return decayedMonthMultiplier;
        }
        return locker.getLockMultiplier(lockDuration);
    }

    function compute(uint256 amount, uint32 lockedAt, uint32 duration, uint256 balance) public view returns (uint256) {
        uint256 dm = getDecayMultiplier(lockedAt, duration);
        return (amount * dm) / 1e18;
    }
}

Settings
{
  "remappings": [
    "@bridge/=src/modules/vedough-bridge/",
    "@forge-std/=lib/forge-std/src/",
    "@governance/=src/modules/governance/",
    "@interfaces/=src/interfaces/",
    "@mocks/=test/mocks/",
    "@oracles/=src/modules/reward-policies/",
    "@oz-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@oz/=lib/openzeppelin-contracts/contracts/",
    "@pproxy/=lib/pie-proxy/contracts/",
    "@prv/=src/modules/PRV/",
    "@rewards/=src/modules/rewards/",
    "@src/=src/",
    "@test/=test/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "pie-proxy/=lib/pie-proxy/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {
    "src/modules/PRV/bitfield.sol": {
      "Bitfields": "0x013b49b72da7f746eec30c7bca848bd788c4fcfe"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_locker","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AVG_SECONDS_MONTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"lockedAt","type":"uint32"},{"internalType":"uint32","name":"duration","type":"uint32"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"compute","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exclusive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"lockedAt","type":"uint32"},{"internalType":"uint32","name":"lockDuration","type":"uint32"}],"name":"getDecayMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isExclusive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locker","outputs":[{"internalType":"contract ITokenLocker","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60c06040526000805460ff1916905534801561001a57600080fd5b50604051610863380380610863833981016040819052610039916100b4565b6001600160a01b03811660808190526040805163078b9ac360e51b8152905183929163f17358609160048083019260209291908290030181865afa158015610085573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100a991906100e4565b60a052506100fd9050565b6000602082840312156100c657600080fd5b81516001600160a01b03811681146100dd57600080fd5b9392505050565b6000602082840312156100f657600080fd5b5051919050565b60805160a05161071861014b60003960008181610144015281816101d0015281816101fe015261027901526000818160f2015281816102cd01528181610361015261040801526107186000f3fe608060405234801561001057600080fd5b50600436106100875760003560e01c8063d7b96d4e1161005b578063d7b96d4e146100ed578063e4107fe11461012c578063f2ddedeb1461013f578063ffa1ad741461016657600080fd5b80628908081461008c57806301ff74f7146100b257806370a08231146100cf5780638876dea6146100e2575b600080fd5b61009f61009a3660046104e3565b610195565b6040519081526020015b60405180910390f35b6000546100bf9060ff1681565b60405190151581526020016100a9565b61009f6100dd36600461051c565b6103e0565b60005460ff166100bf565b6101147f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a9565b61009f61013a36600461054c565b610498565b61009f7f000000000000000000000000000000000000000000000000000000000000000081565b61018860405180604001604052806003815260200162302e3160e81b81525081565b6040516100a99190610594565b6000426101a283856105f8565b63ffffffff16116101b5575060006103da565b60006101c763ffffffff85164261061c565b905060006101f57f00000000000000000000000000000000000000000000000000000000000000008361062f565b905060006102297f000000000000000000000000000000000000000000000000000000000000000063ffffffff871661062f565b90508082111561023f57600093505050506103da565b81156103465760006006610253848461061c565b63ffffffff161061026d57610268838361061c565b610270565b60065b905060006102a47f000000000000000000000000000000000000000000000000000000000000000063ffffffff8416610651565b604051633a901c7560e11b815263ffffffff821660048201529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063752038ea90602401602060405180830381865afa158015610314573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103389190610670565b96506103da95505050505050565b604051633a901c7560e11b815263ffffffff861660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063752038ea90602401602060405180830381865afa1580156103b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d49190610670565b93505050505b92915050565b604051635a46d3b560e01b81526001600160a01b0382811660048301526000918291829182917f00000000000000000000000000000000000000000000000000000000000000001690635a46d3b590602401606060405180830381865afa15801561044f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190610689565b925092506001600160c01b0316925061048f8383836000610498565b95945050505050565b6000806104a58585610195565b9050670de0b6b3a76400006104ba8288610651565b6104c4919061062f565b9695505050505050565b63ffffffff811681146104e057600080fd5b50565b600080604083850312156104f657600080fd5b8235610501816104ce565b91506020830135610511816104ce565b809150509250929050565b60006020828403121561052e57600080fd5b81356001600160a01b038116811461054557600080fd5b9392505050565b6000806000806080858703121561056257600080fd5b843593506020850135610574816104ce565b92506040850135610584816104ce565b9396929550929360600135925050565b600060208083528351808285015260005b818110156105c1578581018301518582016040015282016105a5565b506000604082860101526040601f19601f8301168501019250505092915050565b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216019080821115610615576106156105e2565b5092915050565b818103818111156103da576103da6105e2565b60008261064c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561066b5761066b6105e2565b500290565b60006020828403121561068257600080fd5b5051919050565b60008060006060848603121561069e57600080fd5b83516001600160c01b03811681146106b557600080fd5b60208501519093506106c6816104ce565b60408501519092506106d7816104ce565b80915050925092509256fea26469706673582212206a299f33b939b446eb2ee598f0be580e59d0caf086d3aca7102042ad39dbfd6964736f6c634300081000330000000000000000000000003e70ff09c8f53294ffd389a7fcf7276cc3d92e64

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100875760003560e01c8063d7b96d4e1161005b578063d7b96d4e146100ed578063e4107fe11461012c578063f2ddedeb1461013f578063ffa1ad741461016657600080fd5b80628908081461008c57806301ff74f7146100b257806370a08231146100cf5780638876dea6146100e2575b600080fd5b61009f61009a3660046104e3565b610195565b6040519081526020015b60405180910390f35b6000546100bf9060ff1681565b60405190151581526020016100a9565b61009f6100dd36600461051c565b6103e0565b60005460ff166100bf565b6101147f0000000000000000000000003e70ff09c8f53294ffd389a7fcf7276cc3d92e6481565b6040516001600160a01b0390911681526020016100a9565b61009f61013a36600461054c565b610498565b61009f7f00000000000000000000000000000000000000000000000000000000002819a081565b61018860405180604001604052806003815260200162302e3160e81b81525081565b6040516100a99190610594565b6000426101a283856105f8565b63ffffffff16116101b5575060006103da565b60006101c763ffffffff85164261061c565b905060006101f57f00000000000000000000000000000000000000000000000000000000002819a08361062f565b905060006102297f00000000000000000000000000000000000000000000000000000000002819a063ffffffff871661062f565b90508082111561023f57600093505050506103da565b81156103465760006006610253848461061c565b63ffffffff161061026d57610268838361061c565b610270565b60065b905060006102a47f00000000000000000000000000000000000000000000000000000000002819a063ffffffff8416610651565b604051633a901c7560e11b815263ffffffff821660048201529091506000906001600160a01b037f0000000000000000000000003e70ff09c8f53294ffd389a7fcf7276cc3d92e64169063752038ea90602401602060405180830381865afa158015610314573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103389190610670565b96506103da95505050505050565b604051633a901c7560e11b815263ffffffff861660048201527f0000000000000000000000003e70ff09c8f53294ffd389a7fcf7276cc3d92e646001600160a01b03169063752038ea90602401602060405180830381865afa1580156103b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d49190610670565b93505050505b92915050565b604051635a46d3b560e01b81526001600160a01b0382811660048301526000918291829182917f0000000000000000000000003e70ff09c8f53294ffd389a7fcf7276cc3d92e641690635a46d3b590602401606060405180830381865afa15801561044f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190610689565b925092506001600160c01b0316925061048f8383836000610498565b95945050505050565b6000806104a58585610195565b9050670de0b6b3a76400006104ba8288610651565b6104c4919061062f565b9695505050505050565b63ffffffff811681146104e057600080fd5b50565b600080604083850312156104f657600080fd5b8235610501816104ce565b91506020830135610511816104ce565b809150509250929050565b60006020828403121561052e57600080fd5b81356001600160a01b038116811461054557600080fd5b9392505050565b6000806000806080858703121561056257600080fd5b843593506020850135610574816104ce565b92506040850135610584816104ce565b9396929550929360600135925050565b600060208083528351808285015260005b818110156105c1578581018301518582016040015282016105a5565b506000604082860101526040601f19601f8301168501019250505092915050565b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216019080821115610615576106156105e2565b5092915050565b818103818111156103da576103da6105e2565b60008261064c57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561066b5761066b6105e2565b500290565b60006020828403121561068257600080fd5b5051919050565b60008060006060848603121561069e57600080fd5b83516001600160c01b03811681146106b557600080fd5b60208501519093506106c6816104ce565b60408501519092506106d7816104ce565b80915050925092509256fea26469706673582212206a299f33b939b446eb2ee598f0be580e59d0caf086d3aca7102042ad39dbfd6964736f6c63430008100033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000003e70ff09c8f53294ffd389a7fcf7276cc3d92e64

-----Decoded View---------------
Arg [0] : _locker (address): 0x3E70FF09C8f53294FFd389a7fcF7276CC3d92e64

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000003e70ff09c8f53294ffd389a7fcf7276cc3d92e64


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

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.