Contract 0x36df0a76a124d8b2205fa11766ec2eff8ce38a35 1

Tarot 

Contract Overview

Tarot: Tarot Price Oracle
Balance:
0 FTM

FTM Value:
$0.00

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x3eef9d021db4251baa8f38e37cb67e7dbfa67f3956902498c4993881ceb5a2fcGet Result420814132022-07-05 14:53:272 days 1 hr ago0x7e154852e70f5f4cd9876bf076c1b6007b472a71 IN  Tarot: Tarot Price Oracle0 FTM0.000103591875
0x32838186e982528cfca4e57b45538f5239ed796b4c2316d353fc1f4521ab9fd0Get Result374731812022-05-03 17:49:5164 days 23 hrs ago0x0675d21ca30e1b026991583c8399e03f4f5dc79d IN  Tarot: Tarot Price Oracle0 FTM0.008346519294
0x5fd254ff06abbdd1963211639c6265968c6e94b2f3af7aa33b7b4a5c15fff132Get Result373044362022-05-01 2:11:3267 days 14 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.1022329
0x0ab9539ae33789bc9136a26399aa9f8d63cb777c76b10c0470733351e84f8acbGet Result372972012022-04-30 22:15:1367 days 18 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM1.082448
0x0f5d38593dbbe631137d2a124c1d8cc74e205987ccf9eb53066c73d01dda0604Get Result372970522022-04-30 22:11:1567 days 18 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM1.563562
0xd2d6a83c192df2a0a2fa664b1c04576df2591781ed2bc41db5d5d1b8a7aeba9bInitialize372831092022-04-30 14:38:3568 days 2 hrs ago0xf3fe91de40cfc785afe4205e058487ac58a7c7b7 IN  Tarot: Tarot Price Oracle0 FTM0.0576834
0xc5580b33aa69a2936bbd53d41aeedecb21c436b6752fd52b463487f11dc47ad8Get Result372797212022-04-30 13:34:5768 days 3 hrs ago0xf3fe91de40cfc785afe4205e058487ac58a7c7b7 IN  Tarot: Tarot Price Oracle0 FTM0.0239645
0x6752ab3bd40a923372fe444797f11d3ece3e8b7212dfc34f82a2fada006e2de7Get Result372691502022-04-30 9:15:2268 days 7 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.433044
0x973aebaa1e709bf4845eeeab4ea9606a727381de7846c365efcf4919066444feGet Result372691182022-04-30 9:14:2068 days 7 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.46663413
0x09cffb9f2b5fa11b9d7cadeb360965a85b0fc13b040b39b13f84beb3171e31a5Get Result348444072022-03-31 2:33:5098 days 14 hrs ago0x663c3434de7d54dec07d7d3f2567512b22d4dd7f IN  Tarot: Tarot Price Oracle0 FTM0.010161795024
0x2d632be47e65cf4342a181d16c0fea07f1d140119324201d17a7c1ef77cd32c3Get Result346545042022-03-28 22:32:20100 days 18 hrs ago0x11c1ba59dc0b00001d572b097c0ad2ceb9b829e5 IN  Tarot: Tarot Price Oracle0 FTM0.015243044763
0x7f9c3bed433d51dac33178173fb748cbcb8dda9f5d8c57e1d8ce994a412491a5Get Result343361362022-03-25 5:11:20104 days 11 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.011290606896
0x95294f8b553a73df32633715de768c5806e44db9c91c4678be61ed754feec3ddGet Result323460762022-03-02 8:46:42127 days 8 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.063630071632
0xc2cb99ea51f4ef7dd9f667e975c2af421d00052c13d9b4503a5fe7f64a18aec6Get Result323460502022-03-02 8:46:09127 days 8 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.061846775961
0xb40d854e2879461aa25dd644ad80ebbf389238dd92949fd64b170824e31495b7Get Result321399482022-02-27 23:33:29129 days 17 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.031905093019
0x30a3fd5a0ab1a3e0eb0d80edf9ca8d83ec39954f79c45115f7fc3a4a486d51afGet Result319125482022-02-25 4:17:34132 days 12 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.0701856792
0x891f66b1f6a1e381d7cbc41f147f7c830643d1a8b6999f59110fa8fed3b6bd4bGet Result319039052022-02-25 2:00:55132 days 14 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.090989569281
0x5c8464dea05f49e7899cecfde66dd2c5cfcde0a265e99d22bad83bcadf368009Get Result318797012022-02-24 17:37:07132 days 23 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.091476383308
0x7cabf7c8c265508d03607744374f1bf3969c521659e059b6bb40652e04c1f914Get Result317970232022-02-23 14:30:34134 days 2 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.053035211102
0x48afb230a0860a8998d11bb365472108e8c0a6f924c0826b9e42c8fd36256daeGet Result316669422022-02-22 4:18:18135 days 12 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.022360096061
0x3d7f5119a26ec85dbde777ec1e0b630643a9dfa835e964bb0aedcc4f040b440cGet Result312608012022-02-17 19:59:49139 days 20 hrs ago0x0d8e060ca2d847553ec14394ee6b304623e0d1d6 IN  Tarot: Tarot Price Oracle0 FTM0.015572584658
0x81c60b7d37df4d18d4a2e10c1a95e94d045fd2082136031994e04e372f2d20baGet Result309015762022-02-14 2:42:47143 days 14 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.018796047543
0x58ae240f6d71e808cf63aa690ae062508033bcced490364e3f0cdec684bab867Get Result306894052022-02-11 23:56:40145 days 16 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.019450105528
0x812d67ed359470a1636645508289c85918faaea8803563cfa6f924ed6f20c4a1Get Result298219682022-02-02 22:59:59154 days 17 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.021125331623
0xd8d0979eb71aa576feb0962493b71610a71e0decab6faf1e86667ae5141530e4Get Result291728512022-01-27 7:53:42161 days 8 hrs ago0xaf0a7b32ccc793fcf5ea5829de2489ee37708e5d IN  Tarot: Tarot Price Oracle0 FTM0.046562753977
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x539d81b3435de3124c6f0275451af34ea8c2cfcba2f26e47d5619abd42b592e096919922021-06-14 18:31:14387 days 22 hrs ago Tarot: Deployer  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TarotPriceOracle

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 4 : TarotPriceOracle.sol
pragma solidity =0.5.16;

