Contract 0xb31a1ba8179c3f0650976c26954c587d36e621f2

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xb3e0d428baf08ed5ede6b46ba83258796f6b3c18107d18fd765d576bd4fb282dUpdate Interval164560562022-06-24 12:55:2511 days 14 hrs agoGrape Finance: Deployer IN  0xb31a1ba8179c3f0650976c26954c587d36e621f20 AVAX0.000743964 26
0x9652811a2d95fd7b91274fd35e6bf3ba806f015b4c0b8620b65ab78a91d5bff40x60806040164183552022-06-23 16:02:1012 days 11 hrs agoGrape Finance: Deployer IN  Create: Counter0 AVAX0.0108095625 27.5
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Counter

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
/**
 *Submitted for verification at snowtrace.io on 2022-06-23
*/

/**
 *Submitted for verification at testnet.snowtrace.io on 2022-06-09
*/

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


interface KeeperCompatibleInterface {
  /**
   * @notice method that is simulated by the keepers to see if any work actually
   * needs to be performed. This method does does not actually need to be
   * executable, and since it is only ever simulated it can consume lots of gas.
   * @dev To ensure that it is never called, you may want to add the
   * cannotExecute modifier from KeeperBase to your implementation of this
   * method.
   * @param checkData specified in the upkeep registration so it is always the
   * same for a registered upkeep. This can easily be broken down into specific
   * arguments using `abi.decode`, so multiple upkeeps can be registered on the
   * same contract and easily differentiated by the contract.
   * @return upkeepNeeded boolean to indicate whether the keeper should call
   * performUpkeep or not.
   * @return performData bytes that the keeper should call performUpkeep with, if
   * upkeep is needed. If you would like to encode data to decode later, try
   * `abi.encode`.
   */
  function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData);

  /**
   * @notice method that is actually executed by the keepers, via the registry.
   * The data returned by the checkUpkeep simulation will be passed into
   * this method to actually be executed.
   * @dev The input to this method should not be trusted, and the caller of the
   * method should not even be restricted to any single registry. Anyone should
   * be able call it, and the input should be validated, there is no guarantee
   * that the data passed in is the performData returned from checkUpkeep. This
   * could happen due to malicious keepers, racing keepers, or simply a state
   * change while the performUpkeep transaction is waiting for confirmation.
   * Always validate the data passed in.
   * @param performData is the data which was passed back from the checkData
   * simulation. If it is encoded, it can easily be decoded into other types by
   * calling `abi.decode`. This data should not be trusted, and should be
   * validated against the contract's current state.
   */
  function performUpkeep(bytes calldata performData) external;
}

contract KeeperBase {
  error OnlySimulatedBackend();

  /**
   * @notice method that allows it to be simulated via eth_call by checking that
   * the sender is the zero address.
   */
  function preventExecution() internal view {
    if (tx.origin != address(0)) {
      revert OnlySimulatedBackend();
    }
  }

  /**
   * @notice modifier that allows it to be simulated via eth_call by checking
   * that the sender is the zero address.
   */
  modifier cannotExecute() {
    preventExecution();
    _;
  }
}

interface IOracle {
    function update() external;
}


abstract contract KeeperCompatible is KeeperBase, KeeperCompatibleInterface {}

