Contract 0x676c7d48ebd00735E082b0F1D11762C3Ff305072

 
Txn Hash
Block
From
To
Value [Txn Fee]
0x1e2d5a203317ba50cf675d22cfa28913ba4a0488a81ca01f96e677bc41fce07b22149972021-10-14 13:14:282 days 11 hrs ago0x558ef269bcc4cc9f2e14e3f4301231fbeb85d95f IN  Contract Creation0 ETH0.022604808688 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EpochAdvancer

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 2 runs

Other Settings:
default evmVersion, Apache-2.0 license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 4 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 2 of 4 : Context.sol
// SPDX-License-Identifier: MIT

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;
    }
}

File 3 of 4 : EpochAdvancer.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.6;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ISmartAlpha.sol";

contract EpochAdvancer is Ownable {
    address[] public pools;
    uint256 public numberOfPools;

    constructor(address[] memory addrs) {
        if (addrs.length > 0) {
            addPools(addrs);
        }
    }

    function addPool(address poolAddress) public onlyOwner {
        require(poolAddress != address(0), "invalid address");

        pools.push(poolAddress);
        numberOfPools++;
    }

    function addPools(address[] memory addrs) public onlyOwner {
        require(addrs.length > 0, "invalid array");

        for (uint256 i = 0; i < addrs.length; i++) {
            addPool(addrs[i]);
        }
    }

    function advanceEpochs() public {
        for (uint256 i = 0; i < pools.length; i++) {
            ISmartAlpha sa = ISmartAlpha(pools[i]);

            if (sa.getCurrentEpoch() > sa.epoch()) {
                if (gasleft() < 400_000) {
                    break;
                }

                sa.advanceEpoch();
            }
        }
    }

    function checkUpkeep(bytes calldata /* checkData */) external view returns (bool, bytes memory) {
        bool upkeepNeeded;

        for (uint256 i = 0; i < pools.length; i++) {
            ISmartAlpha sa = ISmartAlpha(pools[i]);

            if (sa.getCurrentEpoch() > sa.epoch()) {
                upkeepNeeded = true;
                break;
            }
        }

        return (upkeepNeeded, "");
    }

    function performUpkeep(bytes calldata /* performData */) external {
        advanceEpochs();
    }
}

File 4 of 4 : ISmartAlpha.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.6;

interface ISmartAlpha {
    function epoch() external view returns (uint256);
    function getCurrentEpoch() external view returns (uint256);
    function advanceEpoch() external;
}