import "./libraries/UQ112x112.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./interfaces/ITarotPriceOracle.sol";

contract TarotPriceOracle is ITarotPriceOracle {
    using UQ112x112 for uint224;

    uint32 public constant MIN_T = 1200;

    struct Pair {
        uint256 priceCumulativeSlotA;
        uint256 priceCumulativeSlotB;
        uint32 lastUpdateSlotA;
        uint32 lastUpdateSlotB;
        bool latestIsSlotA;
        bool initialized;
    }
    mapping(address => Pair) public getPair;

    event PriceUpdate(
        address indexed pair,
        uint256 priceCumulative,
        uint32 blockTimestamp,
        bool latestIsSlotA
    );

    function toUint224(uint256 input) internal pure returns (uint224) {
        require(input <= uint224(-1), "TarotPriceOracle: UINT224_OVERFLOW");
        return uint224(input);
    }

    function getPriceCumulativeCurrent(address uniswapV2Pair)
        internal
        view
        returns (uint256 priceCumulative)
    {
        priceCumulative = IUniswapV2Pair(uniswapV2Pair).price0CumulativeLast();
        (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) =
            IUniswapV2Pair(uniswapV2Pair).getReserves();
        uint224 priceLatest = UQ112x112.encode(reserve1).uqdiv(reserve0);
        uint32 timeElapsed = getBlockTimestamp() - blockTimestampLast; // overflow is desired
        // * never overflows, and + overflow is desired
        priceCumulative += uint256(priceLatest) * timeElapsed;
    }

    function initialize(address uniswapV2Pair) external {
        Pair storage pairStorage = getPair[uniswapV2Pair];
        require(
            !pairStorage.initialized,
            "TarotPriceOracle: ALREADY_INITIALIZED"
        );

        uint256 priceCumulativeCurrent =
            getPriceCumulativeCurrent(uniswapV2Pair);
        uint32 blockTimestamp = getBlockTimestamp();
        pairStorage.priceCumulativeSlotA = priceCumulativeCurrent;
        pairStorage.priceCumulativeSlotB = priceCumulativeCurrent;
        pairStorage.lastUpdateSlotA = blockTimestamp;
        pairStorage.lastUpdateSlotB = blockTimestamp;
        pairStorage.latestIsSlotA = true;
        pairStorage.initialized = true;
        emit PriceUpdate(
            uniswapV2Pair,
            priceCumulativeCurrent,
            blockTimestamp,
            true
        );
    }

    function getResult(address uniswapV2Pair)
        external
        returns (uint224 price, uint32 T)
    {
        Pair memory pair = getPair[uniswapV2Pair];
        require(pair.initialized, "TarotPriceOracle: NOT_INITIALIZED");
        Pair storage pairStorage = getPair[uniswapV2Pair];

        uint32 blockTimestamp = getBlockTimestamp();
        uint32 lastUpdateTimestamp =
            pair.latestIsSlotA ? pair.lastUpdateSlotA : pair.lastUpdateSlotB;
        uint256 priceCumulativeCurrent =
            getPriceCumulativeCurrent(uniswapV2Pair);
        uint256 priceCumulativeLast;

        if (blockTimestamp - lastUpdateTimestamp >= MIN_T) {
            // update price
            priceCumulativeLast = pair.latestIsSlotA
                ? pair.priceCumulativeSlotA
                : pair.priceCumulativeSlotB;
            if (pair.latestIsSlotA) {
                pairStorage.priceCumulativeSlotB = priceCumulativeCurrent;
                pairStorage.lastUpdateSlotB = blockTimestamp;
            } else {
                pairStorage.priceCumulativeSlotA = priceCumulativeCurrent;
                pairStorage.lastUpdateSlotA = blockTimestamp;
            }
            pairStorage.latestIsSlotA = !pair.latestIsSlotA;
            emit PriceUpdate(
                uniswapV2Pair,
                priceCumulativeCurrent,
                blockTimestamp,
                !pair.latestIsSlotA
            );
        } else {
            // don't update; return price using previous priceCumulative
            lastUpdateTimestamp = pair.latestIsSlotA
                ? pair.lastUpdateSlotB
                : pair.lastUpdateSlotA;
            priceCumulativeLast = pair.latestIsSlotA
                ? pair.priceCumulativeSlotB
                : pair.priceCumulativeSlotA;
        }

        T = blockTimestamp - lastUpdateTimestamp; // overflow is desired
        require(T >= MIN_T, "TarotPriceOracle: NOT_READY"); //reverts only if the pair has just been initialized
        // / is safe, and - overflow is desired
        price = toUint224((priceCumulativeCurrent - priceCumulativeLast) / T);
    }

    /*** Utilities ***/

    function getBlockTimestamp() public view returns (uint32) {
        return uint32(block.timestamp % 2**32);
    }
}

