Contract 0x4594DAD93eDd796454070b934a884cddDAD3F101 2

Contract Overview

Balance:
0 Ether

Token:
Txn Hash
Method
Block
From
To
Value
0xa6e6fa16fe721cf8809b55221b3cc37708a3e9b70814bea49e395a5349e97e74Advance267034432021-08-10 13:30:08328 days 11 hrs ago0x9c0790eb0f96b16ea1806e20b0d0e21a31dc93bc IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000211
0x2cf5e372a9b2c71078e41622a8690f0c30958dc885f0e6e344de939d07069141Add Proposal253785142021-06-10 4:08:40389 days 20 hrs ago0x8cd3723ba4d78db3eda4ab815b603c8db94d12b8 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000575415
0x3d4e525d54e21f5596f1ccc4a2464326794aaaaba178f06082d2c5bb167a3cfbAdd Proposal253785092021-06-10 4:08:20389 days 20 hrs ago0xfd38db32667e4521bd1a4872dbb4fbac5748ac32 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000575415
0xfffef27bddc841380e4f5679784028a17b7cc673faac86713031399f481c2e08Add Proposal253785042021-06-10 4:08:00389 days 20 hrs ago0xcd0bc89f401d3adf9073682dba194efa9745c1d2 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000575415
0xfa5aa0e29e87b8f395c05a73288b1578f4a566b442538cada77efd58b33a0544Add Proposal253784972021-06-10 4:07:32389 days 20 hrs ago0x4865f27c663f70b06b1614b021e94f68e1e1af51 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000575415
0x6628f89e251e57dc6da0bb0c929881cf62502a185b8457e64941e9cedca21c85Add Proposal253784922021-06-10 4:07:12389 days 20 hrs ago0x4acd0298e0ca92373b83d04503fb6ef6272bdb6a IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000561415
0x911ebbb90b4dc51973d08b5fdceecccb47b538582c0829fd7ca7130166d3c0b7Add Proposal253784862021-06-10 4:06:48389 days 20 hrs ago0xf5ff491cb4f832353a978c115d0e77a351ac5266 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000561415
0xc0e1d35b5270c28757d8cfc2cc06e11eb0a9592404b245b12f307bb0efedea4eAdd Proposal253784802021-06-10 4:06:24389 days 20 hrs ago0x423218edf5d054a79e028dc8e3a81b380457c288 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000561415
0x7dbb8144f569eea658fa21aaf6b67630be82fa69e25f74fca9098285621f5f64Add Proposal253784742021-06-10 4:06:00389 days 20 hrs ago0x607b25189e5c635127ae3e036f09486f6d296052 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000561415
0x646e130df2330c69eeb7e1747a131604ba38c608d18ceecce706ffc1876f856fAdd Proposal253784692021-06-10 4:05:40389 days 20 hrs ago0x1abe60e235a6bbfae04eb7dff6b281c4d2aec735 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000575415
0x5588553be1301fd7a981e45f6282606648fbbda56a99ae0a137003b67a033097Add Proposal253784632021-06-10 4:05:16389 days 20 hrs ago0x8b9344206a6fa026a3d9ec17fa7cc0e867287376 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000575355
0x8a9702a313e18591c0c350db22d02de445eba817c050068d3ffcb26919b01ae0Add Proposal253784572021-06-10 4:04:52389 days 20 hrs ago0x5325cb54d05e708cf3c135d988d5c2738ed1a89f IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.001259415
0x1dea5d1cf15ac8f824437dcd11266993d955b7482e6d20bb20b6086ac4e1808bAdd Proposal253713502021-06-09 20:10:48390 days 4 hrs ago0x1063f77e10cc5897170f9db4910a7c27b5a662fe IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.0024702222
0xb5e17b17e17de1492177f58bef482fe41d3359271cbdb56ef2b6e1695cb6be9fAdd Proposal253641422021-06-09 12:10:04390 days 12 hrs ago0xf90b901d745f2a38fd193452df849a20f6bcee36 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000060562
0xc41df66064dc77b1cff9a824becadd83adb52486c894d86a79941661c944b355Add Proposal253639812021-06-09 11:59:20390 days 12 hrs ago0x69747c307a622ead4be5d78fe95bf7a4fc3394fb IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.0002241510
0xd6ff2858c034827defad58b4a30b406e028a6270ce0d88a9c66b50b8f82b3f09Add Proposal253639812021-06-09 11:59:20390 days 12 hrs ago0x69747c307a622ead4be5d78fe95bf7a4fc3394fb IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000044832
0x6531066836b56fb962ef49c218028c1c70cc69f92d38ca42e141c9afb9a06a04Advance253626012021-06-09 10:27:20390 days 14 hrs ago0x1e4d3ad00405a88fa16178a9c3350ebdbdc73027 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.015304752
0x13e7a4a48b836adfc4d6034240369d145fbcdb290315e69fa75504f3f7ef9587Add Proposal253623792021-06-09 10:12:32390 days 14 hrs ago0x15e9c6edb70aaf23195d31ecccc07308506161be IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000230162
0xf37ebe92219d10ff7cbb6848f6a0c3c39d1d9fbc6c4528a69e8b744614709a96Claim Reward253623512021-06-09 10:10:40390 days 14 hrs ago0x15e9c6edb70aaf23195d31ecccc07308506161be IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000088922
0xc81e057174e3e5df882426b9dd569e7d5dbb8c20e39f3d5ff23e7756b7c8745cClaim Reward253623392021-06-09 10:09:52390 days 14 hrs ago0x15e9c6edb70aaf23195d31ecccc07308506161be IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000088922
0x1b16d3dd5d500200b230d472a00569c722d2d091a78c53167adb2246b74bae83Claim Reward253520292021-06-08 22:42:08391 days 2 hrs ago0x22f6edb55790b0fe841c5ba9aa30792ebcb55863 IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000088922
0x0d0203678f8c1c3e08cf1893d6f8624ddec05ee5b4719ff2f37f223d87a50e92Claim Reward253520222021-06-08 22:41:40391 days 2 hrs ago0xa8ebe6dcda66bb74a8db994554d2ad277cb54ada IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000122022
0x2a2ae2e3b0a06f707f7ac0b5c23dc78c998e79fe94c015ec9008e1ec9da22e52Add Proposal253499522021-06-08 20:23:16391 days 4 hrs ago0x255bfed9f89714cb2fbb9c6905c8ab7e1e806d6e IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000230162
0xcbd8477e01efd6622b8982a4af0db78fb8df5582e73d78943e551216955f3c40Add Proposal253499502021-06-08 20:23:08391 days 4 hrs ago0x255bfed9f89714cb2fbb9c6905c8ab7e1e806d6e IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000503762
0xfe589e4586549fc02f41381c8ceb1288cf233340d1f8f704d4be57d7986d37e7Claim Reward253498892021-06-08 20:19:04391 days 4 hrs ago0x255bfed9f89714cb2fbb9c6905c8ab7e1e806d6e IN  0x4594dad93edd796454070b934a884cdddad3f1010 Ether0.000088922
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x2cf5e372a9b2c71078e41622a8690f0c30958dc885f0e6e344de939d07069141253785142021-06-10 4:08:40389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x3d4e525d54e21f5596f1ccc4a2464326794aaaaba178f06082d2c5bb167a3cfb253785092021-06-10 4:08:20389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xfffef27bddc841380e4f5679784028a17b7cc673faac86713031399f481c2e08253785042021-06-10 4:08:00389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xfa5aa0e29e87b8f395c05a73288b1578f4a566b442538cada77efd58b33a0544253784972021-06-10 4:07:32389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x6628f89e251e57dc6da0bb0c929881cf62502a185b8457e64941e9cedca21c85253784922021-06-10 4:07:12389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x911ebbb90b4dc51973d08b5fdceecccb47b538582c0829fd7ca7130166d3c0b7253784862021-06-10 4:06:48389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xc0e1d35b5270c28757d8cfc2cc06e11eb0a9592404b245b12f307bb0efedea4e253784802021-06-10 4:06:24389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x7dbb8144f569eea658fa21aaf6b67630be82fa69e25f74fca9098285621f5f64253784742021-06-10 4:06:00389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x646e130df2330c69eeb7e1747a131604ba38c608d18ceecce706ffc1876f856f253784692021-06-10 4:05:40389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x5588553be1301fd7a981e45f6282606648fbbda56a99ae0a137003b67a033097253784632021-06-10 4:05:16389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x8a9702a313e18591c0c350db22d02de445eba817c050068d3ffcb26919b01ae0253784572021-06-10 4:04:52389 days 20 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x1dea5d1cf15ac8f824437dcd11266993d955b7482e6d20bb20b6086ac4e1808b253713502021-06-09 20:10:48390 days 4 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xb5e17b17e17de1492177f58bef482fe41d3359271cbdb56ef2b6e1695cb6be9f253641422021-06-09 12:10:04390 days 12 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x6531066836b56fb962ef49c218028c1c70cc69f92d38ca42e141c9afb9a06a04253626012021-06-09 10:27:20390 days 14 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0xcec12cbce90dfaf9a09390c3d6c75a8bd80d648b0 Ether
0x13e7a4a48b836adfc4d6034240369d145fbcdb290315e69fa75504f3f7ef9587253623792021-06-09 10:12:32390 days 14 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xf37ebe92219d10ff7cbb6848f6a0c3c39d1d9fbc6c4528a69e8b744614709a96253623512021-06-09 10:10:40390 days 14 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xc81e057174e3e5df882426b9dd569e7d5dbb8c20e39f3d5ff23e7756b7c8745c253623392021-06-09 10:09:52390 days 14 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x1b16d3dd5d500200b230d472a00569c722d2d091a78c53167adb2246b74bae83253520292021-06-08 22:42:08391 days 2 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x0d0203678f8c1c3e08cf1893d6f8624ddec05ee5b4719ff2f37f223d87a50e92253520222021-06-08 22:41:40391 days 2 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x2a2ae2e3b0a06f707f7ac0b5c23dc78c998e79fe94c015ec9008e1ec9da22e52253499522021-06-08 20:23:16391 days 4 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xcbd8477e01efd6622b8982a4af0db78fb8df5582e73d78943e551216955f3c40253499502021-06-08 20:23:08391 days 4 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xfe589e4586549fc02f41381c8ceb1288cf233340d1f8f704d4be57d7986d37e7253498892021-06-08 20:19:04391 days 4 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0x35944ef3e02396e1a74a854dbea27e3728db5c5215146d074c240661c02703fa253471242021-06-08 17:14:44391 days 7 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0xcec12cbce90dfaf9a09390c3d6c75a8bd80d648b0 Ether
0x3fc3c8db3f1040a9d16240f2fd8cd310e23d767528e3aa015cbf751eab761bcf253470922021-06-08 17:12:36391 days 7 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0x400f470d493110473113123c4754208ed91985a30 Ether
0xb10683e178c6443bccc432fcb4bdb6a4d3050328cd846e3e446d42c301d10f0a253463462021-06-08 16:22:52391 days 8 hrs ago 0x4594dad93edd796454070b934a884cdddad3f101 0xcec12cbce90dfaf9a09390c3d6c75a8bd80d648b0 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AloeV100Prediction