Settings
{
  "evmVersion": "berlin",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 2
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address[]","name":"addrs","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":[{"internalType":"address","name":"poolAddress","type":"address"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addrs","type":"address[]"}],"name":"addPools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"advanceEpochs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numberOfPools","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"performUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162000e1238038062000e12833981016040819052620000349162000287565b6200003f3362000059565b80511562000052576200005281620000a9565b50620003eb565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b33620000b46200017c565b6001600160a01b031614620000e65760405162461bcd60e51b8152600401620000dd9062000360565b60405180910390fd5b6000815111620001295760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420617272617960981b6044820152606401620000dd565b60005b81518110156200017857620001638282815181106200014f576200014f620003bf565b60200260200101516200018b60201b60201c565b806200016f8162000395565b9150506200012c565b5050565b6000546001600160a01b031690565b33620001966200017c565b6001600160a01b031614620001bf5760405162461bcd60e51b8152600401620000dd9062000360565b6001600160a01b038116620002095760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b6044820152606401620000dd565b60018054808201825560009182527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b0384161790556002805491620002628362000395565b919050555050565b80516001600160a01b03811681146200028257600080fd5b919050565b600060208083850312156200029b57600080fd5b82516001600160401b0380821115620002b357600080fd5b818501915085601f830112620002c857600080fd5b815181811115620002dd57620002dd620003d5565b8060051b604051601f19603f83011681018181108582111715620003055762000305620003d5565b604052828152858101935084860182860187018a10156200032557600080fd5b600095505b8386101562000353576200033e816200026a565b8552600195909501949386019386016200032a565b5098975050505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000600019821415620003b857634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b610a1780620003fb6000396000f3fe608060405234801561001057600080fd5b506004361061008e5760003560e01c80633bd54b47146100935780634585e33b1461009d5780636e04ff0d146100b05780636f682a53146100da578063715018a6146100f15780638da5cb5b146100f9578063ac4afa3814610119578063b36a4ab11461012c578063d914cd4b1461013f578063f2fde38b14610152575b600080fd5b61009b610165565b005b61009b6100ab366004610855565b6102fb565b6100c36100be366004610855565b610307565b6040516100d19291906108f8565b60405180910390f35b6100e360025481565b6040519081526020016100d1565b61009b610460565b6101016104a4565b6040516001600160a01b0390911681526020016100d1565b6101016101273660046108c6565b6104b3565b61009b61013a36600461078a565b6104dd565b61009b61014d366004610768565b61058d565b61009b610160366004610768565b610663565b60005b6001548110156102f857600060018281548110610187576101876109b5565b600091825260209182902001546040805163900cf0cf60e01b815290516001600160a01b039092169350839263900cf0cf92600480840193829003018186803b1580156101d357600080fd5b505afa1580156101e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020b91906108df565b816001600160a01b031663b97dd9e26040518163ffffffff1660e01b815260040160206040518083038186803b15801561024457600080fd5b505afa158015610258573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027c91906108df565b11156102e55762061a805a1015610291575050565b806001600160a01b0316633cf80e6c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156102cc57600080fd5b505af11580156102e0573d6000803e3d6000fd5b505050505b50806102f08161098c565b915050610168565b50565b610303610165565b5050565b6000606081805b6001548110156104455760006001828154811061032d5761032d6109b5565b600091825260209182902001546040805163900cf0cf60e01b815290516001600160a01b039092169350839263900cf0cf92600480840193829003018186803b15801561037957600080fd5b505afa15801561038d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b191906108df565b816001600160a01b031663b97dd9e26040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b505afa1580156103fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042291906108df565b1115610432576001925050610445565b508061043d8161098c565b91505061030e565b50604080516020810190915260008152909590945092505050565b336104696104a4565b6001600160a01b0316146104985760405162461bcd60e51b815260040161048f90610957565b60405180910390fd5b6104a260006106fc565b565b6000546001600160a01b031690565b600181815481106104c357600080fd5b6000918252602090912001546001600160a01b0316905081565b336104e66104a4565b6001600160a01b03161461050c5760405162461bcd60e51b815260040161048f90610957565b600081511161054d5760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420617272617960981b604482015260640161048f565b60005b81518110156103035761057b82828151811061056e5761056e6109b5565b602002602001015161058d565b806105858161098c565b915050610550565b336105966104a4565b6001600160a01b0316146105bc5760405162461bcd60e51b815260040161048f90610957565b6001600160a01b0381166106045760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015260640161048f565b60018054808201825560009182527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b038416179055600280549161065b8361098c565b919050555050565b3361066c6104a4565b6001600160a01b0316146106925760405162461bcd60e51b815260040161048f90610957565b6001600160a01b0381166106f75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161048f565b6102f8815b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461076357600080fd5b919050565b60006020828403121561077a57600080fd5b6107838261074c565b9392505050565b6000602080838503121561079d57600080fd5b82356001600160401b03808211156107b457600080fd5b818501915085601f8301126107c857600080fd5b8135818111156107da576107da6109cb565b8060051b604051601f19603f830116810181811085821117156107ff576107ff6109cb565b604052828152858101935084860182860187018a101561081e57600080fd5b600095505b83861015610848576108348161074c565b855260019590950194938601938601610823565b5098975050505050505050565b6000806020838503121561086857600080fd5b82356001600160401b038082111561087f57600080fd5b818501915085601f83011261089357600080fd5b8135818111156108a257600080fd5b8660208285010111156108b457600080fd5b60209290920196919550909350505050565b6000602082840312156108d857600080fd5b5035919050565b6000602082840312156108f157600080fd5b5051919050565b821515815260006020604081840152835180604085015260005b8181101561092e57858101830151858201606001528201610912565b81811115610940576000606083870101525b50601f01601f191692909201606001949350505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006000198214156109ae57634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220bcd56c9a6ec4e7cfd0159e617d487806b052547957b2fe30a856682df91d3b1164736f6c63430008060033000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000050000000000000000000000001bb4f073e5396a1e6b4f0db461baa025a4bf9545000000000000000000000000b3a0c4cb75574fe38dda8fc29cd859ba59ace5280000000000000000000000004a67e15a16f3e1eee73e237cd201d9c8449088f0000000000000000000000000458c23692a4944d0ad5f91f640e5fcc47caacecf00000000000000000000000073e5685b52b29b12555efeb23b496dee144fd502

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

000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000050000000000000000000000001bb4f073e5396a1e6b4f0db461baa025a4bf9545000000000000000000000000b3a0c4cb75574fe38dda8fc29cd859ba59ace5280000000000000000000000004a67e15a16f3e1eee73e237cd201d9c8449088f0000000000000000000000000458c23692a4944d0ad5f91f640e5fcc47caacecf00000000000000000000000073e5685b52b29b12555efeb23b496dee144fd502

-----Decoded View---------------
Arg [0] : addrs (address[]): 0x1bb4f073e5396a1e6b4f0db461baa025a4bf9545,0xb3a0c4cb75574fe38dda8fc29cd859ba59ace528,0x4a67e15a16f3e1eee73e237cd201d9c8449088f0,0x458c23692a4944d0ad5f91f640e5fcc47caacecf,0x73e5685b52b29b12555efeb23b496dee144fd502

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [2] : 0000000000000000000000001bb4f073e5396a1e6b4f0db461baa025a4bf9545
Arg [3] : 000000000000000000000000b3a0c4cb75574fe38dda8fc29cd859ba59ace528
Arg [4] : 0000000000000000000000004a67e15a16f3e1eee73e237cd201d9c8449088f0
Arg [5] : 000000000000000000000000458c23692a4944d0ad5f91f640e5fcc47caacecf
Arg [6] : 00000000000000000000000073e5685b52b29b12555efeb23b496dee144fd502


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.