File 2 of 4 : UQ112x112.sol
pragma solidity =0.5.16;

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))

// range: [0, 2**112 - 1]
// resolution: 1 / 2**112

library UQ112x112 {
    uint224 constant Q112 = 2**112;

    // encode a uint112 as a UQ112x112
    function encode(uint112 y) internal pure returns (uint224 z) {
        z = uint224(y) * Q112; // never overflows
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
        z = x / uint224(y);
    }
}

File 3 of 4 : IUniswapV2Pair.sol
pragma solidity =0.5.16;

interface IUniswapV2Pair {
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event Transfer(address indexed from, address indexed to, uint256 value);

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        );

    function price0CumulativeLast() external view returns (uint256);

    function price1CumulativeLast() external view returns (uint256);
}

File 4 of 4 : ITarotPriceOracle.sol
pragma solidity =0.5.16;

interface ITarotPriceOracle {
    event PriceUpdate(
        address indexed pair,
        uint256 priceCumulative,
        uint32 blockTimestamp,
        bool latestIsSlotA
    );

    function MIN_T() external pure returns (uint32);

    function getPair(address uniswapV2Pair)
        external
        view
        returns (
            uint256 priceCumulativeSlotA,
            uint256 priceCumulativeSlotB,
            uint32 lastUpdateSlotA,
            uint32 lastUpdateSlotB,
            bool latestIsSlotA,
            bool initialized
        );

    function initialize(address uniswapV2Pair) external;

    function getResult(address uniswapV2Pair)
        external
        returns (uint224 price, uint32 T);