Compiler Version
v0.8.3+commit.8d00100c

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 16 : AloeV100Prediction.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';

import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol';

import './libraries/Equations.sol';
import './libraries/FullMath.sol';
import './libraries/TickMath.sol';
import './libraries/UINT512.sol';

import './interfaces/IAloeV100PredictionEvents.sol';

contract AloeV100Prediction is IAloeV100PredictionEvents {
    using SafeERC20 for IERC20;

    using UINT512Math for UINT512;

    uint256 private constant TWO_144 = 2**144;
    uint256 private constant TWO_80 = 2**80;

    IERC20 public immutable ALOE;

    address public immutable UNI_POOL;

    struct Accumulators {
        uint16 proposalCount;
        uint80 stakeTotal;
        uint256 stake1stMomentRaw;
        uint256 sumOfLowerBounds;
        uint256 sumOfLowerBoundsWeighted;
        uint256 sumOfUpperBounds;
        uint256 sumOfUpperBoundsWeighted;
        UINT512 sumOfSquaredBounds;
        UINT512 sumOfSquaredBoundsWeighted;
    }

    struct Proposal {
        // The address that submitted the proposal
        address source;
        // Q128.48 price at tickLower of proposed Uniswap position
        uint176 lower;
        // Q128.48 price at tickUpper of proposed Uniswap position
        uint176 upper;
        // The amount of ALOE staked; fits in uint80 because max supply is 1000000 with 18 decimals
        uint80 stake;
    }

    struct Bounds {
        // Q128.48 price at tickLower of proposed Uniswap position
        uint176 lower;
        // Q128.48 price at tickUpper of proposed Uniswap position
        uint176 upper;
    }

    struct EpochSummary {
        Bounds groundTruth;
        Bounds aggregate;
        Accumulators accumulators;
        Proposal[] proposals;
    }

    Accumulators public accumulators;

    Proposal[] public proposals;

    bool public shouldUseReciprocal;

    uint256 public epoch = 0;

    mapping(uint256 => EpochSummary) public summaries;

    constructor(IERC20 _ALOE, address _UNI_POOL) {
        ALOE = _ALOE;
        UNI_POOL = _UNI_POOL;

        // Ensure we have an hour of data, assuming Uniswap interaction every 10 seconds
        IUniswapV3Pool(_UNI_POOL).increaseObservationCardinalityNext(360);
    }

    function epochTime() public view returns (uint256) {
        return (block.timestamp - 1621814400) / 3600;
    }

    function advance() external {
        require(epoch != epochTime());

        EpochSummary storage summary = summaries[epoch];
        summary.aggregate = aggregate();
        summary.accumulators = accumulators;
        summary.proposals = proposals;
        summaries[epoch] = summary;

        if (epoch != 0) {
            summaries[epoch - 1].groundTruth = fetchGroundTruth();
        }

        epoch++;
        delete accumulators;

        emit Advanced(epoch);
    }

    function current() external view returns (Bounds memory) {
        require(epoch != 0, 'Aloe: No data yet');
        return summaries[epoch - 1].aggregate;
    }

    function accumulate(
        uint80 stake,
        uint176 lower,
        uint176 upper
    ) private {
        unchecked {
            accumulators.stakeTotal += stake;
            accumulators.stake1stMomentRaw += uint256(stake) * uint256((lower + upper) >> 1);
            accumulators.sumOfLowerBounds += lower;
            accumulators.sumOfUpperBounds += upper;
            accumulators.sumOfLowerBoundsWeighted += uint256(stake) * uint256(lower);
            accumulators.sumOfUpperBoundsWeighted += uint256(stake) * uint256(upper);

            (uint256 LS0, uint256 MS0, uint256 LS1, uint256 MS1) = Equations.eqn0(stake, lower, upper);

            // update each storage slot only once
            accumulators.sumOfSquaredBounds.iadd(LS0, MS0);
            accumulators.sumOfSquaredBoundsWeighted.iadd(LS1, MS1 + MS0 * stake);
        }
    }

    function unaccumulate(
        uint80 stake,
        uint176 lower,
        uint176 upper
    ) private {
        unchecked {
            accumulators.stakeTotal -= stake;
            accumulators.stake1stMomentRaw -= uint256(stake) * uint256((lower + upper) >> 1);
            accumulators.sumOfLowerBounds -= lower;
            accumulators.sumOfUpperBounds -= upper;
            accumulators.sumOfLowerBoundsWeighted -= uint256(stake) * uint256(lower);
            accumulators.sumOfUpperBoundsWeighted -= uint256(stake) * uint256(upper);

            (uint256 LS0, uint256 MS0, uint256 LS1, uint256 MS1) = Equations.eqn0(stake, lower, upper);

            // update each storage slot only once
            accumulators.sumOfSquaredBounds.isub(LS0, MS0);
            accumulators.sumOfSquaredBoundsWeighted.isub(LS1, MS1 + MS0 * stake);
        }
    }

    /**
     * `lower` and `upper` are Q128.48, uint176
     *
     * This means that (after square-rooting), they produce sqrtPriceX96 values in range
     *      [2 ** +72, 2 ** +160]
     * This corresponds to floating point range
     *      [2 ** -24, 2 ** +64]
     *
     * When scoring a round, this contract will check if the TWAP of sqrtPriceX96 < 2 ** +80.
     * If it is, then proposals' lower & upper bounds in the _next_ round should be submitted
     * as the price of token1 : token0 rather than token0 : token1.
     *
     */
    function addProposal(
        uint80 stake,
        uint176 lower,
        uint176 upper
    ) external returns (uint16 idx) {
        require(stake != 0, 'Aloe: Need stake');
        require(lower < upper, 'Aloe: Impossible bounds');
        require(accumulators.proposalCount < type(uint16).max, 'Aloe: Too many stakers');
        require(ALOE.transferFrom(msg.sender, address(this), stake), 'Aloe: Provide ALOE');

        Proposal memory proposal = Proposal(msg.sender, lower, upper, stake);

        idx = accumulators.proposalCount;
        if (idx < proposals.length) {
            proposals[idx] = proposal;
        } else {
            proposals.push(proposal);
        }

        accumulators.proposalCount++;
        accumulate(stake, lower, upper);

        emit ProposalAdded(epoch, msg.sender, idx, lower, upper, stake);
    }

    function updateProposal(
        uint80 stake,
        uint176 lower,
        uint176 upper,
        uint16 idx
    ) external {
        require(stake != 0, 'Aloe: Need stake');
        require(lower < upper, 'Aloe: Impossible bounds');
        require(idx < accumulators.proposalCount, 'Aloe: idx too high');
        require(msg.sender == proposals[idx].source, 'Aloe: not yours');

        Proposal storage proposal = proposals[idx];

        if (stake > proposal.stake) {
            require(ALOE.transferFrom(msg.sender, address(this), stake - proposal.stake), 'Aloe: Provide ALOE');
        } else if (stake < proposal.stake) {
            require(ALOE.transfer(msg.sender, proposal.stake - stake), 'Aloe: Failed ALOE refund');
        }

        unaccumulate(proposal.stake, proposal.lower, proposal.upper);
        proposal.stake = stake;
        proposal.lower = lower;
        proposal.upper = upper;
        accumulate(stake, lower, upper);

        emit ProposalUpdated(epoch, msg.sender, idx, lower, upper, stake);
    }

    function getProposal(uint256 inEpoch, uint16 idx) external view returns (Proposal memory) {
        return summaries[inEpoch].proposals[idx];
    }

    function claimReward(uint256 inEpoch, uint16 idx) external {
        EpochSummary storage summary = summaries[inEpoch];
        require(summary.groundTruth.lower != 0, 'Aloe: need ground truth');
        require(summary.groundTruth.upper != 0, 'Aloe: need ground truth');
        require(idx < summary.accumulators.proposalCount, 'Aloe: idx nonexistent');

        Proposal storage proposal = summaries[inEpoch].proposals[idx];
        require(proposal.stake != 0, 'Aloe: already claimed');

        if (summary.accumulators.proposalCount == 1) {
            require(ALOE.transfer(proposal.source, proposal.stake), 'Aloe: failed to reward');
            emit ClaimedReward(proposal.source, idx, inEpoch, proposal.stake);
            delete summary.proposals[idx];
        }

        uint256 lowerError =
            proposal.lower > summary.groundTruth.lower
                ? proposal.lower - summary.groundTruth.lower
                : summary.groundTruth.lower - proposal.lower;
        uint256 upperError =
            proposal.upper > summary.groundTruth.upper
                ? proposal.upper - summary.groundTruth.upper
                : summary.groundTruth.upper - proposal.upper;

        UINT512 memory sumOfSquaredErrors =
            Equations.eqn1(
                summary.accumulators.sumOfSquaredBounds,
                summary.accumulators.sumOfLowerBounds,
                summary.accumulators.sumOfUpperBounds,
                summary.accumulators.proposalCount,
                summary.groundTruth.lower,
                summary.groundTruth.upper
            );
        UINT512 memory sumOfSquaredErrorsWeighted =
            Equations.eqn1(
                summary.accumulators.sumOfSquaredBoundsWeighted,
                summary.accumulators.sumOfLowerBoundsWeighted,
                summary.accumulators.sumOfUpperBoundsWeighted,
                summary.accumulators.stakeTotal,
                summary.groundTruth.lower,
                summary.groundTruth.upper
            );

        UINT512 memory temp;

        // Compute reward numerator
        UINT512 memory numer = UINT512(sumOfSquaredErrors.LS, sumOfSquaredErrors.MS);
        // --> Subtract current proposal's squared error
        (temp.LS, temp.MS) = FullMath.square512(lowerError);
        (numer.LS, numer.MS) = numer.sub(temp.LS, temp.MS);
        (temp.LS, temp.MS) = FullMath.square512(upperError);
        (numer.LS, numer.MS) = numer.sub(temp.LS, temp.MS);
        // --> Weight entire numerator by proposal's stake
        (numer.LS, numer.MS) = numer.muls(proposal.stake);

        // Compute reward denominator
        UINT512 memory denom = UINT512(sumOfSquaredErrors.LS, sumOfSquaredErrors.MS);
        // --> Scale this initial term by total stake
        (denom.LS, denom.MS) = denom.muls(summary.accumulators.stakeTotal);
        // --> Subtract sum of all weighted squared errors
        (denom.LS, denom.MS) = denom.sub(sumOfSquaredErrorsWeighted.LS, sumOfSquaredErrorsWeighted.MS);

        // Now our 4 key numbers are available: numerLS, numerMS, denomLS, denomMS
        uint256 reward;
        if (denom.MS == 0) {
            // If denominator MS is 0, then numerator MS is 0 as well.
            // This simplifies things substantially:
            reward = FullMath.mulDiv(summary.accumulators.stakeTotal, numer.LS, denom.LS);
        } else {
            if (numer.LS != 0) {
                reward = 257 + FullMath.log2floor(denom.MS) - FullMath.log2floor(numer.LS);
                reward = reward < 80 ? summary.accumulators.stakeTotal / (2**reward) : 0;
            }
            if (numer.MS != 0) {
                reward += FullMath.mulDiv(
                    summary.accumulators.stakeTotal,
                    TWO_80 * numer.MS,
                    TWO_80 * denom.MS + FullMath.mulDiv(TWO_80, denom.LS, type(uint256).max)
                );
            }
        }

        require(ALOE.transfer(proposal.source, reward), 'Aloe: failed to reward');
        emit ClaimedReward(proposal.source, idx, inEpoch, reward);
        delete summary.proposals[idx];
    }

    function aggregate() public view returns (Bounds memory bounds) {
        require(accumulators.stakeTotal != 0, 'Aloe: No proposals with stake');

        uint176 mean = uint176(accumulators.stake1stMomentRaw / accumulators.stakeTotal);
        uint256 stake1stMomentRawLower;
        uint256 stake1stMomentRawUpper;
        uint176 stake2ndMomentNormLower;
        uint176 stake2ndMomentNormUpper;
        uint16 i;

        unchecked {
            for (i = 0; i < accumulators.proposalCount; i++) {
                Proposal storage proposal = proposals[i];
                if (proposal.stake == 0) continue;

                if ((proposal.lower < mean) && proposal.upper < mean) {
                    // Proposal is entirely below the mean
                    stake1stMomentRawLower += uint256(proposal.stake) * uint256(proposal.upper - proposal.lower);
                } else if (proposal.lower < mean) {
                    // Proposal includes the mean
                    stake1stMomentRawLower += uint256(proposal.stake) * uint256(mean - proposal.lower);
                    stake1stMomentRawUpper += uint256(proposal.stake) * uint256(proposal.upper - mean);
                } else {
                    // Proposal is entirely above the mean
                    stake1stMomentRawUpper += uint256(proposal.stake) * uint256(proposal.upper - proposal.lower);
                }
            }

            for (i = 0; i < accumulators.proposalCount; i++) {
                Proposal storage proposal = proposals[i];
                if (proposal.stake == 0) continue;

                if ((proposal.lower < mean) && proposal.upper < mean) {
                    // Proposal is entirely below the mean
                    // b = mean - proposal.lower
                    // a = mean - proposal.upper
                    // b**2 - a**2 = (b-a)(b+a) = (proposal.upper - proposal.lower)(2*mean - proposal.upper - proposal.lower)
                    //      = 2 * (proposalSpread)(mean - proposalCenter)

                    // These fit in uint176, using uint256 to avoid phantom overflow later on
                    uint256 proposalCenter = (uint184(proposal.lower) + uint184(proposal.upper)) / 2;
                    uint256 proposalSpread = proposal.upper - proposal.lower;

                    stake2ndMomentNormLower += uint176(
                        FullMath.mulDiv(
                            uint256(proposal.stake) * proposalSpread,
                            mean - proposalCenter,
                            stake1stMomentRawLower
                        )
                    );
                } else if (proposal.lower < mean) {
                    // Proposal includes the mean

                    // These fit in uint176, using uint256 to avoid phantom overflow later on
                    uint256 diffLower = mean - proposal.lower;
                    uint256 diffUpper = proposal.upper - mean;

                    stake2ndMomentNormLower += uint176(
                        FullMath.mulDiv(uint256(proposal.stake) * diffLower, diffLower, 2 * stake1stMomentRawLower)
                    );
                    stake2ndMomentNormUpper += uint176(
                        FullMath.mulDiv(uint256(proposal.stake) * diffUpper, diffUpper, 2 * stake1stMomentRawUpper)
                    );
                } else {
                    // Proposal is entirely above the mean
                    // b = proposal.upper - mean
                    // a = proposal.lower - mean
                    // b**2 - a**2 = (b-a)(b+a) = (proposal.upper - proposal.lower)(proposal.upper + proposal.lower - 2*mean)
                    //      = 2 * (proposalSpread)(proposalCenter - mean)

                    // These fit in uint176, using uint256 to avoid phantom overflow later on
                    uint256 proposalCenter = (uint184(proposal.lower) + uint184(proposal.upper)) / 2;
                    uint256 proposalSpread = proposal.upper - proposal.lower;

                    stake2ndMomentNormUpper += uint176(
                        FullMath.mulDiv(
                            uint256(proposal.stake) * proposalSpread,
                            proposalCenter - mean,
                            stake1stMomentRawUpper
                        )
                    );
                }
            }
        }

        bounds.lower = mean - stake2ndMomentNormLower;
        bounds.upper = mean + stake2ndMomentNormUpper;
    }

    function fetchGroundTruth() private returns (Bounds memory bounds) {
        uint32[] memory secondsAgos = new uint32[](10);
        secondsAgos[0] = 3600;
        secondsAgos[1] = 3240;
        secondsAgos[2] = 2880;
        secondsAgos[3] = 2520;
        secondsAgos[4] = 2160;
        secondsAgos[5] = 1800;
        secondsAgos[6] = 1440;
        secondsAgos[7] = 1080;
        secondsAgos[8] = 720;
        secondsAgos[9] = 360;

        (int56[] memory tickCumulatives, ) = IUniswapV3PoolDerivedState(UNI_POOL).observe(secondsAgos);

        // Compute the mean price over the entire 54 minute period
        uint160 meanSqrtRatio = TickMath.getSqrtRatioAtTick(int24((tickCumulatives[9] - tickCumulatives[0]) / 3240));
        if (shouldUseReciprocal) {
            shouldUseReciprocal = meanSqrtRatio < TWO_80;
            meanSqrtRatio = type(uint160).max / meanSqrtRatio;
        } else {
            shouldUseReciprocal = meanSqrtRatio < TWO_80;
        }
        uint176 mean = uint176(FullMath.mulDiv(meanSqrtRatio, meanSqrtRatio, TWO_144));

        uint184 numeratorMAD; // Mean Absolute Deviation (but we're not dividing by num samples yet)

        for (uint8 i = 0; i < 9; i++) {
            // Compute the mean price over a 6 minute period
            uint160 sampleSqrtRatio =
                TickMath.getSqrtRatioAtTick(int24((tickCumulatives[i + 1] - tickCumulatives[i]) / 360));
            if (shouldUseReciprocal) {
                sampleSqrtRatio = type(uint160).max / meanSqrtRatio;
            }
            uint176 sample = uint176(FullMath.mulDiv(sampleSqrtRatio, sampleSqrtRatio, TWO_144));

            // Accumulate
            numeratorMAD += sample > mean ? sample - mean : mean - sample;
        }

        // MAD = numeratorMAD / n, here n = 9
        // STD = MAD * sqrt(2/pi) for a normal distribution
        uint176 std = uint176((numeratorMAD * 79788) / 900000);
        // this looks complicated because of casting, but it's just mean +/- 2*std
        bounds.lower = uint184(mean) > 2 * uint184(std) ? uint176(uint184(mean) - 2 * uint184(std)) : 0;
        bounds.upper = uint184(mean) + 2 * uint184(std) > type(uint176).max
            ? type(uint176).max
            : uint176(uint184(mean) + 2 * uint184(std));

        emit FetchedGroundTruth(bounds.lower, bounds.upper, shouldUseReciprocal);
    }
}