contract Counter is KeeperCompatibleInterface {
 
    uint public counter;
    uint public interval;
    uint public lastTimeStamp;
    address public admin;
    IOracle public Oracle = IOracle(0xAe53120b72a8FdB9Dd6f16D86D8e152B6914bEC8);

    modifier OnlyAdmin() {
        require(msg.sender == admin, "Caller is not the admin!");
        _;
    }

    constructor(uint updateInterval, uint _lastTimeStamp) {
      interval = updateInterval;
      lastTimeStamp = _lastTimeStamp;
      counter = 0;
      admin = msg.sender;
    }

    function updateInterval(uint _interval) external OnlyAdmin{
       interval = _interval;
    }

    function updateAdmin(address _admin) external OnlyAdmin{
       admin = _admin;
    }

    function checkUpkeep(bytes calldata /* checkData */) external view override returns (bool upkeepNeeded, bytes memory /* performData */) {
        upkeepNeeded = (block.timestamp - lastTimeStamp) > interval;
    }

    function performUpkeep(bytes calldata /* performData */) external override {
      if ((block.timestamp - lastTimeStamp) > interval ) {
            lastTimeStamp = block.timestamp;
            Oracle.update();
            counter = counter + 1; 
        }
    }
}

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"updateInterval","type":"uint256"},{"internalType":"uint256","name":"_lastTimeStamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"counter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"interval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"performUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"updateAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_interval","type":"uint256"}],"name":"updateInterval","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600480546001600160a01b03191673ae53120b72a8fdb9dd6f16d86d8e152b6914bec817905534801561003657600080fd5b5060405161052238038061052283398101604081905261005591610079565b60019190915560025560008055600380546001600160a01b0319163317905561009d565b6000806040838503121561008c57600080fd5b505080516020909101519092909150565b610476806100ac6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063947a36fb11610066578063947a36fb146100f3578063d0f07926146100fc578063e2f273bd1461010f578063f24a534e14610122578063f851a4401461014d57600080fd5b80633f3b3b27146100985780634585e33b146100b457806361bc221a146100c95780636e04ff0d146100d2575b600080fd5b6100a160025481565b6040519081526020015b60405180910390f35b6100c76100c2366004610311565b610160565b005b6100a160005481565b6100e56100e0366004610311565b6101ec565b6040516100ab92919061039c565b6100a160015481565b6100c761010a366004610383565b61020b565b6100c761011d3660046102e1565b61026a565b600454610135906001600160a01b031681565b6040516001600160a01b0390911681526020016100ab565b600354610135906001600160a01b031681565b6001546002546101709042610413565b11156101e85742600255600480546040805163a2e6204560e01b815290516001600160a01b039092169263a2e6204592828201926000929082900301818387803b1580156101bd57600080fd5b505af11580156101d1573d6000803e3d6000fd5b5050505060005460016101e491906103fb565b6000555b5050565b60006060600154600254426102019190610413565b1191509250929050565b6003546001600160a01b031633146102655760405162461bcd60e51b815260206004820152601860248201527743616c6c6572206973206e6f74207468652061646d696e2160401b60448201526064015b60405180910390fd5b600155565b6003546001600160a01b031633146102bf5760405162461bcd60e51b815260206004820152601860248201527743616c6c6572206973206e6f74207468652061646d696e2160401b604482015260640161025c565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000602082840312156102f357600080fd5b81356001600160a01b038116811461030a57600080fd5b9392505050565b6000806020838503121561032457600080fd5b823567ffffffffffffffff8082111561033c57600080fd5b818501915085601f83011261035057600080fd5b81358181111561035f57600080fd5b86602082850101111561037157600080fd5b60209290920196919550909350505050565b60006020828403121561039557600080fd5b5035919050565b821515815260006020604081840152835180604085015260005b818110156103d2578581018301518582016060015282016103b6565b818111156103e4576000606083870101525b50601f01601f191692909201606001949350505050565b6000821982111561040e5761040e61042a565b500190565b6000828210156104255761042561042a565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220e171504c85667be0e3645a495498a7aa9631f88d23b22260187f2ba5000924dd64736f6c634300080700330000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000062b48e00

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

0000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000062b48e00

-----Decoded View---------------
Arg [0] : updateInterval (uint256): 3600
Arg [1] : _lastTimeStamp (uint256): 1656000000

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000e10
Arg [1] : 0000000000000000000000000000000000000000000000000000000062b48e00


Deployed ByteCode Sourcemap