    function getBlockTimestamp() external view returns (uint32);
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"priceCumulative","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"indexed":false,"internalType":"bool","name":"latestIsSlotA","type":"bool"}],"name":"PriceUpdate","type":"event"},{"constant":true,"inputs":[],"name":"MIN_T","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBlockTimestamp","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getPair","outputs":[{"internalType":"uint256","name":"priceCumulativeSlotA","type":"uint256"},{"internalType":"uint256","name":"priceCumulativeSlotB","type":"uint256"},{"internalType":"uint32","name":"lastUpdateSlotA","type":"uint32"},{"internalType":"uint32","name":"lastUpdateSlotB","type":"uint32"},{"internalType":"bool","name":"latestIsSlotA","type":"bool"},{"internalType":"bool","name":"initialized","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"uniswapV2Pair","type":"address"}],"name":"getResult","outputs":[{"internalType":"uint224","name":"price","type":"uint224"},{"internalType":"uint32","name":"T","type":"uint32"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"uniswapV2Pair","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50610843806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631a788a021461005c578063446a37e0146100c0578063796b89b91461010e578063c4d66de81461012f578063f51b553114610157575b600080fd5b6100826004803603602081101561007257600080fd5b50356001600160a01b031661015f565b60408051968752602087019590955263ffffffff938416868601529190921660608501529015156080840152151560a0830152519081900360c00190f35b6100e6600480360360208110156100d657600080fd5b50356001600160a01b03166101a9565b604080516001600160e01b03909316835263ffffffff90911660208301528051918290030190f35b61011661046a565b6040805163ffffffff9092168252519081900360200190f35b6101556004803603602081101561014557600080fd5b50356001600160a01b0316610474565b005b6101166105a3565b60006020819052908152604090208054600182015460029092015490919063ffffffff8082169164010000000081049091169060ff600160401b8204811691600160481b90041686565b6000806101b4610771565b506001600160a01b03831660009081526020818152604091829020825160c081018452815481526001820154928101929092526002015463ffffffff808216938301939093526401000000008104909216606082015260ff600160401b8304811615156080830152600160481b909204909116151560a0820181905261026b5760405162461bcd60e51b81526004018080602001828103825260218152602001806107ee6021913960400191505060405180910390fd5b6001600160a01b03841660009081526020819052604081209061028c61046a565b9050600083608001516102a35783606001516102a9565b83604001515b905060006102b6886105a9565b905060006104b083850363ffffffff16106103ad5785608001516102de5785602001516102e1565b85515b905085608001511561031b576001850182905560028501805467ffffffff00000000191664010000000063ffffffff871602179055610336565b81855560028501805463ffffffff191663ffffffff86161790555b6080860151600286018054600160401b921592830260ff60401b199091161790556040805184815263ffffffff8716602082015280820192909252516001600160a01b038b16917fc58c63744da19faddae8e37958053493f49d71b8f78d4facf6002cd1c2618fcf919081900360600190a26103e1565b85608001516103c05785604001516103c6565b85606001515b925085608001516103d85785516103de565b85602001515b90505b82840396506104b063ffffffff88161015610443576040805162461bcd60e51b815260206004820152601b60248201527f5461726f7450726963654f7261636c653a204e4f545f52454144590000000000604482015290519081900360640190fd5b61045d8763ffffffff168284038161045757fe5b046106ee565b9750505050505050915091565b63ffffffff421690565b6001600160a01b03811660009081526020819052604090206002810154600160481b900460ff16156104d75760405162461bcd60e51b81526004018080602001828103825260258152602001806107a76025913960400191505060405180910390fd5b60006104e2836105a9565b905060006104ee61046a565b8284556001808501849055600285018054600160481b600160401b63ffffffff1990921663ffffffff861690811767ffffffff00000000191664010000000082021760ff60401b19169290921769ff0000000000000000001916179091556040805186815260208101929092528181019290925290519192506001600160a01b038616917fc58c63744da19faddae8e37958053493f49d71b8f78d4facf6002cd1c2618fcf916060908290030190a250505050565b6104b081565b6000816001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156105e457600080fd5b505afa1580156105f8573d6000803e3d6000fd5b505050506040513d602081101561060e57600080fd5b505160408051630240bc6b60e21b81529051919250600091829182916001600160a01b03871691630902f1ac916004808301926060929190829003018186803b15801561065a57600080fd5b505afa15801561066e573d6000803e3d6000fd5b505050506040513d606081101561068457600080fd5b5080516020820151604090920151909450909250905060006106be846106a98561073a565b6001600160e01b03169063ffffffff61074c16565b90506000826106cb61046a565b0390508063ffffffff16826001600160e01b031602860195505050505050919050565b60006001600160e01b038211156107365760405162461bcd60e51b81526004018080602001828103825260228152602001806107cc6022913960400191505060405180910390fd5b5090565b6001600160701b0316600160701b0290565b60006001600160701b0382166001600160e01b0384168161076957fe5b049392505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091529056fe5461726f7450726963654f7261636c653a20414c52454144595f494e495449414c495a45445461726f7450726963654f7261636c653a2055494e543232345f4f564552464c4f575461726f7450726963654f7261636c653a204e4f545f494e495449414c495a4544a265627a7a7231582062e16c5583a534a1fb33d119b88916877bd42c3e1389bb2e8dedf71193a281a164736f6c63430005100032

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
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.