File 2 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @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);
}

File 3 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 16 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import './pool/IUniswapV3PoolImmutables.sol';
import './pool/IUniswapV3PoolState.sol';
import './pool/IUniswapV3PoolDerivedState.sol';
import './pool/IUniswapV3PoolActions.sol';
import './pool/IUniswapV3PoolOwnerActions.sol';
import './pool/IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolEvents
{

}

File 5 of 16 : IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 6 of 16 : Equations.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import './UINT512.sol';

library Equations {
    using UINT512Math for UINT512;

    /// @dev Computes both raw (LS0, MS0) and weighted (LS1, MS1) squared bounds for a proposal
    function eqn0(
        uint80 stake,
        uint176 lower,
        uint176 upper
    )
        internal
        pure
        returns (
            uint256 LS0,
            uint256 MS0,
            uint256 LS1,
            uint256 MS1
        )
    {
        // square each bound
        (LS0, MS0) = FullMath.square512(lower);
        (LS1, MS1) = FullMath.square512(upper);
        // add squared bounds together
        LS0 = (LS0 >> 1) + (LS1 >> 1);
        (LS0, LS1) = FullMath.mul512(LS0, 2); // LS1 is now a carry bit
        MS0 += MS1 + LS1;
        // multiply least-significant bits by stake.
        // most-significant bits are dealt with later, without fear of overflow
        (LS1, MS1) = FullMath.mul512(LS0, stake);
    }

    /**
     * a: either sumOfSquaredBounds or sumOfSquaredBoundsWeighted
     * b: either sumOfLowerBounds or sumOfLowerBoundsWeighted
     * c: either sumOfUpperBounds or sumOfUpperBoundsWeighted
     * d: either proposalCount or stakeTotal
     * lowerTrue: groundTruth.lower
     * upperTrue: groundTruth.upper
     */
    function eqn1(UINT512 memory a, uint256 b, uint256 c, uint256 d, uint256 lowerTrue, uint256 upperTrue) internal pure returns (UINT512 memory) {
        UINT512 memory temp;

        (temp.LS, temp.MS) = FullMath.mul512(d * lowerTrue, lowerTrue);
        (a.LS, a.MS) = a.add(temp.LS, temp.MS);

        (temp.LS, temp.MS) = FullMath.mul512(d * upperTrue, upperTrue);
        (a.LS, a.MS) = a.add(temp.LS, temp.MS);

        (temp.LS, temp.MS) = FullMath.mul512(b, lowerTrue << 1);
        (a.LS, a.MS) = a.sub(temp.LS, temp.MS);

        (temp.LS, temp.MS) = FullMath.mul512(c, upperTrue << 1);
        (a.LS, a.MS) = a.sub(temp.LS, temp.MS);

        return a;
    }
}