3071:1249:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3180:25;;;;;;;;;2696::1;;;2684:2;2669:18;3180:25:0;;;;;;;;4050:267;;;;;;:::i;:::-;;:::i;:::-;;3127:19;;;;;;3828:214;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;3153:20::-;;;;;;3629:96;;;;;;:::i;:::-;;:::i;3733:87::-;;;;;;:::i;:::-;;:::i;3239:75::-;;;;;-1:-1:-1;;;;;3239:75:0;;;;;;-1:-1:-1;;;;;1250:32:1;;;1232:51;;1220:2;1205:18;3239:75:0;1086:203:1;3212:20:0;;;;;-1:-1:-1;;;;;3212:20:0;;;4050:267;4174:8;;4157:13;;4139:31;;:15;:31;:::i;:::-;4138:44;4134:176;;;4216:15;4200:13;:31;4246:6;;;:15;;;-1:-1:-1;;;4246:15:0;;;;-1:-1:-1;;;;;4246:6:0;;;;:13;;:15;;;;:6;;:15;;;;;;:6;;:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4286:7;;4296:1;4286:11;;;;:::i;:::-;4276:7;:21;4134:176;4050:267;;:::o;3828:214::-;3913:17;3932:12;4026:8;;4009:13;;3991:15;:31;;;;:::i;:::-;3990:44;3975:59;;3828:214;;;;;:::o;3629:96::-;3377:5;;-1:-1:-1;;;;;3377:5:0;3363:10;:19;3355:56;;;;-1:-1:-1;;;3355:56:0;;2399:2:1;3355:56:0;;;2381:21:1;2438:2;2418:18;;;2411:30;-1:-1:-1;;;2457:18:1;;;2450:54;2521:18;;3355:56:0;;;;;;;;;3697:8:::1;:20:::0;3629:96::o;3733:87::-;3377:5;;-1:-1:-1;;;;;3377:5:0;3363:10;:19;3355:56;;;;-1:-1:-1;;;3355:56:0;;2399:2:1;3355:56:0;;;2381:21:1;2438:2;2418:18;;;2411:30;-1:-1:-1;;;2457:18:1;;;2450:54;2521:18;;3355:56:0;2197:348:1;3355:56:0;3798:5:::1;:14:::0;;-1:-1:-1;;;;;;3798:14:0::1;-1:-1:-1::0;;;;;3798:14:0;;;::::1;::::0;;;::::1;::::0;;3733:87::o;14:286:1:-;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;168:23;;-1:-1:-1;;;;;220:31:1;;210:42;;200:70;;266:1;263;256:12;200:70;289:5;14:286;-1:-1:-1;;;14:286:1:o;305:591::-;375:6;383;436:2;424:9;415:7;411:23;407:32;404:52;;;452:1;449;442:12;404:52;492:9;479:23;521:18;562:2;554:6;551:14;548:34;;;578:1;575;568:12;548:34;616:6;605:9;601:22;591:32;;661:7;654:4;650:2;646:13;642:27;632:55;;683:1;680;673:12;632:55;723:2;710:16;749:2;741:6;738:14;735:34;;;765:1;762;755:12;735:34;810:7;805:2;796:6;792:2;788:15;784:24;781:37;778:57;;;831:1;828;821:12;778:57;862:2;854:11;;;;;884:6;;-1:-1:-1;305:591:1;;-1:-1:-1;;;;305:591:1:o;901:180::-;960:6;1013:2;1001:9;992:7;988:23;984:32;981:52;;;1029:1;1026;1019:12;981:52;-1:-1:-1;1052:23:1;;901:180;-1:-1:-1;901:180:1:o;1294:676::-;1477:6;1470:14;1463:22;1452:9;1445:41;1426:4;1505:2;1543;1538;1527:9;1523:18;1516:30;1575:6;1569:13;1618:6;1613:2;1602:9;1598:18;1591:34;1643:1;1653:140;1667:6;1664:1;1661:13;1653:140;;;1762:14;;;1758:23;;1752:30;1728:17;;;1747:2;1724:26;1717:66;1682:10;;1653:140;;;1811:6;1808:1;1805:13;1802:91;;;1881:1;1876:2;1867:6;1856:9;1852:22;1848:31;1841:42;1802:91;-1:-1:-1;1954:2:1;1933:15;-1:-1:-1;;1929:29:1;1914:45;;;;1961:2;1910:54;;1294:676;-1:-1:-1;;;;1294:676:1:o;2732:128::-;2772:3;2803:1;2799:6;2796:1;2793:13;2790:39;;;2809:18;;:::i;:::-;-1:-1:-1;2845:9:1;;2732:128::o;2865:125::-;2905:4;2933:1;2930;2927:8;2924:34;;;2938:18;;:::i;:::-;-1:-1:-1;2975:9:1;;2865:125::o;2995:127::-;3056:10;3051:3;3047:20;3044:1;3037:31;3087:4;3084:1;3077:15;3111:4;3108:1;3101:15

Swarm Source

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