File 7 of 16 : FullMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0;

/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = a * b
            // Compute the product mod 2**256 and mod 2**256 - 1
            // then use the Chinese Remainder Theorem to reconstruct
            // the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2**256 + prod0
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(a, b, not(0))
                prod0 := mul(a, b)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division
            if (prod1 == 0) {
                require(denominator > 0);
                assembly {
                    result := div(prod0, denominator)
                }
                return result;
            }

            // Make sure the result is less than 2**256.
            // Also prevents denominator == 0
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0]
            // Compute remainder using mulmod
            uint256 remainder;
            assembly {
                remainder := mulmod(a, b, denominator)
            }
            // Subtract 256 bit number from 512 bit number
            assembly {
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator
            // Compute largest power of two divisor of denominator.
            // Always >= 1.
            // https://ethereum.stackexchange.com/a/96646
            uint256 twos = denominator & (~denominator + 1);
            // Divide denominator by power of two
            assembly {
                denominator := div(denominator, twos)
            }

            // Divide [prod1 prod0] by the factors of two
            assembly {
                prod0 := div(prod0, twos)
            }
            // Shift in bits from prod1 into prod0. For this we need
            // to flip `twos` such that it is 2**256 / twos.
            // If twos is zero, then it becomes one
            assembly {
                twos := add(div(sub(0, twos), twos), 1)
            }
            prod0 |= prod1 * twos;

            // Invert denominator mod 2**256
            // Now that denominator is an odd number, it has an inverse
            // modulo 2**256 such that denominator * inv = 1 mod 2**256.
            // Compute the inverse by starting with a seed that is correct
            // correct for four bits. That is, denominator * inv = 1 mod 2**4
            uint256 inv = (3 * denominator) ^ 2;
            // Now use Newton-Raphson iteration to improve the precision.
            // Thanks to Hensel's lifting lemma, this also works in modular
            // arithmetic, doubling the correct bits in each step.
            inv *= 2 - denominator * inv; // inverse mod 2**8
            inv *= 2 - denominator * inv; // inverse mod 2**16
            inv *= 2 - denominator * inv; // inverse mod 2**32
            inv *= 2 - denominator * inv; // inverse mod 2**64
            inv *= 2 - denominator * inv; // inverse mod 2**128
            inv *= 2 - denominator * inv; // inverse mod 2**256

            // Because the division is now exact we can divide by multiplying
            // with the modular inverse of denominator. This will give us the
            // correct result modulo 2**256. Since the precoditions guarantee
            // that the outcome is less than 2**256, this is the final result.
            // We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inv;
            return result;
        }
    }

    /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    function mulDivRoundingUp(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        result = mulDiv(a, b, denominator);
        if (mulmod(a, b, denominator) > 0) {
            require(result < type(uint256).max);
            result++;
        }
    }

    /// https://medium.com/wicketh/mathemagic-full-multiply-27650fec525d
    function mul512(uint256 a, uint256 b) internal pure returns (uint256 r0, uint256 r1) {
        assembly {
            let mm := mulmod(a, b, not(0))
            r0 := mul(a, b)
            r1 := sub(sub(mm, r0), lt(mm, r0))
        }
    }

    function square512(uint256 a) internal pure returns (uint256 r0, uint256 r1) {
        assembly {
            let mm := mulmod(a, a, not(0))
            r0 := mul(a, a)
            r1 := sub(sub(mm, r0), lt(mm, r0))
        }
    }

    // https://github.com/hifi-finance/prb-math/blob/main/contracts/PRBMathCommon.sol
    function log2floor(uint256 x) internal pure returns (uint256 msb) {
        unchecked {
            if (x >= 2**128) {
                x >>= 128;
                msb += 128;
            }
            if (x >= 2**64) {
                x >>= 64;
                msb += 64;
            }
            if (x >= 2**32) {
                x >>= 32;
                msb += 32;
            }
            if (x >= 2**16) {
                x >>= 16;
                msb += 16;
            }
            if (x >= 2**8) {
                x >>= 8;
                msb += 8;
            }
            if (x >= 2**4) {
                x >>= 4;
                msb += 4;
            }
            if (x >= 2**2) {
                x >>= 2;
                msb += 2;
            }
            if (x >= 2**1) {
                // No need to shift x any more.
                msb += 1;
            }
        }
    }

    // https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn
    function log2ceil(uint256 x) internal pure returns (uint256 y) {
        assembly {
            let arg := x
            x := sub(x, 1)
            x := or(x, div(x, 0x02))
            x := or(x, div(x, 0x04))
            x := or(x, div(x, 0x10))
            x := or(x, div(x, 0x100))
            x := or(x, div(x, 0x10000))
            x := or(x, div(x, 0x100000000))
            x := or(x, div(x, 0x10000000000000000))
            x := or(x, div(x, 0x100000000000000000000000000000000))
            x := add(x, 1)
            let m := mload(0x40)
            mstore(m, 0xf8f9cbfae6cc78fbefe7cdc3a1793dfcf4f0e8bbd8cec470b6a28a7a5a3e1efd)
            mstore(add(m, 0x20), 0xf5ecf1b3e9debc68e1d9cfabc5997135bfb7a7a3938b7b606b5b4b3f2f1f0ffe)
            mstore(add(m, 0x40), 0xf6e4ed9ff2d6b458eadcdf97bd91692de2d4da8fd2d0ac50c6ae9a8272523616)
            mstore(add(m, 0x60), 0xc8c0b887b0a8a4489c948c7f847c6125746c645c544c444038302820181008ff)
            mstore(add(m, 0x80), 0xf7cae577eec2a03cf3bad76fb589591debb2dd67e0aa9834bea6925f6a4a2e0e)
            mstore(add(m, 0xa0), 0xe39ed557db96902cd38ed14fad815115c786af479b7e83247363534337271707)
            mstore(add(m, 0xc0), 0xc976c13bb96e881cb166a933a55e490d9d56952b8d4e801485467d2362422606)
            mstore(add(m, 0xe0), 0x753a6d1b65325d0c552a4d1345224105391a310b29122104190a110309020100)
            mstore(0x40, add(m, 0x100))
            let magic := 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff
            let shift := 0x100000000000000000000000000000000000000000000000000000000000000
            let a := div(mul(x, magic), shift)
            y := div(mload(add(m, sub(255, a))), shift)
            y := add(y, mul(256, gt(arg, 0x8000000000000000000000000000000000000000000000000000000000000000)))
        }
    }
}

File 8 of 16 : TickMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
        require(absTick <= uint256(uint24(MAX_TICK)), 'T');

        uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
        if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
        if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
        if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
        if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
        if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
        if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
        if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
        if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
        if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
        if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
        if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
        if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
        if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
        if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
        if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
        if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
        if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
        if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
        if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

        if (tick > 0) ratio = type(uint256).max / ratio;

        // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
        // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
        // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
        sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
    }

    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
    /// ever return.
    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
    function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
        // second inequality must be < because the price can never reach the price at the max tick
        require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');
        uint256 ratio = uint256(sqrtPriceX96) << 32;

        uint256 r = ratio;
        uint256 msb = 0;

        assembly {
            let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(5, gt(r, 0xFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(4, gt(r, 0xFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(3, gt(r, 0xFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(2, gt(r, 0xF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(1, gt(r, 0x3))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := gt(r, 0x1)
            msb := or(msb, f)
        }

        if (msb >= 128) r = ratio >> (msb - 127);
        else r = ratio << (127 - msb);

        int256 log_2 = (int256(msb) - 128) << 64;

        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(63, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(62, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(61, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(60, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(59, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(58, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(57, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(56, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(55, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(54, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(53, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(52, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(51, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(50, f))
        }

        int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

        int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
        int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);

        tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
    }
}

File 9 of 16 : UINT512.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import './FullMath.sol';

struct UINT512 {
    // Least significant bits
    uint256 LS;
    // Most significant bits
    uint256 MS;
}

library UINT512Math {
    /// @dev Adds an (LS, MS) pair in place. Assumes result fits in uint512
    function iadd(
        UINT512 storage self,
        uint256 LS,
        uint256 MS
    ) internal {
        unchecked {
            if (self.LS > type(uint256).max - LS) {
                self.LS = addmod(self.LS, LS, type(uint256).max);
                self.MS += 1 + MS;
            } else {
                self.LS += LS;
                self.MS += MS;
            }
        }
    }

    /// @dev Adds an (LS, MS) pair to self. Assumes result fits in uint512
    function add(
        UINT512 memory self,
        uint256 LS,
        uint256 MS
    ) internal pure returns (uint256, uint256) {
        unchecked {
            return
                (self.LS > type(uint256).max - LS)
                    ? (addmod(self.LS, LS, type(uint256).max), self.MS + MS + 1)
                    : (self.LS + LS, self.MS + MS);
        }
    }

    /// @dev Subtracts an (LS, MS) pair in place. Assumes result > 0
    function isub(
        UINT512 storage self,
        uint256 LS,
        uint256 MS
    ) internal {
        unchecked {
            if (self.LS < LS) {
                self.LS = type(uint256).max + self.LS - LS;
                self.MS -= 1 + MS;
            } else {
                self.LS -= LS;
                self.MS -= MS;
            }
        }
    }

    /// @dev Subtracts an (LS, MS) pair from self. Assumes result > 0
    function sub(
        UINT512 memory self,
        uint256 LS,
        uint256 MS
    ) internal pure returns (uint256, uint256) {
        unchecked {
            return (self.LS < LS) ? (type(uint256).max + self.LS - LS, self.MS - MS - 1) : (self.LS - LS, self.MS - MS);
        }
    }

    function muls(UINT512 memory self, uint256 s) internal pure returns (uint256, uint256) {
        unchecked {
            self.MS *= s;
            (self.LS, s) = FullMath.mul512(self.LS, s);
            return (self.LS, self.MS + s);
        }
    }
}

File 10 of 16 : IAloeV100PredictionEvents.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IAloeV100PredictionEvents {
    event ProposalAdded(
        uint256 indexed epoch,
        address indexed source,
        uint16 idx,
        uint176 lower,
        uint176 upper,
        uint80 stake
    );

    event ProposalUpdated(
        uint256 indexed epoch,
        address indexed source,
        uint16 idx,
        uint176 lower,
        uint176 upper,
        uint80 stake
    );

    event FetchedGroundTruth(
        uint176 lower,
        uint176 upper,
        bool shouldUseReciprocalNextRound
    );

    event Advanced(
        uint256 epoch
    );

    event ClaimedReward(
        address indexed recipient,
        uint16 idx,
        uint256 epoch,
        uint256 amount
    );
}

File 11 of 16 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 12 of 16 : IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 13 of 16 : IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 14 of 16 : IUniswapV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 15 of 16 : IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

File 16 of 16 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

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

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_ALOE","type":"address"},{"internalType":"address","name":"_UNI_POOL","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Advanced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint16","name":"idx","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimedReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint176","name":"lower","type":"uint176"},{"indexed":false,"internalType":"uint176","name":"upper","type":"uint176"},{"indexed":false,"internalType":"bool","name":"shouldUseReciprocalNextRound","type":"bool"}],"name":"FetchedGroundTruth","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"address","name":"source","type":"address"},{"indexed":false,"internalType":"uint16","name":"idx","type":"uint16"},{"indexed":false,"internalType":"uint176","name":"lower","type":"uint176"},{"indexed":false,"internalType":"uint176","name":"upper","type":"uint176"},{"indexed":false,"internalType":"uint80","name":"stake","type":"uint80"}],"name":"ProposalAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"address","name":"source","type":"address"},{"indexed":false,"internalType":"uint16","name":"idx","type":"uint16"},{"indexed":false,"internalType":"uint176","name":"lower","type":"uint176"},{"indexed":false,"internalType":"uint176","name":"upper","type":"uint176"},{"indexed":false,"internalType":"uint80","name":"stake","type":"uint80"}],"name":"ProposalUpdated","type":"event"},{"inputs":[],"name":"ALOE","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNI_POOL","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accumulators","outputs":[{"internalType":"uint16","name":"proposalCount","type":"uint16"},{"internalType":"uint80","name":"stakeTotal","type":"uint80"},{"internalType":"uint256","name":"stake1stMomentRaw","type":"uint256"},{"internalType":"uint256","name":"sumOfLowerBounds","type":"uint256"},{"internalType":"uint256","name":"sumOfLowerBoundsWeighted","type":"uint256"},{"internalType":"uint256","name":"sumOfUpperBounds","type":"uint256"},{"internalType":"uint256","name":"sumOfUpperBoundsWeighted","type":"uint256"},{"components":[{"internalType":"uint256","name":"LS","type":"uint256"},{"internalType":"uint256","name":"MS","type":"uint256"}],"internalType":"struct UINT512","name":"sumOfSquaredBounds","type":"tuple"},{"components":[{"internalType":"uint256","name":"LS","type":"uint256"},{"internalType":"uint256","name":"MS","type":"uint256"}],"internalType":"struct UINT512","name":"sumOfSquaredBoundsWeighted","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"stake","type":"uint80"},{"internalType":"uint176","name":"lower","type":"uint176"},{"internalType":"uint176","name":"upper","type":"uint176"}],"name":"addProposal","outputs":[{"internalType":"uint16","name":"idx","type":"uint16"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"advance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"aggregate","outputs":[{"components":[{"internalType":"uint176","name":"lower","type":"uint176"},{"internalType":"uint176","name":"upper","type":"uint176"}],"internalType":"struct AloeV100Prediction.Bounds","name":"bounds","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inEpoch","type":"uint256"},{"internalType":"uint16","name":"idx","type":"uint16"}],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"current","outputs":[{"components":[{"internalType":"uint176","name":"lower","type":"uint176"},{"internalType":"uint176","name":"upper","type":"uint176"}],"internalType":"struct AloeV100Prediction.Bounds","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inEpoch","type":"uint256"},{"internalType":"uint16","name":"idx","type":"uint16"}],"name":"getProposal","outputs":[{"components":[{"internalType":"address","name":"source","type":"address"},{"internalType":"uint176","name":"lower","type":"uint176"},{"internalType":"uint176","name":"upper","type":"uint176"},{"internalType":"uint80","name":"stake","type":"uint80"}],"internalType":"struct AloeV100Prediction.Proposal","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposals","outputs":[{"internalType":"address","name":"source","type":"address"},{"internalType":"uint176","name":"lower","type":"uint176"},{"internalType":"uint176","name":"upper","type":"uint176"},{"internalType":"uint80","name":"stake","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"shouldUseReciprocal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"summaries","outputs":[{"components":[{"internalType":"uint176","name":"lower","type":"uint176"},{"internalType":"uint176","name":"upper","type":"uint176"}],"internalType":"struct AloeV100Prediction.Bounds","name":"groundTruth","type":"tuple"},{"components":[{"internalType":"uint176","name":"lower","type":"uint176"},{"internalType":"uint176","name":"upper","type":"uint176"}],"internalType":"struct AloeV100Prediction.Bounds","name":"aggregate","type":"tuple"},{"components":[{"internalType":"uint16","name":"proposalCount","type":"uint16"},{"internalType":"uint80","name":"stakeTotal","type":"uint80"},{"internalType":"uint256","name":"stake1stMomentRaw","type":"uint256"},{"internalType":"uint256","name":"sumOfLowerBounds","type":"uint256"},{"internalType":"uint256","name":"sumOfLowerBoundsWeighted","type":"uint256"},{"internalType":"uint256","name":"sumOfUpperBounds","type":"uint256"},{"internalType":"uint256","name":"sumOfUpperBoundsWeighted","type":"uint256"},{"components":[{"internalType":"uint256","name":"LS","type":"uint256"},{"internalType":"uint256","name":"MS","type":"uint256"}],"internalType":"struct UINT512","name":"sumOfSquaredBounds","type":"tuple"},{"components":[{"internalType":"uint256","name":"LS","type":"uint256"},{"internalType":"uint256","name":"MS","type":"uint256"}],"internalType":"struct UINT512","name":"sumOfSquaredBoundsWeighted","type":"tuple"}],"internalType":"struct AloeV100Prediction.Accumulators","name":"accumulators","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"stake","type":"uint80"},{"internalType":"uint176","name":"lower","type":"uint176"},{"internalType":"uint176","name":"upper","type":"uint176"},{"internalType":"uint16","name":"idx","type":"uint16"}],"name":"updateProposal","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040526000600c553480156200001657600080fd5b5060405162003c8438038062003c848339810160408190526200003991620000b8565b6001600160601b0319606083811b821660805282901b1660a0526040516332148f6760e01b815261016860048201526001600160a01b038216906332148f6790602401600060405180830381600087803b1580156200009757600080fd5b505af1158015620000ac573d6000803e3d6000fd5b5050505050506200010f565b60008060408385031215620000cb578182fd5b8251620000d881620000f6565b6020840151909250620000eb81620000f6565b809150509250929050565b6001600160a01b03811681146200010c57600080fd5b50565b60805160601c60a05160601c613b1f620001656000396000818161038a01526127e70152600081816101570152818161060301528181610b4301528181610cb0015281816110df01526116360152613b1f6000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c8063900cf0cf11610097578063af36778b11610066578063af36778b146103c1578063c5dfefc6146103c9578063ea105ac71461042f578063fd7d32a314610437576100f5565b8063900cf0cf146102735780639696d83d1461027c5780639b147558146103855780639fa6a6e3146103ac576100f5565b80635a9d86a6116100d35780635a9d86a6146101a75780635c2245f8146101cd5780636c9b5662146101e2578063725f733914610260576100f5565b8063013cf08b146100fa5780630286cb1e146101525780635053e46114610191575b600080fd5b61010d6101083660046133f8565b610454565b604080516001600160a01b039590951685526001600160b01b03938416602086015291909216908301526001600160501b031660608201526080015b60405180910390f35b6101797f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610149565b6101996104b0565b604051908152602001610149565b6101ba6101b536600461343b565b6104d2565b60405161ffff9091168152602001610149565b6101e06101db36600461347d565b610949565b005b6000546001546002546003546004546005546040805180820182526006548152600754602080830191909152825180840190935260085483526009549083015261024b9761ffff811697620100009091046001600160501b031696909590949093909290919089565b60405161014999989796959493929190613617565b6101e061026e366004613410565b610ecf565b610199600c5481565b61037661028a3660046133f8565b600d602081815260009283526040928390208351808501855281546001600160b01b039081168252600183015481168285015285518087018752600284015482168152600384015490911681850152855161012081018752600484015461ffff811682526201000090046001600160501b0316818601526005840154818801526006840154606082015260078401546080820152600884015460a0820152600984015460c082015286518088018852600a8501548152600b8501548187015260e08201528651808801909752600c84015487529290940154928501929092526101008101939093529183565b6040516101499392919061353e565b6101797f000000000000000000000000000000000000000000000000000000000000000081565b6103b46117bb565b604051610149919061351a565b6103b4611871565b6103dc6103d7366004613410565b611cb5565b6040805182516001600160a01b031681526020808401516001600160b01b03908116918301919091528383015116918101919091526060918201516001600160501b031691810191909152608001610149565b6101e0611d7a565b600b546104449060ff1681565b6040519015158152602001610149565b600a818154811061046457600080fd5b60009182526020909120600390910201805460018201546002909201546001600160a01b0390911692506001600160b01b0391821691811690600160b01b90046001600160501b031684565b6000610e106104c36360aaec80426139ed565b6104cd91906137e9565b905090565b60006001600160501b0384166105225760405162461bcd60e51b815260206004820152601060248201526f416c6f653a204e656564207374616b6560801b60448201526064015b60405180910390fd5b816001600160b01b0316836001600160b01b0316106105835760405162461bcd60e51b815260206004820152601760248201527f416c6f653a20496d706f737369626c6520626f756e64730000000000000000006044820152606401610519565b60005461ffff908116106105d95760405162461bcd60e51b815260206004820152601660248201527f416c6f653a20546f6f206d616e79207374616b657273000000000000000000006044820152606401610519565b6040516323b872dd60e01b81523360048201523060248201526001600160501b03851660448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd90606401602060405180830381600087803b15801561064f57600080fd5b505af1158015610663573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068791906133d8565b6106d35760405162461bcd60e51b815260206004820152601260248201527f416c6f653a2050726f7669646520414c4f4500000000000000000000000000006044820152606401610519565b50604080516080810182523381526001600160b01b0380851660208301528316918101919091526001600160501b0384166060820152600054600a5461ffff90911691908210156107c55780600a8361ffff168154811061074457634e487b7160e01b600052603260045260246000fd5b6000918252602091829020835160039092020180546001600160a01b039092166001600160a01b0319909216919091178155908201516001820180546001600160b01b039283166001600160b01b031990911617905560408301516060909301516001600160501b0316600160b01b029216919091176002909101556108a5565b600a8054600181018255600091909152815160039091027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8810180546001600160a01b039093166001600160a01b03199093169290921790915560208201517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a9820180546001600160b01b039283166001600160b01b0319909116179055604083015160608401516001600160501b0316600160b01b029116177fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa909101555b6000805461ffff1690806108b883613a24565b91906101000a81548161ffff021916908361ffff160217905550506108de8585856120bf565b600c546040805161ffff851681526001600160b01b0387811660208301528616818301526001600160501b038816606082015290513392917fc9ddaa45a43743e0d6288459aadc5b17beccef5426e67edf3953f4b1f3bc3e40919081900360800190a3509392505050565b6001600160501b0384166109925760405162461bcd60e51b815260206004820152601060248201526f416c6f653a204e656564207374616b6560801b6044820152606401610519565b816001600160b01b0316836001600160b01b0316106109f35760405162461bcd60e51b815260206004820152601760248201527f416c6f653a20496d706f737369626c6520626f756e64730000000000000000006044820152606401610519565b60005461ffff90811690821610610a4c5760405162461bcd60e51b815260206004820152601260248201527f416c6f653a2069647820746f6f206869676800000000000000000000000000006044820152606401610519565b600a8161ffff1681548110610a7157634e487b7160e01b600052603260045260246000fd5b60009182526020909120600390910201546001600160a01b03163314610ad95760405162461bcd60e51b815260206004820152600f60248201527f416c6f653a206e6f7420796f75727300000000000000000000000000000000006044820152606401610519565b6000600a8261ffff1681548110610b0057634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020190508060020160169054906101000a90046001600160501b03166001600160501b0316856001600160501b03161115610c8e577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166323b872dd33308460020160169054906101000a90046001600160501b031689610b959190613a04565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301526001600160501b03166044820152606401602060405180830381600087803b158015610c0557600080fd5b505af1158015610c19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3d91906133d8565b610c895760405162461bcd60e51b815260206004820152601260248201527f416c6f653a2050726f7669646520414c4f4500000000000000000000000000006044820152606401610519565b610dec565b60028101546001600160501b03600160b01b90910481169086161015610dec577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb33878460020160169054906101000a90046001600160501b0316610d019190613a04565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526001600160501b03166024820152604401602060405180830381600087803b158015610d6857600080fd5b505af1158015610d7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da091906133d8565b610dec5760405162461bcd60e51b815260206004820152601860248201527f416c6f653a204661696c656420414c4f4520726566756e6400000000000000006044820152606401610519565b60028101546001820154610e1d916001600160501b03600160b01b820416916001600160b01b039081169116612198565b6001810180546001600160b01b038681166001600160b01b0319928316179092559084166001600160501b038716600160b01b02909116176002820155610e658585856120bf565b600c546040805161ffff851681526001600160b01b0387811660208301528616818301526001600160501b038816606082015290513392917f1d3b2225231d9c173198b4539f433683433846328ada620e3c07fe370da1a030919081900360800190a35050505050565b6000828152600d6020526040902080546001600160b01b0316610f345760405162461bcd60e51b815260206004820152601760248201527f416c6f653a206e6565642067726f756e642074727574680000000000000000006044820152606401610519565b60018101546001600160b01b0316610f8e5760405162461bcd60e51b815260206004820152601760248201527f416c6f653a206e6565642067726f756e642074727574680000000000000000006044820152606401610519565b600481015461ffff90811690831610610fe95760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20696478206e6f6e6578697374656e7400000000000000000000006044820152606401610519565b6000838152600d60205260408120600e01805461ffff851690811061101e57634e487b7160e01b600052603260045260246000fd5b600091825260209091206003909102016002810154909150600160b01b90046001600160501b03166110925760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616c726561647920636c61696d656400000000000000000000006044820152606401610519565b600482015461ffff166001141561126b578054600282015460405163a9059cbb60e01b81526001600160a01b039283166004820152600160b01b9091046001600160501b031660248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb90604401602060405180830381600087803b15801561112557600080fd5b505af1158015611139573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115d91906133d8565b6111a95760405162461bcd60e51b815260206004820152601660248201527f416c6f653a206661696c656420746f20726577617264000000000000000000006044820152606401610519565b805460028201546040805161ffff8716815260208101889052600160b01b9092046001600160501b0316908201526001600160a01b03909116907fd4a89bd1eb4e45b6ba428de255f8f1a288b02bd5c663eb8a5dd852053be6735f9060600160405180910390a281600e018361ffff168154811061123757634e487b7160e01b600052603260045260246000fd5b60009182526020822060039091020180546001600160a01b03191681556001810180546001600160b01b0319169055600201555b815460018201546000916001600160b01b039081169116116112a957600182015483546112a4916001600160b01b0390811691166139a5565b6112c6565b825460018301546112c6916001600160b01b0390811691166139a5565b600184015460028401546001600160b01b03928316935060009291821691161161130f576002830154600185015461130a916001600160b01b0390811691166139a5565b61132f565b6001840154600284015461132f916001600160b01b0390811691166139a5565b60408051808201909152600a8601548152600b8601546020820152600686015460088701546004880154885460018a01546001600160b01b0396871697506000966113859695949361ffff16928116911661226d565b60408051808201909152600c8701548152600d8701546020820152600787015460098801546004890154895460018b01549596506000956113e5959493926201000090046001600160501b0316916001600160b01b03908116911661226d565b9050611404604051806040016040528060008152602001600081525090565b60408051808201909152835181526020808501519082015261142586612353565b6020840181905281845261143a918391612370565b6020830152815261144a85612353565b6020840181905281845261145f918391612370565b602083015281526002870154611486908290600160b01b90046001600160501b03166123b3565b6020838101919091529082526040805180820190915285518152858201519181019190915260048901546114ca9082906201000090046001600160501b03166123b3565b6020808401919091529082528451908501516114e7918391612370565b602083018190529082526000906115225760048a01548351835161151b926201000090046001600160501b031691906123e2565b905061160e565b82511561159457825161153490612497565b6115418360200151612497565b61154d9061010161372e565b61155791906139ed565b905060508110611568576000611591565b611573816002613843565b60048b015461159191906201000090046001600160501b03166137e9565b90505b60208301511561160e5760048a01546020840151611601916201000090046001600160501b0316906115ca90600160501b613937565b6115df600160501b86600001516000196123e2565b60208601516115f290600160501b613937565b6115fc919061372e565b6123e2565b61160b908261372e565b90505b885460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb90604401602060405180830381600087803b15801561167c57600080fd5b505af1158015611690573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b491906133d8565b6117005760405162461bcd60e51b815260206004820152601660248201527f416c6f653a206661696c656420746f20726577617264000000000000000000006044820152606401610519565b88546040805161ffff8e168152602081018f90529081018390526001600160a01b03909116907fd4a89bd1eb4e45b6ba428de255f8f1a288b02bd5c663eb8a5dd852053be6735f9060600160405180910390a289600e018b61ffff168154811061177a57634e487b7160e01b600052603260045260246000fd5b60009182526020822060039091020180546001600160a01b03191681556001810180546001600160b01b031916905560020155505050505050505050505050565b6040805180820190915260008082526020820152600c5461181e5760405162461bcd60e51b815260206004820152601160248201527f416c6f653a204e6f2064617461207965740000000000000000000000000000006044820152606401610519565b600d60006001600c5461183191906139ed565b81526020808201929092526040908101600020815180830190925260028101546001600160b01b0390811683526003909101541691810191909152905090565b60408051808201909152600080825260208201526000546201000090046001600160501b03166118e35760405162461bcd60e51b815260206004820152601d60248201527f416c6f653a204e6f2070726f706f73616c732077697468207374616b650000006044820152606401610519565b60008054600154611903916201000090046001600160501b0316906137e9565b905060008060008060005b60005461ffff9081169082161015611a7e576000600a8261ffff168154811061194757634e487b7160e01b600052603260045260246000fd5b600091825260209091206003909102016002810154909150600160b01b90046001600160501b03166119795750611a76565b60018101546001600160b01b0380891691161080156119a7575060028101546001600160b01b038089169116105b156119e457600181015460028201546001600160b01b0391821682821603909116600160b01b9091046001600160501b0316029590950194611a74565b60018101546001600160b01b0380891691161015611a4057600181015460028201546001600160501b03600160b01b8204166001600160b01b039283168a03831681029890980197908216899003909116029490940193611a74565b600181015460028201546001600160b01b0391821682821603909116600160b01b9091046001600160501b03160294909401935b505b60010161190e565b5060005b60005461ffff9081169082161015611c7d576000600a8261ffff1681548110611abb57634e487b7160e01b600052603260045260246000fd5b600091825260209091206003909102016002810154909150600160b01b90046001600160501b0316611aed5750611c75565b60018101546001600160b01b038089169116108015611b1b575060028101546001600160b01b038089169116105b15611b835760028181015460018301546001600160b81b036001600160b01b039182168284168181018316959095049091169303811691611b78916001600160501b03600160b01b909204919091168302908b168490038a6123e2565b860195505050611c73565b60018101546001600160b01b0380891691161015611c155760018101546002808301546001600160b01b039283168a038316928082168b90031691611bde91600160b01b90046001600160501b031684029084908b026123e2565b6002808501549190970196611c0a916001600160501b03600160b01b9091041683029083908a026123e2565b850194505050611c73565b60028181015460018301546001600160b81b036001600160b01b039182168284168181018316959095049091169303811691611c6c916001600160501b03600160b01b909204919091168302908b168403896123e2565b8501945050505b505b600101611a82565b611c8783876139a5565b6001600160b01b03168752611c9c82876136e1565b6001600160b01b03166020880152509495945050505050565b6040805160808101825260008082526020820181905291810182905260608101919091526000838152600d60205260409020600e01805461ffff8416908110611d0e57634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160808101825260039390930290910180546001600160a01b0316835260018101546001600160b01b03908116948401949094526002015492831690820152600160b01b9091046001600160501b0316606082015290505b92915050565b611d826104b0565b600c541415611d9057600080fd5b600c546000908152600d60205260409020611da9611871565b8051600280840180546001600160b01b039384166001600160b01b03199182161790915560209093015160038086018054929094169190941617909155600080546004808601805461ffff19811661ffff909416938417825593546001600160501b03620100009182900416026bffffffffffffffffffffffff1990941690921792909217905560015460058086019190915591546006808601919091559254600780860191909155905460088086019190915591546009808601919091559254600a808601919091559054600b8501559054600c8401559054600d8301558054611e9891600e84019161314c565b50600c80546000908152600d60208190526040909120835481546001600160b01b03199081166001600160b01b0392831617835560018087015490840180548316918416919091179055600280870154908401805483169184169190911790556003808701549084018054909216921691909117905560048085018054918301805461ffff19811661ffff909416938417825591546001600160501b03620100009182900416026bffffffffffffffffffffffff199092169092171790556005808501549082015560068085015490820155600780850154908201556008808501549082015560098085015490820155600a8085015490820155600b808501549082015582840154928101929092558083015490820155600e8083018054849392611fc6929084019161314c565b5050600c5415905061203157611fda61252c565b600d60006001600c54611fed91906139ed565b8152602080820192909252604001600020825181546001600160b01b03199081166001600160b01b0392831617835593909201516001909101805490931691161790555b600c805490600061204183613a46565b9091555050600080546bffffffffffffffffffffffff1916815560018190556002819055600381905560048190556005819055600681905560078190556008819055600955600c546040519081527fc57935279d6722c460fe9df76af8611f70a240dda5786b942e209599b9640d829060200160405180910390a150565b600080546bffffffffffffffffffff000019811662010000918290046001600160501b039081168701811690920217825560018054848601821c757fffffffffffffffffffffffffffffffffffffffffff16928716928302019055600280546001600160b01b038087169182019092556004805492861692830190556003805491840290910190556005805491909202019055808080612160878787612bbe565b9296509094509250905061217660068585612c4e565b61218f6008836001600160501b038a1686028401612c4e565b50505050505050565b600080546001600160501b036201000080830482168790038216026bffffffffffffffffffff00001990921691909117825560018054918616757fffffffffffffffffffffffffffffffffffffffffff868601831c1681029092039055600280546001600160b01b03808716918290039092556004805492861692839003905560038054918402909103905560058054919092029003905580808061223e878787612bbe565b9296509094509250905061225460068585612c8b565b61218f6008836001600160501b038a1686028401612c8b565b604080518082019091526000808252602082015260408051808201909152600080825260208201526122a86122a28587613937565b85612ccb565b602083018190528183526122bd918a91612cea565b60208a015288526122d76122d18487613937565b84612ccb565b602083018190528183526122ec918a91612cea565b60208a0152885261230187600186901b612ccb565b60208301819052818352612316918a91612370565b60208a0152885261232b86600185901b612ccb565b60208301819052818352612340918a91612370565b60208a0152885250959695505050505050565b600080600019838009838402925082811083820303915050915091565b600080838560000151106123915783856000015103838660200151036123a7565b8385600001516000190103600184876020015103035b91509150935093915050565b60208201805182029052815160009081906123ce9084612ccb565b818652602090950151909594019392505050565b60008080600019858709858702925082811083820303915050806000141561241c576000841161241157600080fd5b508290049050612490565b80841161242857600080fd5b600084868809851960019081018716968790049682860381900495909211909303600082900391909104909201919091029190911760038402600290811880860282030280860282030280860282030280860282030280860282030280860290910302029150505b9392505050565b6000600160801b82106124ac57608091821c91015b6801000000000000000082106124c457604091821c91015b64010000000082106124d857602091821c91015b6201000082106124ea57601091821c91015b61010082106124fb57600891821c91015b6010821061250b57600491821c91015b6004821061251b57600291821c91015b60028210612527576001015b919050565b604080518082018252600080825260208083018290528351600a8082526101608201909552929391929190820161014080368337019050509050610e108160008151811061258a57634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff1681525050610ca8816001815181106125c857634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff1681525050610b408160028151811061260657634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff16815250506109d88160038151811061264457634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff16815250506108708160048151811061268257634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff1681525050610708816005815181106126c057634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff16815250506105a0816006815181106126fe57634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff16815250506104388160078151811061273c57634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff16815250506102d08160088151811061277a57634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff1681525050610168816009815181106127b857634e487b7160e01b600052603260045260246000fd5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063883bdbfd9061281c9085906004016134d0565b60006040518083038186803b15801561283457600080fd5b505afa158015612848573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612870919081019061330d565b50905060006128e6610ca88360008151811061289c57634e487b7160e01b600052603260045260246000fd5b6020026020010151846009815181106128c557634e487b7160e01b600052603260045260246000fd5b60200260200101516128d79190613956565b6128e1919061376b565b612d2d565b600b5490915060ff161561292957600b805460ff1916600160501b6001600160a01b0380851691909110919091179091556129229082906137a9565b9050612945565b600b805460ff1916600160501b6001600160a01b038416101790555b600061295f6001600160a01b03831680600160901b6123e2565b90506000805b60098160ff161015612a6d5760006129d3610168878460ff168151811061299c57634e487b7160e01b600052603260045260246000fd5b6020026020010151888560016129b29190613746565b60ff16815181106128c557634e487b7160e01b600052603260045260246000fd5b600b5490915060ff16156129f5576129f2856001600160a01b036137a9565b90505b6000612a0f6001600160a01b03831680600160901b6123e2565b9050846001600160b01b0316816001600160b01b031611612a3957612a3481866139a5565b612a43565b612a4385826139a5565b612a56906001600160b01b03168561370c565b935050508080612a6590613a61565b915050612965565b506000620dbba0612a8183620137ac613911565b612a8b91906137cf565b9050612aa16001600160b01b0382166002613911565b6001600160b81b03166001600160b01b03841611612ac0576000612ae7565b612ad46001600160b01b0382166002613911565b612ae7906001600160b01b0385166139cd565b6001600160b01b039081168852612b018282166002613911565b612b14906001600160b01b03861661370c565b6001600160b81b031611612b4e57612b366001600160b01b0382166002613911565b612b49906001600160b01b03851661370c565b612b57565b6001600160b01b035b6001600160b01b0390811660208981018290528951600b54604080519290951682529181019290925260ff1615158183015290517f5717cc81029a35fa1c31d61f9aa518a55374c2c35bf4cfff29eb35d84f6aff119181900360600190a150505050505090565b600080600080612bd6866001600160b01b0316612353565b9094509250612bed6001600160b01b038616612353565b9092509050612c03600183811c9086901c61372e565b9350612c10846002612ccb565b9094509150612c1f828261372e565b612c29908461372e565b9250612c3e84886001600160501b0316612ccb565b9498939750955092935090915050565b825482191015612c7557600019835483900883556001808401805483019091019055612c86565b825482018355600183018054820190555b505050565b8254821115612cb457825482900360001990810184556001840180548390039091019055612c86565b825482900383556001830180548290039055505050565b6000806000198385098385029250828110838203039150509250929050565b6000808360001903856000015111612d0f5783856000015101838660200151016123a7565b60001985518590088386602001510160010191509150935093915050565b60008060008360020b12612d44578260020b612d51565b8260020b612d5190613ab6565b9050612d60620d89e719613a95565b62ffffff16811115612d985760405162461bcd60e51b81526020600482015260016024820152601560fa1b6044820152606401610519565b600060018216612dac57600160801b612dbe565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612dfd576080612df8826ffff97272373d413259a46990580e213a613937565b901c90505b6004821615612e27576080612e22826ffff2e50f5f656932ef12357cf3c7fdcc613937565b901c90505b6008821615612e51576080612e4c826fffe5caca7e10e4e61c3624eaa0941cd0613937565b901c90505b6010821615612e7b576080612e76826fffcb9843d60f6159c9db58835c926644613937565b901c90505b6020821615612ea5576080612ea0826fff973b41fa98c081472e6896dfb254c0613937565b901c90505b6040821615612ecf576080612eca826fff2ea16466c96a3843ec78b326b52861613937565b901c90505b6080821615612ef9576080612ef4826ffe5dee046a99a2a811c461f1969c3053613937565b901c90505b610100821615612f24576080612f1f826ffcbe86c7900a88aedcffc83b479aa3a4613937565b901c90505b610200821615612f4f576080612f4a826ff987a7253ac413176f2b074cf7815e54613937565b901c90505b610400821615612f7a576080612f75826ff3392b0822b70005940c7a398e4b70f3613937565b901c90505b610800821615612fa5576080612fa0826fe7159475a2c29b7443b29c7fa6e889d9613937565b901c90505b611000821615612fd0576080612fcb826fd097f3bdfd2022b8845ad8f792aa5825613937565b901c90505b612000821615612ffb576080612ff6826fa9f746462d870fdf8a65dc1f90e061e5613937565b901c90505b614000821615613026576080613021826f70d869a156d2a1b890bb3df62baf32f7613937565b901c90505b61800082161561305157608061304c826f31be135f97d08fd981231505542fcfa6613937565b901c90505b6201000082161561307d576080613078826f09aa508b5b7a84e1c677de54f3e99bc9613937565b901c90505b620200008216156130a85760806130a3826e5d6af8dedb81196699c329225ee604613937565b901c90505b620400008216156130d25760806130cd826d2216e584f5fa1ea926041bedfe98613937565b901c90505b620800008216156130fa5760806130f5826b048a170391f7dc42444e8fa2613937565b901c90505b60008460020b131561311557613112816000196137e9565b90505b61312464010000000082613a81565b15613130576001613133565b60005b6131449060ff16602083901c61372e565b949350505050565b8280548282559060005260206000209060030281019282156132025760005260206000209160030282015b8281111561320257825482546001600160a01b0319166001600160a01b0390911617825560018084015490830180546001600160b01b03199081166001600160b01b039384161790915560028086018054918601805490931691909316908117825591546001600160501b03600160b01b918290041602909117905560039283019290910190613177565b5061320e929150613212565b5090565b5b8082111561320e5780546001600160a01b03191681556001810180546001600160b01b031916905560006002820155600301613213565b600082601f83011261325a578081fd5b8151602061326f61326a836136bd565b61368c565b80838252828201915082860187848660051b890101111561328e578586fd5b855b858110156132c05781516001600160a01b03811681146132ae578788fd5b84529284019290840190600101613290565b5090979650505050505050565b803561ffff8116811461252757600080fd5b80356001600160b01b038116811461252757600080fd5b80356001600160501b038116811461252757600080fd5b6000806040838503121561331f578182fd5b825167ffffffffffffffff80821115613336578384fd5b818501915085601f830112613349578384fd5b8151602061335961326a836136bd565b8083825282820191508286018a848660051b8901011115613378578889fd5b8896505b848710156133a85780518060060b811461339457898afd5b83526001969096019591830191830161337c565b50918801519196509093505050808211156133c1578283fd5b506133ce8582860161324a565b9150509250929050565b6000602082840312156133e9578081fd5b81518015158114612490578182fd5b600060208284031215613409578081fd5b5035919050565b60008060408385031215613422578182fd5b82359150613432602084016132cd565b90509250929050565b60008060006060848603121561344f578081fd5b613458846132f6565b9250613466602085016132df565b9150613474604085016132df565b90509250925092565b60008060008060808587031215613492578081fd5b61349b856132f6565b93506134a9602086016132df565b92506134b7604086016132df565b91506134c5606086016132cd565b905092959194509250565b6020808252825182820181905260009190848201906040850190845b8181101561350e57835163ffffffff16835292840192918401916001016134ec565b50909695505050505050565b60408101611d74828480516001600160b01b03908116835260209182015116910152565b6101e08101613563828680516001600160b01b03908116835260209182015116910152565b83516001600160b01b0390811660408401526020850151166060830152825161ffff16608083015260208301516001600160501b03811660a084015250604083015160c0830152606083015160e08301526080830151610100818185015260a085015161012085015260c085015161014085015260e085015191506135f661016085018380518252602090810151910152565b84015180516101a085015260208101516101c0850152905050949350505050565b60006101608201905061ffff8b1682526001600160501b038a1660208301528860408301528760608301528660808301528560a08301528460c083015261366b60e083018580518252602090810151910152565b825161012083015260208301516101408301529a9950505050505050505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156136b5576136b5613afc565b604052919050565b600067ffffffffffffffff8211156136d7576136d7613afc565b5060051b60200190565b60006001600160b01b0380831681851680830382111561370357613703613ad0565b01949350505050565b60006001600160b81b0380831681851680830382111561370357613703613ad0565b6000821982111561374157613741613ad0565b500190565b600060ff821660ff84168060ff0382111561376357613763613ad0565b019392505050565b60008160060b8360060b8061378257613782613ae6565b667fffffffffffff198214600019821416156137a0576137a0613ad0565b90059392505050565b60006001600160a01b03808416806137c3576137c3613ae6565b92169190910492915050565b60006001600160b81b03808416806137c3576137c3613ae6565b6000826137f8576137f8613ae6565b500490565b80825b600180861161380f575061383a565b81870482111561382157613821613ad0565b8086161561382e57918102915b9490941c938002613800565b94509492505050565b6000612490600019848460008261385c57506001612490565b8161386957506000612490565b816001811461387f5760028114613889576138b6565b6001915050612490565b60ff84111561389a5761389a613ad0565b6001841b9150848211156138b0576138b0613ad0565b50612490565b5060208310610133831016604e8410600b84101617156138e9575081810a838111156138e4576138e4613ad0565b612490565b6138f684848460016137fd565b80860482111561390857613908613ad0565b02949350505050565b60006001600160b81b038083168185168183048111821515161561390857613908613ad0565b600081600019048311821515161561395157613951613ad0565b500290565b60008160060b8360060b82811281667fffffffffffff190183128115161561398057613980613ad0565b81667fffffffffffff01831381161561399b5761399b613ad0565b5090039392505050565b60006001600160b01b03838116908316818110156139c5576139c5613ad0565b039392505050565b60006001600160b81b03838116908316818110156139c5576139c5613ad0565b6000828210156139ff576139ff613ad0565b500390565b60006001600160501b03838116908316818110156139c5576139c5613ad0565b600061ffff80831681811415613a3c57613a3c613ad0565b6001019392505050565b6000600019821415613a5a57613a5a613ad0565b5060010190565b600060ff821660ff811415613a7857613a78613ad0565b60010192915050565b600082613a9057613a90613ae6565b500690565b60008160020b627fffff19811415613aaf57613aaf613ad0565b9003919050565b6000600160ff1b821415613acc57613acc613ad0565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000803000a000000000000000000000000400f470d493110473113123c4754208ed91985a3000000000000000000000000cec12cbce90dfaf9a09390c3d6c75a8bd80d648b

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

000000000000000000000000400f470d493110473113123c4754208ed91985a3000000000000000000000000cec12cbce90dfaf9a09390c3d6c75a8bd80d648b

-----Decoded View---------------
Arg [0] : _ALOE (address): 0x400f470d493110473113123c4754208ed91985a3
Arg [1] : _UNI_POOL (address): 0xcec12cbce90dfaf9a09390c3d6c75a8bd80d648b

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000400f470d493110473113123c4754208ed91985a3
Arg [1] : 000000000000000000000000cec12cbce90dfaf9a09390c3d6c75a8bd80d648b


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading

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.