ETH Price: $3,381.72 (-1.00%)
Gas: 11 Gwei

Contract

0x81DE9bE5dCB080dB6E8fC6FF76836959C228a899
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x2abb75d69374088643e8ec44cd9254f586e70e07d68287272e99133e800988d5 Swap(pending)2024-06-24 7:00:582 days ago1719212458IN
0x81DE9bE5...9C228a899
0 ETH(Pending)(Pending)
Unlock Linear197157222024-04-23 4:30:4764 days ago1713846647IN
0x81DE9bE5...9C228a899
0 ETH0.000421556.36124304
Swap197101102024-04-22 9:42:1165 days ago1713778931IN
0x81DE9bE5...9C228a899
0 ETH0.001795598.34723595
Swap197099082024-04-22 9:01:2365 days ago1713776483IN
0x81DE9bE5...9C228a899
0 ETH0.001782768.28757701
Set Accounts Lim...197098732024-04-22 8:54:2365 days ago1713776063IN
0x81DE9bE5...9C228a899
0 ETH0.00088128.48978193
Create Payment L...197098652024-04-22 8:52:4765 days ago1713775967IN
0x81DE9bE5...9C228a899
0 ETH0.000446878.06035461
Increase Issuanc...197098582024-04-22 8:51:2365 days ago1713775883IN
0x81DE9bE5...9C228a899
0 ETH0.000847349.00056609
Create Linear Po...197098192024-04-22 8:43:3565 days ago1713775415IN
0x81DE9bE5...9C228a899
0 ETH0.003054349.12745868
Set Accounts Lim...197086182024-04-22 4:41:1165 days ago1713760871IN
0x81DE9bE5...9C228a899
0 ETH0.000608195.85954441
Create Payment L...197086122024-04-22 4:39:5965 days ago1713760799IN
0x81DE9bE5...9C228a899
0 ETH0.000351596.34174297
Increase Issuanc...197086092024-04-22 4:39:2365 days ago1713760763IN
0x81DE9bE5...9C228a899
0 ETH0.000695516.25222397
Create Linear Po...197085282024-04-22 4:23:1165 days ago1713759791IN
0x81DE9bE5...9C228a899
0 ETH0.002028526.06194531
Unlock Linear196743612024-04-17 9:40:5970 days ago1713346859IN
0x81DE9bE5...9C228a899
0 ETH0.0009772815.89862665
Unlock Linear196741242024-04-17 8:53:2370 days ago1713344003IN
0x81DE9bE5...9C228a899
0 ETH0.0008594412.91713164
Swap196727622024-04-17 4:19:2370 days ago1713327563IN
0x81DE9bE5...9C228a899
0 ETH0.001372946.69022098
Set Accounts Lim...196727302024-04-17 4:12:5970 days ago1713327179IN
0x81DE9bE5...9C228a899
0 ETH0.000368896.82279664
Create Payment L...196727092024-04-17 4:08:4770 days ago1713326927IN
0x81DE9bE5...9C228a899
0 ETH0.000408617.37024478
Increase Issuanc...196726172024-04-17 3:50:2370 days ago1713325823IN
0x81DE9bE5...9C228a899
0 ETH0.000750896.75079604
Create Linear Po...196725452024-04-17 3:35:5970 days ago1713324959IN
0x81DE9bE5...9C228a899
0 ETH0.002049056.12350645
Unlock Interval195206262024-03-26 19:17:5992 days ago1711480679IN
0x81DE9bE5...9C228a899
0 ETH0.0034288838.82822079
Unlock Interval195113682024-03-25 12:02:5993 days ago1711368179IN
0x81DE9bE5...9C228a899
0 ETH0.0015758422.12985353
Unlock Interval194144252024-03-11 21:06:23106 days ago1710191183IN
0x81DE9bE5...9C228a899
0 ETH0.0056881264.41159081
Unlock Interval192223262024-02-13 23:23:47133 days ago1707866627IN
0x81DE9bE5...9C228a899
0 ETH0.0025887229.31436809
Unlock Interval188619992023-12-25 9:56:59184 days ago1703498219IN
0x81DE9bE5...9C228a899
0 ETH0.0019726122.33768956
Unlock Interval187523322023-12-10 0:47:47199 days ago1702169267IN
0x81DE9bE5...9C228a899
0 ETH0.0022703925.70969383
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FixedSwap

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
constantinople EvmVersion
File 1 of 9 : FixedSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "solowei/contracts/AttoDecimal.sol";
import "solowei/contracts/TwoStageOwnable.sol";

contract FixedSwap is ReentrancyGuard, TwoStageOwnable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using AttoDecimal for AttoDecimal.Instance;

    enum Type {SIMPLE, INTERVAL, LINEAR}

    struct Props {
        uint256 issuanceLimit;
        uint256 startsAt;
        uint256 endsAt;
        IERC20 paymentToken;
        IERC20 issuanceToken;
        AttoDecimal.Instance fee;
        AttoDecimal.Instance rate;
    }

    struct AccountState {
        uint256 limitIndex;
        uint256 paymentSum;
    }

    struct ComplexAccountState {
        uint256 issuanceAmount;
        uint256 withdrawnIssuanceAmount;
    }

    struct Account {
        AccountState state;
        ComplexAccountState complex;
        uint256 immediatelyUnlockedAmount; // linear
        uint256 unlockedIntervalsCount; // interval
    }

    struct State {
        uint256 available;
        uint256 issuance;
        uint256 lockedPayments;
        uint256 unlockedPayments;
        address nominatedOwner;
        address owner;
        uint256[] paymentLimits;
    }

    struct Interval {
        uint256 startsAt;
        AttoDecimal.Instance unlockingPart;
    }

    struct LinearProps {
        uint256 endsAt;
        uint256 duration;
    }

    struct Pool {
        Type type_;
        uint256 index;
        AttoDecimal.Instance immediatelyUnlockingPart;
        Props props;
        LinearProps linear;
        State state;
        Interval[] intervals;
        mapping(address => Account) accounts;
    }

    Pool[] private _pools;
    mapping(IERC20 => uint256) private _collectedFees;

    function getTimestamp() internal view virtual returns (uint256) {
        return block.timestamp;
    }

    function poolsCount() public view returns (uint256) {
        return _pools.length;
    }

    function poolProps(uint256 poolIndex) public view returns (Type type_, Props memory props) {
        Pool storage pool = _getPool(poolIndex);
        return (pool.type_, pool.props);
    }

    function intervalPoolProps(uint256 poolIndex)
        public
        view
        returns (
            Props memory props,
            AttoDecimal.Instance memory immediatelyUnlockingPart,
            Interval[] memory intervals
        )
    {
        Pool storage pool = _getPool(poolIndex);
        _assertPoolIsInterval(pool);
        return (pool.props, pool.immediatelyUnlockingPart, pool.intervals);
    }

    function linearPoolProps(uint256 poolIndex)
        public
        view
        returns (
            Props memory props,
            AttoDecimal.Instance memory immediatelyUnlockingPart,
            LinearProps memory linear
        )
    {
        Pool storage pool = _getPool(poolIndex);
        _assertPoolIsLinear(pool);
        return (pool.props, pool.immediatelyUnlockingPart, pool.linear);
    }

    function poolState(uint256 poolIndex) public view returns (State memory state) {
        return _getPool(poolIndex).state;
    }

    function poolAccount(uint256 poolIndex, address address_)
        public
        view
        returns (Type type_, AccountState memory state)
    {
        Pool storage pool = _getPool(poolIndex);
        return (pool.type_, pool.accounts[address_].state);
    }

    function intervalPoolAccount(uint256 poolIndex, address address_)
        public
        view
        returns (
            AccountState memory state,
            ComplexAccountState memory complex,
            uint256 unlockedIntervalsCount
        )
    {
        Pool storage pool = _getPool(poolIndex);
        _assertPoolIsInterval(pool);
        Account storage account = pool.accounts[address_];
        return (account.state, account.complex, account.unlockedIntervalsCount);
    }

    function linearPoolAccount(uint256 poolIndex, address address_)
        public
        view
        returns (
            AccountState memory state,
            ComplexAccountState memory complex,
            uint256 immediatelyUnlockedAmount
        )
    {
        Pool storage pool = _getPool(poolIndex);
        _assertPoolIsLinear(pool);
        Account storage account = pool.accounts[address_];
        return (account.state, account.complex, account.immediatelyUnlockedAmount);
    }

    function collectedFees(IERC20 token) public view returns (uint256) {
        return _collectedFees[token];
    }

    event AccountLimitChanged(uint256 indexed poolIndex, address indexed address_, uint256 indexed limitIndex);
    event FeeWithdrawn(address indexed token, uint256 amount);
    event ImmediatelyUnlockingPartUpdated(uint256 indexed poolIndex, uint256 mantissa);
    event IntervalCreated(uint256 indexed poolIndex, uint256 startsAt, uint256 unlockingPart);
    event IssuanceIncreased(uint256 indexed poolIndex, uint256 amount);
    event LinearUnlockingEndingTimestampUpdated(uint256 indexed poolIndex, uint256 timestamp);
    event LinearPoolUnlocking(uint256 indexed poolIndex, address indexed account, uint256 amount);
    event PaymentLimitCreated(uint256 indexed poolIndex, uint256 indexed limitIndex, uint256 limit);
    event PaymentLimitChanged(uint256 indexed poolIndex, uint256 indexed limitIndex, uint256 newLimit);
    event PaymentUnlocked(uint256 indexed poolIndex, uint256 unlockedAmount, uint256 collectedFee);
    event PaymentsWithdrawn(uint256 indexed poolIndex, uint256 amount);
    event PoolOwnerChanged(uint256 indexed poolIndex, address indexed newOwner);
    event PoolOwnerNominated(uint256 indexed poolIndex, address indexed nominatedOwner);
    event UnsoldWithdrawn(uint256 indexed poolIndex, uint256 amount);

    event PoolCreated(
        Type type_,
        IERC20 indexed paymentToken,
        IERC20 indexed issuanceToken,
        uint256 poolIndex,
        uint256 issuanceLimit,
        uint256 startsAt,
        uint256 endsAt,
        uint256 fee,
        uint256 rate,
        uint256 paymentLimit
    );

    event Swap(
        uint256 indexed poolIndex,
        address indexed caller,
        uint256 requestedPaymentAmount,
        uint256 paymentAmount,
        uint256 issuanceAmount
    );

    constructor(address owner_) public TwoStageOwnable(owner_) {
        return;
    }

    function createSimplePool(
        Props memory props,
        uint256 paymentLimit,
        address owner_
    ) external onlyOwner returns (bool success, uint256 poolIndex) {
        return (true, _createSimplePool(props, paymentLimit, owner_, Type.SIMPLE).index);
    }

    function createIntervalPool(
        Props memory props,
        uint256 paymentLimit,
        address owner_,
        AttoDecimal.Instance memory immediatelyUnlockingPart,
        Interval[] memory intervals
    ) external onlyOwner returns (bool success, uint256 poolIndex) {
        Pool storage pool = _createSimplePool(props, paymentLimit, owner_, Type.INTERVAL);
        _setImmediatelyUnlockingPart(pool, immediatelyUnlockingPart);
        uint256 intervalsCount = intervals.length;
        AttoDecimal.Instance memory lastUnlockingPart = immediatelyUnlockingPart;
        uint256 lastIntervalStartingTimestamp = props.endsAt - 1;
        for (uint256 i = 0; i < intervalsCount; i++) {
            Interval memory interval = intervals[i];
            require(interval.unlockingPart.gt(lastUnlockingPart), "Invalid interval unlocking part");
            lastUnlockingPart = interval.unlockingPart;
            uint256 startingTimestamp = interval.startsAt;
            require(startingTimestamp > lastIntervalStartingTimestamp, "Invalid interval starting timestamp");
            lastIntervalStartingTimestamp = startingTimestamp;
            pool.intervals.push(interval);
            emit IntervalCreated(poolIndex, interval.startsAt, interval.unlockingPart.mantissa);
        }
        require(lastUnlockingPart.eq(1), "Unlocking part not equal to one");
        return (true, pool.index);
    }

    function createLinearPool(
        Props memory props,
        uint256 paymentLimit,
        address owner_,
        AttoDecimal.Instance memory immediatelyUnlockingPart,
        uint256 linearUnlockingEndsAt
    ) external onlyOwner returns (bool success, uint256 poolIndex) {
        require(linearUnlockingEndsAt > props.endsAt, "Linear unlocking less than or equal to pool ending timestamp");
        Pool storage pool = _createSimplePool(props, paymentLimit, owner_, Type.LINEAR);
        _setImmediatelyUnlockingPart(pool, immediatelyUnlockingPart);
        pool.linear.endsAt = linearUnlockingEndsAt;
        pool.linear.duration = linearUnlockingEndsAt - props.endsAt;
        emit LinearUnlockingEndingTimestampUpdated(pool.index, linearUnlockingEndsAt);
        return (true, pool.index);
    }

    function increaseIssuance(uint256 poolIndex, uint256 amount) external returns (bool success) {
        require(amount > 0, "Amount is zero");
        Pool storage pool = _getPool(poolIndex);
        require(getTimestamp() < pool.props.endsAt, "Pool ended");
        address caller = msg.sender;
        _assertPoolOwnership(pool, caller);
        pool.state.issuance = pool.state.issuance.add(amount);
        require(pool.state.issuance <= pool.props.issuanceLimit, "Issuance limit exceeded");
        pool.state.available = pool.state.available.add(amount);
        emit IssuanceIncreased(poolIndex, amount);
        pool.props.issuanceToken.safeTransferFrom(caller, address(this), amount);
        return true;
    }

    function swap(uint256 poolIndex, uint256 requestedPaymentAmount)
        external
        nonReentrant
        returns (uint256 paymentAmount, uint256 issuanceAmount)
    {
        require(requestedPaymentAmount > 0, "Requested payment amount is zero");
        address caller = msg.sender;
        Pool storage pool = _getPool(poolIndex);
        uint256 timestamp = getTimestamp();
        require(timestamp >= pool.props.startsAt, "Pool not started");
        require(timestamp < pool.props.endsAt, "Pool ended");
        require(pool.state.available > 0, "No available issuance");
        (paymentAmount, issuanceAmount) = _calculateSwapAmounts(pool, requestedPaymentAmount, caller);
        Account storage account = pool.accounts[caller];
        if (paymentAmount > 0) {
            pool.state.lockedPayments = pool.state.lockedPayments.add(paymentAmount);
            account.state.paymentSum = account.state.paymentSum.add(paymentAmount);
            pool.props.paymentToken.safeTransferFrom(caller, address(this), paymentAmount);
        }
        if (issuanceAmount > 0) {
            if (pool.type_ == Type.SIMPLE) pool.props.issuanceToken.safeTransfer(caller, issuanceAmount);
            else {
                uint256 totalIssuanceAmount = account.complex.issuanceAmount.add(issuanceAmount);
                account.complex.issuanceAmount = totalIssuanceAmount;
                uint256 newWithdrawnIssuanceAmount = pool.immediatelyUnlockingPart.mul(totalIssuanceAmount).floor();
                uint256 issuanceToWithdraw = newWithdrawnIssuanceAmount - account.complex.withdrawnIssuanceAmount;
                account.complex.withdrawnIssuanceAmount = newWithdrawnIssuanceAmount;
                if (pool.type_ == Type.LINEAR) account.immediatelyUnlockedAmount = newWithdrawnIssuanceAmount;
                if (issuanceToWithdraw > 0) pool.props.issuanceToken.safeTransfer(caller, issuanceToWithdraw);
            }
            pool.state.available = pool.state.available.sub(issuanceAmount);
        }
        emit Swap(poolIndex, caller, requestedPaymentAmount, paymentAmount, issuanceAmount);
    }

    function unlockInterval(uint256 poolIndex, uint256 intervalIndex)
        external
        returns (uint256 withdrawnIssuanceAmount)
    {
        address caller = msg.sender;
        Pool storage pool = _getPool(poolIndex);
        _assertPoolIsInterval(pool);
        require(intervalIndex < pool.intervals.length, "Invalid interval index");
        Interval storage interval = pool.intervals[intervalIndex];
        require(interval.startsAt <= getTimestamp(), "Interval not started");
        Account storage account = pool.accounts[caller];
        require(intervalIndex >= account.unlockedIntervalsCount, "Already unlocked");
        uint256 newWithdrawnIssuanceAmount = interval.unlockingPart.mul(account.complex.issuanceAmount).floor();
        uint256 issuanceToWithdraw = newWithdrawnIssuanceAmount - account.complex.withdrawnIssuanceAmount;
        account.complex.withdrawnIssuanceAmount = newWithdrawnIssuanceAmount;
        if (issuanceToWithdraw > 0) pool.props.issuanceToken.safeTransfer(caller, issuanceToWithdraw);
        account.unlockedIntervalsCount = intervalIndex.add(1);
        return issuanceToWithdraw;
    }

    function unlockLinear(uint256 poolIndex) external returns (uint256 withdrawalAmount) {
        address caller = msg.sender;
        uint256 timestamp = getTimestamp();
        Pool storage pool = _getPool(poolIndex);
        _assertPoolIsLinear(pool);
        require(pool.props.endsAt < timestamp, "Pool not ended");
        Account storage account = pool.accounts[caller];
        uint256 issuanceAmount = account.complex.issuanceAmount;
        require(account.complex.withdrawnIssuanceAmount < issuanceAmount, "All funds already unlocked");
        uint256 passedTime = timestamp - pool.props.endsAt;
        uint256 freezedAmount = issuanceAmount.sub(account.immediatelyUnlockedAmount);
        uint256 unfreezedAmount = passedTime.mul(freezedAmount).div(pool.linear.duration);
        uint256 newWithdrawnIssuanceAmount = timestamp >= pool.linear.endsAt
            ? issuanceAmount
            : Math.min(account.immediatelyUnlockedAmount.add(unfreezedAmount), issuanceAmount);
        withdrawalAmount = newWithdrawnIssuanceAmount.sub(account.complex.withdrawnIssuanceAmount);
        if (withdrawalAmount > 0) {
            account.complex.withdrawnIssuanceAmount = newWithdrawnIssuanceAmount;
            emit LinearPoolUnlocking(pool.index, caller, withdrawalAmount);
            pool.props.issuanceToken.safeTransfer(caller, withdrawalAmount);
        }
    }

    function createPaymentLimit(uint256 poolIndex, uint256 limit) external returns (uint256 limitIndex) {
        Pool storage pool = _getPool(poolIndex);
        _assertPoolOwnership(pool, msg.sender);
        limitIndex = pool.state.paymentLimits.length;
        pool.state.paymentLimits.push(limit);
        emit PaymentLimitCreated(poolIndex, limitIndex, limit);
    }

    function changeLimit(
        uint256 poolIndex,
        uint256 limitIndex,
        uint256 newLimit
    ) external returns (bool success) {
        Pool storage pool = _getPool(poolIndex);
        _assertPoolOwnership(pool, msg.sender);
        _validateLimitIndex(pool, limitIndex);
        pool.state.paymentLimits[limitIndex] = newLimit;
        emit PaymentLimitChanged(poolIndex, limitIndex, newLimit);
        return true;
    }

    function setAccountsLimit(
        uint256 poolIndex,
        uint256 limitIndex,
        address[] memory accounts
    ) external returns (bool succcess) {
        Pool storage pool = _getPool(poolIndex);
        _assertPoolOwnership(pool, msg.sender);
        _validateLimitIndex(pool, limitIndex);
        uint256 accountsCount = accounts.length;
        require(accountsCount > 0, "No accounts provided");
        for (uint256 i = 0; i < accountsCount; i++) {
            address account = accounts[i];
            Account storage poolAccount_ = pool.accounts[account];
            if (poolAccount_.state.limitIndex == limitIndex) continue;
            poolAccount_.state.limitIndex = limitIndex;
            emit AccountLimitChanged(poolIndex, account, limitIndex);
        }
        return true;
    }

    function withdrawPayments(uint256 poolIndex) external returns (bool success) {
        Pool storage pool = _getPool(poolIndex);
        address caller = msg.sender;
        _assertPoolOwnership(pool, caller);
        _unlockPayments(pool);
        uint256 collectedPayments = pool.state.unlockedPayments;
        require(collectedPayments > 0, "No collected payments");
        pool.state.unlockedPayments = 0;
        emit PaymentsWithdrawn(poolIndex, collectedPayments);
        pool.props.paymentToken.safeTransfer(caller, collectedPayments);
        return true;
    }

    function withdrawUnsold(uint256 poolIndex) external returns (bool success) {
        Pool storage pool = _getPool(poolIndex);
        address caller = msg.sender;
        _assertPoolOwnership(pool, caller);
        require(getTimestamp() >= pool.props.endsAt, "Not ended");
        uint256 amount = pool.state.available;
        require(amount > 0, "No unsold");
        pool.state.available = 0;
        emit UnsoldWithdrawn(poolIndex, amount);
        pool.props.issuanceToken.safeTransfer(caller, amount);
        return true;
    }

    function collectFee(uint256 poolIndex) external onlyOwner returns (bool success) {
        _unlockPayments(_getPool(poolIndex));
        return true;
    }

    function withdrawFee(IERC20 token) external onlyOwner returns (bool success) {
        uint256 collectedFee = _collectedFees[token];
        require(collectedFee > 0, "No collected fees");
        _collectedFees[token] = 0;
        emit FeeWithdrawn(address(token), collectedFee);
        token.safeTransfer(owner(), collectedFee);
        return true;
    }

    function nominateNewPoolOwner(uint256 poolIndex, address nominatedOwner_) external returns (bool success) {
        Pool storage pool = _getPool(poolIndex);
        _assertPoolOwnership(pool, msg.sender);
        require(nominatedOwner_ != pool.state.owner, "Already owner");
        if (pool.state.nominatedOwner == nominatedOwner_) return true;
        pool.state.nominatedOwner = nominatedOwner_;
        emit PoolOwnerNominated(poolIndex, nominatedOwner_);
        return true;
    }

    function acceptPoolOwnership(uint256 poolIndex) external returns (bool success) {
        Pool storage pool = _getPool(poolIndex);
        address caller = msg.sender;
        require(pool.state.nominatedOwner == caller, "Not nominated to pool ownership");
        pool.state.owner = caller;
        pool.state.nominatedOwner = address(0);
        emit PoolOwnerChanged(poolIndex, caller);
        return true;
    }

    function _assertPoolIsInterval(Pool storage pool) private view {
        require(pool.type_ == Type.INTERVAL, "Not interval pool");
    }

    function _assertPoolIsLinear(Pool storage pool) private view {
        require(pool.type_ == Type.LINEAR, "Not linear pool");
    }

    function _assertPoolOwnership(Pool storage pool, address account) private view {
        require(account == pool.state.owner, "Permission denied");
    }

    function _calculateSwapAmounts(
        Pool storage pool,
        uint256 requestedPaymentAmount,
        address account
    ) private view returns (uint256 paymentAmount, uint256 issuanceAmount) {
        paymentAmount = requestedPaymentAmount;
        Account storage poolAccount_ = pool.accounts[account];
        uint256 paymentLimit = pool.state.paymentLimits[poolAccount_.state.limitIndex];
        require(poolAccount_.state.paymentSum < paymentLimit, "Account payment limit exceeded");
        if (poolAccount_.state.paymentSum.add(paymentAmount) > paymentLimit) {
            paymentAmount = paymentLimit.sub(poolAccount_.state.paymentSum);
        }
        issuanceAmount = pool.props.rate.mul(paymentAmount).floor();
        if (issuanceAmount > pool.state.available) {
            issuanceAmount = pool.state.available;
            paymentAmount = AttoDecimal.div(issuanceAmount, pool.props.rate).ceil();
        }
    }

    function _getPool(uint256 index) private view returns (Pool storage) {
        require(index < _pools.length, "Pool not found");
        return _pools[index];
    }

    function _validateLimitIndex(Pool storage pool, uint256 limitIndex) private view {
        require(limitIndex < pool.state.paymentLimits.length, "Limit not found");
    }

    function _createSimplePool(
        Props memory props,
        uint256 paymentLimit,
        address owner_,
        Type type_
    ) private returns (Pool storage) {
        {
            uint256 timestamp = getTimestamp();
            if (props.startsAt < timestamp) props.startsAt = timestamp;
            require(props.fee.lt(100), "Fee gte 100%");
            require(props.startsAt < props.endsAt, "Invalid ending timestamp");
        }
        uint256 poolIndex = _pools.length;
        _pools.push();
        Pool storage pool = _pools[poolIndex];
        pool.index = poolIndex;
        pool.type_ = type_;
        pool.props = props;
        pool.state.paymentLimits = new uint256[](1);
        pool.state.paymentLimits[0] = paymentLimit;
        pool.state.owner = owner_;
        emit PoolCreated(
            type_,
            props.paymentToken,
            props.issuanceToken,
            poolIndex,
            props.issuanceLimit,
            props.startsAt,
            props.endsAt,
            props.fee.mantissa,
            props.rate.mantissa,
            paymentLimit
        );
        emit PoolOwnerChanged(poolIndex, owner_);
        return pool;
    }

    function _setImmediatelyUnlockingPart(Pool storage pool, AttoDecimal.Instance memory immediatelyUnlockingPart)
        private
    {
        require(immediatelyUnlockingPart.lt(1), "Invalid immediately unlocking part value");
        pool.immediatelyUnlockingPart = immediatelyUnlockingPart;
        emit ImmediatelyUnlockingPartUpdated(pool.index, immediatelyUnlockingPart.mantissa);
    }

    function _unlockPayments(Pool storage pool) private {
        if (pool.state.lockedPayments == 0) return;
        uint256 fee = pool.props.fee.mul(pool.state.lockedPayments).ceil();
        _collectedFees[pool.props.paymentToken] = _collectedFees[pool.props.paymentToken].add(fee);
        uint256 unlockedAmount = pool.state.lockedPayments.sub(fee);
        pool.state.unlockedPayments = pool.state.unlockedPayments.add(unlockedAmount);
        pool.state.lockedPayments = 0;
        emit PaymentUnlocked(pool.index, unlockedAmount, fee);
    }
}

File 2 of 9 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

File 3 of 9 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 4 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 5 of 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _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 6 of 9 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <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);
    }

    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 7 of 9 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 8 of 9 : AttoDecimal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";

library AttoDecimal {
    using SafeMath for uint256;

    struct Instance {
        uint256 mantissa;
    }

    uint256 internal constant BASE = 10;
    uint256 internal constant EXPONENTIATION = 18;
    uint256 internal constant ONE_MANTISSA = BASE**EXPONENTIATION;
    uint256 internal constant ONE_TENTH_MANTISSA = ONE_MANTISSA / 10;
    uint256 internal constant HALF_MANTISSA = ONE_MANTISSA / 2;
    uint256 internal constant SQUARED_ONE_MANTISSA = ONE_MANTISSA * ONE_MANTISSA;
    uint256 internal constant MAX_INTEGER = uint256(-1) / ONE_MANTISSA;

    function maximum() internal pure returns (Instance memory) {
        return Instance({mantissa: uint256(-1)});
    }

    function zero() internal pure returns (Instance memory) {
        return Instance({mantissa: 0});
    }

    function one() internal pure returns (Instance memory) {
        return Instance({mantissa: ONE_MANTISSA});
    }

    function convert(uint256 integer) internal pure returns (Instance memory) {
        return Instance({mantissa: integer.mul(ONE_MANTISSA)});
    }

    function compare(Instance memory a, Instance memory b) internal pure returns (int8) {
        if (a.mantissa < b.mantissa) return -1;
        return int8(a.mantissa > b.mantissa ? 1 : 0);
    }

    function compare(Instance memory a, uint256 b) internal pure returns (int8) {
        return compare(a, convert(b));
    }

    function add(Instance memory a, Instance memory b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.add(b.mantissa)});
    }

    function add(Instance memory a, uint256 b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.add(b.mul(ONE_MANTISSA))});
    }

    function sub(Instance memory a, Instance memory b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.sub(b.mantissa)});
    }

    function sub(Instance memory a, uint256 b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.sub(b.mul(ONE_MANTISSA))});
    }

    function sub(uint256 a, Instance memory b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mul(ONE_MANTISSA).sub(b.mantissa)});
    }

    function mul(Instance memory a, Instance memory b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.mul(b.mantissa) / ONE_MANTISSA});
    }

    function mul(Instance memory a, uint256 b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.mul(b)});
    }

    function div(Instance memory a, Instance memory b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.mul(ONE_MANTISSA).div(b.mantissa)});
    }

    function div(Instance memory a, uint256 b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.mul(ONE_MANTISSA).div(b)});
    }

    function div(uint256 a, Instance memory b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mul(SQUARED_ONE_MANTISSA).div(b.mantissa)});
    }

    function div(uint256 a, uint256 b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mul(ONE_MANTISSA).div(b)});
    }

    function idiv(Instance memory a, Instance memory b) internal pure returns (uint256) {
        return a.mantissa.div(b.mantissa);
    }

    function idiv(Instance memory a, uint256 b) internal pure returns (uint256) {
        return a.mantissa.div(b.mul(ONE_MANTISSA));
    }

    function idiv(uint256 a, Instance memory b) internal pure returns (uint256) {
        return a.mul(ONE_MANTISSA).div(b.mantissa);
    }

    function mod(Instance memory a, Instance memory b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.mod(b.mantissa)});
    }

    function mod(Instance memory a, uint256 b) internal pure returns (Instance memory) {
        return Instance({mantissa: a.mantissa.mod(b.mul(ONE_MANTISSA))});
    }

    function mod(uint256 a, Instance memory b) internal pure returns (Instance memory) {
        if (a > MAX_INTEGER) return Instance({mantissa: a.mod(b.mantissa).mul(ONE_MANTISSA) % b.mantissa});
        return Instance({mantissa: a.mul(ONE_MANTISSA).mod(b.mantissa)});
    }

    function floor(Instance memory a) internal pure returns (uint256) {
        return a.mantissa / ONE_MANTISSA;
    }

    function ceil(Instance memory a) internal pure returns (uint256) {
        return (a.mantissa / ONE_MANTISSA) + (a.mantissa % ONE_MANTISSA > 0 ? 1 : 0);
    }

    function round(Instance memory a) internal pure returns (uint256) {
        return (a.mantissa / ONE_MANTISSA) + ((a.mantissa / ONE_TENTH_MANTISSA) % 10 >= 5 ? 1 : 0);
    }

    function eq(Instance memory a, Instance memory b) internal pure returns (bool) {
        return a.mantissa == b.mantissa;
    }

    function eq(Instance memory a, uint256 b) internal pure returns (bool) {
        if (b > MAX_INTEGER) return false;
        return a.mantissa == b * ONE_MANTISSA;
    }

    function gt(Instance memory a, Instance memory b) internal pure returns (bool) {
        return a.mantissa > b.mantissa;
    }

    function gt(Instance memory a, uint256 b) internal pure returns (bool) {
        if (b > MAX_INTEGER) return false;
        return a.mantissa > b * ONE_MANTISSA;
    }

    function gte(Instance memory a, Instance memory b) internal pure returns (bool) {
        return a.mantissa >= b.mantissa;
    }

    function gte(Instance memory a, uint256 b) internal pure returns (bool) {
        if (b > MAX_INTEGER) return false;
        return a.mantissa >= b * ONE_MANTISSA;
    }

    function lt(Instance memory a, Instance memory b) internal pure returns (bool) {
        return a.mantissa < b.mantissa;
    }

    function lt(Instance memory a, uint256 b) internal pure returns (bool) {
        if (b > MAX_INTEGER) return true;
        return a.mantissa < b * ONE_MANTISSA;
    }

    function lte(Instance memory a, Instance memory b) internal pure returns (bool) {
        return a.mantissa <= b.mantissa;
    }

    function lte(Instance memory a, uint256 b) internal pure returns (bool) {
        if (b > MAX_INTEGER) return true;
        return a.mantissa <= b * ONE_MANTISSA;
    }

    function isInteger(Instance memory a) internal pure returns (bool) {
        return a.mantissa % ONE_MANTISSA == 0;
    }

    function isPositive(Instance memory a) internal pure returns (bool) {
        return a.mantissa > 0;
    }

    function isZero(Instance memory a) internal pure returns (bool) {
        return a.mantissa == 0;
    }

    function sum(Instance[] memory array) internal pure returns (Instance memory result) {
        uint256 length = array.length;
        for (uint256 index = 0; index < length; index++) result = add(result, array[index]);
    }

    function toTuple(Instance memory a)
        internal
        pure
        returns (
            uint256 mantissa,
            uint256 base,
            uint256 exponentiation
        )
    {
        return (a.mantissa, BASE, EXPONENTIATION);
    }
}

File 9 of 9 : TwoStageOwnable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;

abstract contract TwoStageOwnable {
    address private _nominatedOwner;
    address private _owner;

    function nominatedOwner() public view returns (address) {
        return _nominatedOwner;
    }

    function owner() public view returns (address) {
        return _owner;
    }

    event OwnerChanged(address indexed newOwner);
    event OwnerNominated(address indexed nominatedOwner);

    constructor(address owner_) internal {
        require(owner_ != address(0), "Owner is zero");
        _setOwner(owner_);
    }

    function acceptOwnership() external returns (bool success) {
        require(msg.sender == _nominatedOwner, "Not nominated to ownership");
        _setOwner(_nominatedOwner);
        return true;
    }

    function nominateNewOwner(address owner_) external onlyOwner returns (bool success) {
        _nominateNewOwner(owner_);
        return true;
    }

    modifier onlyOwner {
        require(msg.sender == _owner, "Not owner");
        _;
    }

    function _nominateNewOwner(address owner_) internal {
        if (_nominatedOwner == owner_) return;
        require(_owner != owner_, "Already owner");
        _nominatedOwner = owner_;
        emit OwnerNominated(owner_);
    }

    function _setOwner(address newOwner) internal {
        if (_owner == newOwner) return;
        _owner = newOwner;
        _nominatedOwner = address(0);
        emit OwnerChanged(newOwner);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"address_","type":"address"},{"indexed":true,"internalType":"uint256","name":"limitIndex","type":"uint256"}],"name":"AccountLimitChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeeWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mantissa","type":"uint256"}],"name":"ImmediatelyUnlockingPartUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startsAt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockingPart","type":"uint256"}],"name":"IntervalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"IssuanceIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LinearPoolUnlocking","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"LinearUnlockingEndingTimestampUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nominatedOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"limitIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLimit","type":"uint256"}],"name":"PaymentLimitChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"limitIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"limit","type":"uint256"}],"name":"PaymentLimitCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collectedFee","type":"uint256"}],"name":"PaymentUnlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum FixedSwap.Type","name":"type_","type":"uint8"},{"indexed":true,"internalType":"contract IERC20","name":"paymentToken","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"issuanceToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"issuanceLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startsAt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endsAt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paymentLimit","type":"uint256"}],"name":"PoolCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"PoolOwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"nominatedOwner","type":"address"}],"name":"PoolOwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"requestedPaymentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"issuanceAmount","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnsoldWithdrawn","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"acceptPoolOwnership","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"uint256","name":"limitIndex","type":"uint256"},{"internalType":"uint256","name":"newLimit","type":"uint256"}],"name":"changeLimit","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"collectFee","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"collectedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"issuanceLimit","type":"uint256"},{"internalType":"uint256","name":"startsAt","type":"uint256"},{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"contract IERC20","name":"paymentToken","type":"address"},{"internalType":"contract IERC20","name":"issuanceToken","type":"address"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"fee","type":"tuple"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"rate","type":"tuple"}],"internalType":"struct FixedSwap.Props","name":"props","type":"tuple"},{"internalType":"uint256","name":"paymentLimit","type":"uint256"},{"internalType":"address","name":"owner_","type":"address"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"immediatelyUnlockingPart","type":"tuple"},{"components":[{"internalType":"uint256","name":"startsAt","type":"uint256"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"unlockingPart","type":"tuple"}],"internalType":"struct FixedSwap.Interval[]","name":"intervals","type":"tuple[]"}],"name":"createIntervalPool","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"issuanceLimit","type":"uint256"},{"internalType":"uint256","name":"startsAt","type":"uint256"},{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"contract IERC20","name":"paymentToken","type":"address"},{"internalType":"contract IERC20","name":"issuanceToken","type":"address"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"fee","type":"tuple"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"rate","type":"tuple"}],"internalType":"struct FixedSwap.Props","name":"props","type":"tuple"},{"internalType":"uint256","name":"paymentLimit","type":"uint256"},{"internalType":"address","name":"owner_","type":"address"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"immediatelyUnlockingPart","type":"tuple"},{"internalType":"uint256","name":"linearUnlockingEndsAt","type":"uint256"}],"name":"createLinearPool","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"createPaymentLimit","outputs":[{"internalType":"uint256","name":"limitIndex","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"issuanceLimit","type":"uint256"},{"internalType":"uint256","name":"startsAt","type":"uint256"},{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"contract IERC20","name":"paymentToken","type":"address"},{"internalType":"contract IERC20","name":"issuanceToken","type":"address"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"fee","type":"tuple"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"rate","type":"tuple"}],"internalType":"struct FixedSwap.Props","name":"props","type":"tuple"},{"internalType":"uint256","name":"paymentLimit","type":"uint256"},{"internalType":"address","name":"owner_","type":"address"}],"name":"createSimplePool","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"increaseIssuance","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"address","name":"address_","type":"address"}],"name":"intervalPoolAccount","outputs":[{"components":[{"internalType":"uint256","name":"limitIndex","type":"uint256"},{"internalType":"uint256","name":"paymentSum","type":"uint256"}],"internalType":"struct FixedSwap.AccountState","name":"state","type":"tuple"},{"components":[{"internalType":"uint256","name":"issuanceAmount","type":"uint256"},{"internalType":"uint256","name":"withdrawnIssuanceAmount","type":"uint256"}],"internalType":"struct FixedSwap.ComplexAccountState","name":"complex","type":"tuple"},{"internalType":"uint256","name":"unlockedIntervalsCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"intervalPoolProps","outputs":[{"components":[{"internalType":"uint256","name":"issuanceLimit","type":"uint256"},{"internalType":"uint256","name":"startsAt","type":"uint256"},{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"contract IERC20","name":"paymentToken","type":"address"},{"internalType":"contract IERC20","name":"issuanceToken","type":"address"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"fee","type":"tuple"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"rate","type":"tuple"}],"internalType":"struct FixedSwap.Props","name":"props","type":"tuple"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"immediatelyUnlockingPart","type":"tuple"},{"components":[{"internalType":"uint256","name":"startsAt","type":"uint256"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"unlockingPart","type":"tuple"}],"internalType":"struct FixedSwap.Interval[]","name":"intervals","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"address","name":"address_","type":"address"}],"name":"linearPoolAccount","outputs":[{"components":[{"internalType":"uint256","name":"limitIndex","type":"uint256"},{"internalType":"uint256","name":"paymentSum","type":"uint256"}],"internalType":"struct FixedSwap.AccountState","name":"state","type":"tuple"},{"components":[{"internalType":"uint256","name":"issuanceAmount","type":"uint256"},{"internalType":"uint256","name":"withdrawnIssuanceAmount","type":"uint256"}],"internalType":"struct FixedSwap.ComplexAccountState","name":"complex","type":"tuple"},{"internalType":"uint256","name":"immediatelyUnlockedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"linearPoolProps","outputs":[{"components":[{"internalType":"uint256","name":"issuanceLimit","type":"uint256"},{"internalType":"uint256","name":"startsAt","type":"uint256"},{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"contract IERC20","name":"paymentToken","type":"address"},{"internalType":"contract IERC20","name":"issuanceToken","type":"address"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"fee","type":"tuple"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"rate","type":"tuple"}],"internalType":"struct FixedSwap.Props","name":"props","type":"tuple"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"immediatelyUnlockingPart","type":"tuple"},{"components":[{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"internalType":"struct FixedSwap.LinearProps","name":"linear","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"nominateNewOwner","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"address","name":"nominatedOwner_","type":"address"}],"name":"nominateNewPoolOwner","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"address","name":"address_","type":"address"}],"name":"poolAccount","outputs":[{"internalType":"enum FixedSwap.Type","name":"type_","type":"uint8"},{"components":[{"internalType":"uint256","name":"limitIndex","type":"uint256"},{"internalType":"uint256","name":"paymentSum","type":"uint256"}],"internalType":"struct FixedSwap.AccountState","name":"state","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"poolProps","outputs":[{"internalType":"enum FixedSwap.Type","name":"type_","type":"uint8"},{"components":[{"internalType":"uint256","name":"issuanceLimit","type":"uint256"},{"internalType":"uint256","name":"startsAt","type":"uint256"},{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"contract IERC20","name":"paymentToken","type":"address"},{"internalType":"contract IERC20","name":"issuanceToken","type":"address"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"fee","type":"tuple"},{"components":[{"internalType":"uint256","name":"mantissa","type":"uint256"}],"internalType":"struct AttoDecimal.Instance","name":"rate","type":"tuple"}],"internalType":"struct FixedSwap.Props","name":"props","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"poolState","outputs":[{"components":[{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"issuance","type":"uint256"},{"internalType":"uint256","name":"lockedPayments","type":"uint256"},{"internalType":"uint256","name":"unlockedPayments","type":"uint256"},{"internalType":"address","name":"nominatedOwner","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256[]","name":"paymentLimits","type":"uint256[]"}],"internalType":"struct FixedSwap.State","name":"state","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"uint256","name":"limitIndex","type":"uint256"},{"internalType":"address[]","name":"accounts","type":"address[]"}],"name":"setAccountsLimit","outputs":[{"internalType":"bool","name":"succcess","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"uint256","name":"requestedPaymentAmount","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"internalType":"uint256","name":"issuanceAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"internalType":"uint256","name":"intervalIndex","type":"uint256"}],"name":"unlockInterval","outputs":[{"internalType":"uint256","name":"withdrawnIssuanceAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"unlockLinear","outputs":[{"internalType":"uint256","name":"withdrawalAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"withdrawFee","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"withdrawPayments","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"withdrawUnsold","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620036193803806200361983398101604081905262000034916200010b565b6001600055806001600160a01b03811662000086576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200007d906200013b565b60405180910390fd5b620000918162000099565b505062000172565b6002546001600160a01b0382811691161415620000b65762000108565b600280546001600160a01b0383166001600160a01b031991821681179092556001805490911690556040517fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf3690600090a25b50565b6000602082840312156200011d578081fd5b81516001600160a01b038116811462000134578182fd5b9392505050565b6020808252600d908201527f4f776e6572206973207a65726f00000000000000000000000000000000000000604082015260600190565b61349780620001826000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80638da5cb5b11610104578063bcde0451116100a2578063e43b156011610071578063e43b156014610417578063ee90ac8214610438578063f63d8d321461044b578063f6f94e2c1461045e576101cf565b8063bcde0451146103ae578063beaa1176146103c1578063ceec13ff146103d4578063d96073cf146103f6576101cf565b8063a90101fb116100de578063a90101fb14610362578063a969ff0a14610375578063ae4ff9dc14610388578063b333ad871461039b576101cf565b80638da5cb5b1461032657806398ecde321461032e5780639a419e2e1461034f576101cf565b806344e4b97b116101715780636ccc56cd1161014b5780636ccc56cd146102e357806376d6ffa11461030357806379ba5097146103165780638c788de01461031e576101cf565b806344e4b97b1461029a57806346f75858146102bb57806353a47bb7146102ce576101cf565b80631cead9a7116101ad5780631cead9a71461023257806323fc3136146102525780632f9afafc1461026557806341975af814610287576101cf565b8063059332ec146101d45780631627540c146101ff5780631ac3ddeb1461021f575b600080fd5b6101e76101e23660046127f7565b610471565b6040516101f6939291906132da565b60405180910390f35b61021261020d366004612611565b61053f565b6040516101f69190612a0f565b61021261022d366004612611565b610587565b610245610240366004612611565b610662565b6040516101f691906133a1565b61021261026036600461285f565b61067d565b6102786102733660046127f7565b610767565b6040516101f69392919061326e565b6102126102953660046127f7565b61088e565b6102ad6102a836600461279b565b610937565b6040516101f6929190612a1a565b6102126102c93660046127f7565b610a08565b6102d6610aa6565b6040516101f691906129be565b6102f66102f13660046127f7565b610ab5565b6040516101f691906132fe565b6102456103113660046127f7565b610b79565b610212610d02565b610245610d4a565b6102d6610d50565b61034161033c3660046127f7565b610d5f565b6040516101f6929190612a48565b61024561035d36600461283e565b610df3565b61021261037036600461280f565b610e6c565b6102126103833660046127f7565b610f2d565b6102126103963660046127f7565b610f6b565b6102126103a936600461283e565b61102b565b6102ad6103bc36600461268f565b611130565b6102ad6103cf36600461264d565b6112cb565b6103e76103e236600461280f565b611319565b6040516101f693929190613245565b61040961040436600461283e565b6113a2565b6040516101f69291906133aa565b61042a61042536600461280f565b61161e565b6040516101f6929190612a2a565b61021261044636600461290c565b611677565b6103e761045936600461280f565b6116fe565b61024561046c36600461283e565b611787565b61047961240c565b610481612466565b610489612479565b6000610494856118be565b905061049f81611904565b6040805160e08101825260038301548152600483015460208083019190915260058401548284015260068401546001600160a01b0390811660608401526007850154166080830152825180820184526008850154815260a0830152825180820184526009850154815260c083015282518082018452600285015481528351808501909452600a8501548452600b9094015490830152969195509350915050565b6002546000906001600160a01b031633146105755760405162461bcd60e51b815260040161056c9061302c565b60405180910390fd5b61057e82611936565b5060015b919050565b6002546000906001600160a01b031633146105b45760405162461bcd60e51b815260040161056c9061302c565b6001600160a01b038216600090815260046020526040902054806105ea5760405162461bcd60e51b815260040161056c90613001565b6001600160a01b03831660008181526004602052604080822091909155517f78473f3f373f7673597f4f0fa5873cb4d375fea6d4339ad6b56dbd411513cb3f906106359084906133a1565b60405180910390a2610659610648610d50565b6001600160a01b03851690836119c9565b50600192915050565b6001600160a01b031660009081526004602052604090205490565b600080610689856118be565b90506106958133611a24565b61069f8185611a57565b8251806106be5760405162461bcd60e51b815260040161056c90612b14565b60005b818110156107585760008582815181106106d757fe5b6020908102919091018101516001600160a01b0381166000908152601487019092526040909120805491925090881415610712575050610750565b87815560405188906001600160a01b038416908b907fd98eb3f94d757b6a35fcfb91cf696b9bc1a78ec87a7378e0b0429bc21386bb3b90600090a450505b6001016106c1565b506001925050505b9392505050565b61076f61240c565b610777612466565b60606000610784856118be565b905061078f81611a7a565b6040805160e08101825260038301548152600483015460208083019190915260058401548284015260068401546001600160a01b0390811660608401526007850154166080830152825180820184526008850154815260a0830152825180820184526009850154815260c0830152825180820184526002850154815260138501805485518185028101850190965280865293949193909283919060009084015b8282101561087a57600084815260209081902060408051808201825260028602909201805483528151808501909252600190810154825282840191909152908352909201910161082f565b505050509050935093509350509193909250565b60008061089a836118be565b9050336108a78282611a24565b6108b082611aa9565b600f820154806108d25760405162461bcd60e51b815260040161056c90612c50565b6000600f84015560405185907fa21048fafbb2c049d83f70c98e05b976cf8f1e5f767ef698a6fdb1e7444c28289061090b9084906133a1565b60405180910390a2600683015461092c906001600160a01b031683836119c9565b506001949350505050565b60025460009081906001600160a01b031633146109665760405162461bcd60e51b815260040161056c9061302c565b866040015183116109895760405162461bcd60e51b815260040161056c90612d4c565b60006109988888886002611b9e565b90506109a48186611e0f565b600a81018490556040808901518503600b830155600182015490517f09fff9e1458ed4445723dc13dc4b99f6ae814f666b62ac4d767dd5b942744943906109ec9087906133a1565b60405180910390a2600190810154909890975095505050505050565b600080610a14836118be565b601081015490915033906001600160a01b03168114610a455760405162461bcd60e51b815260040161056c90612c19565b6011820180546001600160a01b0383166001600160a01b03199182168117909255601084018054909116905560405185907f1db9920ce261cf5299c96ab18ed9969b1b467e3ac5f5e7a33656d6471495cf0790600090a35060019392505050565b6001546001600160a01b031690565b610abd612493565b610ac6826118be565b6040805160e081018252600c830180548252600d840154602080840191909152600e85015483850152600f850154606084015260108501546001600160a01b03908116608085015260118601541660a0840152601290940180548451818702810187019095528085529294919360c08601939092830182828015610b6957602002820191906000526020600020905b815481526020019060010190808311610b55575b5050505050815250509050919050565b60003381610b85611e81565b90506000610b92856118be565b9050610b9d81611904565b60058101548211610bc05760405162461bcd60e51b815260040161056c90612e5a565b6001600160a01b03831660009081526014820160205260409020600281015460038201548111610c025760405162461bcd60e51b815260040161056c90612fca565b6005830154600483015490850390600090610c1e908490611e85565b600b860154909150600090610c3d90610c378585611ec7565b90611f01565b9050600086600a0160000154881015610c6e576004860154610c6990610c639084611f43565b86611f68565b610c70565b845b6003870154909150610c83908290611e85565b99508915610cf4576003860181905560018701546040516001600160a01b038b1691907f238e86f4971c795f36cd7b184dc9e65155fad7d6cf7dc94da2ced659781b653c90610cd3908e906133a1565b60405180910390a36007870154610cf4906001600160a01b03168a8c6119c9565b505050505050505050919050565b6001546000906001600160a01b03163314610d2f5760405162461bcd60e51b815260040161056c90612f93565b600154610d44906001600160a01b0316611f7e565b50600190565b60035490565b6002546001600160a01b031690565b6000610d6961240c565b6000610d74846118be565b80546040805160e08101825260038401548152600484015460208083019190915260058501548284015260068501546001600160a01b0390811660608401526007860154166080830152825180820184526008860154815260a08301528251908101909252600990930154815260c083015260ff169350915050915091565b600080610dff846118be565b9050610e0b8133611a24565b601281018054600181018255600091825260209091208101849055604051909250829085907f123042b7c2ada7097e3ab9d05b9dd5b54bab274a5690d2e16a2316f6e274844a90610e5d9087906133a1565b60405180910390a35092915050565b600080610e78846118be565b9050610e848133611a24565b60118101546001600160a01b0384811691161415610eb45760405162461bcd60e51b815260040161056c90612f3e565b60108101546001600160a01b0384811691161415610ed6576001915050610f27565b6010810180546001600160a01b0319166001600160a01b03851690811790915560405185907fceff235f9d95a8aba06f4cf159261832d21ce128a9e450e75c5f32faeb2df8e290600090a360019150505b92915050565b6002546000906001600160a01b03163314610f5a5760405162461bcd60e51b815260040161056c9061302c565b61057e610f66836118be565b611aa9565b600080610f77836118be565b905033610f848282611a24565b6005820154610f91611e81565b1015610faf5760405162461bcd60e51b815260040161056c90613072565b600c82015480610fd15760405162461bcd60e51b815260040161056c9061304f565b6000600c84015560405185907f4caa9523353802828989b84b2bb248c625aeb6d44999cd9ba0fe7e15711f3db79061100a9084906133a1565b60405180910390a2600783015461092c906001600160a01b031683836119c9565b600080821161104c5760405162461bcd60e51b815260040161056c90612eac565b6000611057846118be565b6005810154909150611067611e81565b106110845760405162461bcd60e51b815260040161056c90612e36565b3361108f8282611a24565b600d82015461109e9085611f43565b600d8301819055600383015410156110c85760405162461bcd60e51b815260040161056c90612d15565b600c8201546110d79085611f43565b600c83015560405185907f4ef8678904704bdf752e12cfb17a926ce33dcaf9077e565fb660cfe644ed22649061110e9087906133a1565b60405180910390a2600782015461092c906001600160a01b0316823087611fed565b60025460009081906001600160a01b0316331461115f5760405162461bcd60e51b815260040161056c9061302c565b600061116e8888886001611b9e565b905061117a8186611e0f565b8351611184612466565b50604089015186906000190160005b8381101561128c576111a36124e2565b8882815181106111af57fe5b602002602001015190506111d084826020015161201490919063ffffffff16565b6111ec5760405162461bcd60e51b815260040161056c90612add565b602081015181519094508381116112155760405162461bcd60e51b815260040161056c90612b68565b60138701805460018181018355600092835260209283902085516002909302018281559285015151920182905560405192955085928a927f9ad21f79ce9c3c640f4c7e4d5cccb24f33967153042855c93f33f9cb457b70959261127a929091906133aa565b60405180910390a25050600101611193565b5061129882600161201b565b6112b45760405162461bcd60e51b815260040161056c90612cde565b505050600190810154909890975095505050505050565b60025460009081906001600160a01b031633146112fa5760405162461bcd60e51b815260040161056c9061302c565b60016113098686866000611b9e565b6001015491509150935093915050565b611321612479565b611329612479565b600080611335866118be565b905061134081611904565b6001600160a01b0385166000908152601490910160209081526040918290206004810154835180850185528254815260018301548185015284518086019095526002830154855260039092015492840192909252945090925090509250925092565b600080600260005414156113c85760405162461bcd60e51b815260040161056c9061316e565b6002600055826113ea5760405162461bcd60e51b815260040161056c90612c7f565b3360006113f6866118be565b90506000611402611e81565b60048301549091508110156114295760405162461bcd60e51b815260040161056c90612cb4565b6005820154811061144c5760405162461bcd60e51b815260040161056c90612e36565b600c82015461146d5760405162461bcd60e51b815260040161056c906130cc565b611478828785612059565b6001600160a01b03851660009081526014850160205260409020919650945085156114df57600e8301546114ac9087611f43565b600e84015560018101546114c09087611f43565b600182015560068301546114df906001600160a01b0316853089611fed565b84156115c6576000835460ff1660028111156114f757fe5b141561151b576007830154611516906001600160a01b031685876119c9565b6115b1565b600281015460009061152d9087611f43565b6002808401829055604080516020810190915290860154815290915060009061155f9061155a908461214c565b612176565b6003840180549082905590915081036002865460ff16600281111561158057fe5b141561158e57600484018290555b80156115ad5760078601546115ad906001600160a01b031688836119c9565b5050505b600c8301546115c09086611e85565b600c8401555b836001600160a01b0316887f7d421bbd3ba855339632fdd240923952de83fd611d837a284506157b596f4932898989604051611604939291906133b8565b60405180910390a350506001600055509194909350915050565b6000611628612479565b6000611633856118be565b80546001600160a01b038616600090815260149092016020908152604092839020835180850190945280548452600101549083015260ff1693509150509250929050565b600080611683856118be565b905061168f8133611a24565b6116998185611a57565b8281600c0160060185815481106116ac57fe5b906000526020600020018190555083857fc128898667140122862a239400b6468386a01fb68fe432ebe587a84166d241ad856040516116eb91906133a1565b60405180910390a3506001949350505050565b611706612479565b61170e612479565b60008061171a866118be565b905061172581611a7a565b6001600160a01b0385166000908152601490910160209081526040918290206005810154835180850185528254815260018301548185015284518086019095526002830154855260039092015492840192909252945090925090509250925092565b60003381611794856118be565b905061179f81611a7a565b601381015484106117c25760405162461bcd60e51b815260040161056c906131a5565b60008160130185815481106117d357fe5b906000526020600020906002020190506117eb611e81565b8154111561180b5760405162461bcd60e51b815260040161056c90612f65565b6001600160a01b0383166000908152601483016020526040902060058101548610156118495760405162461bcd60e51b815260040161056c90612e82565b60028101546040805160208101909152600184015481526000916118709161155a9161214c565b600383018054908290559091508103801561189e57600785015461189e906001600160a01b031687836119c9565b6118a9886001611f43565b60059093019290925550935050505092915050565b60035460009082106118e25760405162461bcd60e51b815260040161056c9061321d565b600382815481106118ef57fe5b90600052602060002090601502019050919050565b6002815460ff16600281111561191657fe5b146119335760405162461bcd60e51b815260040161056c90612ed4565b50565b6001546001600160a01b038281169116141561195157611933565b6002546001600160a01b038281169116141561197f5760405162461bcd60e51b815260040161056c90612f3e565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290600090a250565b611a1f8363a9059cbb60e01b84846040516024016119e89291906129f6565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612185565b505050565b60118201546001600160a01b03828116911614611a535760405162461bcd60e51b815260040161056c90612e0b565b5050565b60128201548110611a535760405162461bcd60e51b815260040161056c90613145565b6001815460ff166002811115611a8c57fe5b146119335760405162461bcd60e51b815260040161056c90612da9565b600e810154611ab757611933565b600e810154604080516020810190915260088301548152600091611ae391611ade9161214c565b612214565b60068301546001600160a01b0316600090815260046020526040902054909150611b0d9082611f43565b60068301546001600160a01b0316600090815260046020526040812091909155600e830154611b3c9083611e85565b600f840154909150611b4e9082611f43565b600f8401556000600e84015560018301546040517f969043bab89ac5dd319ed2e1356119888d1624898734ac8516a120bea7fb426090611b9190849086906133aa565b60405180910390a2505050565b600080611ba9611e81565b90508086602001511015611bbf57602086018190525b60a0860151611bcf90606461224e565b611beb5760405162461bcd60e51b815260040161056c90612b42565b8560400151866020015110611c125760405162461bcd60e51b815260040161056c90612dd4565b506003805460018101808355600083815291929083908110611c3057fe5b60009182526020909120600160159092020181810184905580549092508591839160ff191690836002811115611c6257fe5b0217905550865160038201556020808801516004830155604080890151600584015560608901516006840180546001600160a01b039283166001600160a01b03199182161790915560808b015160078601805491909316911617905560a089015151600884015560c08901515160098401558051600180825281830190925291828101908036833750508151611d0192601285019250602001906124fc565b508581600c01600601600081548110611d1657fe5b90600052602060002001819055508481600c0160050160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555086608001516001600160a01b031687606001516001600160a01b03167f6d0a80f2ee73de8861b1887eb263d606bb9e1b85beff2d71b45b913b0f9aed3186858b600001518c602001518d604001518e60a00151600001518f60c00151600001518f604051611dc5989796959493929190612a65565b60405180910390a36040516001600160a01b0386169083907f1db9920ce261cf5299c96ab18ed9969b1b467e3ac5f5e7a33656d6471495cf0790600090a39150505b949350505050565b611e1a81600161224e565b611e365760405162461bcd60e51b815260040161056c906131d5565b805160028301819055600183015460405190917f4b934b79ea913cbf45273ed2d6516ef75fd53b22d460b29bfc3627bdda76103f91611e7591906133a1565b60405180910390a25050565b4290565b600061076083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061228c565b600082611ed657506000610f27565b82820282848281611ee357fe5b04146107605760405162461bcd60e51b815260040161056c90612efd565b600061076083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122b8565b6000828201838110156107605760405162461bcd60e51b815260040161056c90612be2565b6000818310611f775781610760565b5090919050565b6002546001600160a01b0382811691161415611f9957611933565b600280546001600160a01b0383166001600160a01b031991821681179092556001805490911690556040517fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf3690600090a250565b61200e846323b872dd60e01b8585856040516024016119e8939291906129d2565b50505050565b5190511190565b60007812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f2182111561204657506000610f27565b509051670de0b6b3a76400009091021490565b6001600160a01b03811660009081526014840160205260408120805460128601805486949392849291811061208a57fe5b90600052602060002001549050808260000160010154106120bd5760405162461bcd60e51b815260040161056c90612bab565b600182015481906120ce9086611f43565b11156120e75760018201546120e4908290611e85565b93505b6040805160208101909152600988015481526121079061155a908661214c565b600c88015490935083111561214257600c87015460408051602081019091526009890154815290935061213f90611ade9085906122ef565b93505b5050935093915050565b612154612466565b60408051602081019091528351819061216d9085611ec7565b90529392505050565b51670de0b6b3a7640000900490565b60606121da826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123239092919063ffffffff16565b805190915015611a1f57808060200190518101906121f8919061262d565b611a1f5760405162461bcd60e51b815260040161056c906130fb565b8051600090670de0b6b3a7640000900661222f576000612232565b60015b60ff166012600a0a83600001518161224657fe5b040192915050565b60007812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f2182111561227957506001610f27565b509051670de0b6b3a76400009091021190565b600081848411156122b05760405162461bcd60e51b815260040161056c9190612aaa565b505050900390565b600081836122d95760405162461bcd60e51b815260040161056c9190612aaa565b5060008385816122e557fe5b0495945050505050565b6122f7612466565b60408051602081019091528251819061216d90610c37876ec097ce7bc90715b34b9f1000000000611ec7565b6060611e07848460008585612337856123cd565b6123535760405162461bcd60e51b815260040161056c90613095565b60006060866001600160a01b0316858760405161237091906129a2565b60006040518083038185875af1925050503d80600081146123ad576040519150601f19603f3d011682016040523d82523d6000602084013e6123b2565b606091505b50915091506123c28282866123d3565b979650505050505050565b3b151590565b606083156123e2575081610760565b8251156123f25782518084602001fd5b8160405162461bcd60e51b815260040161056c9190612aaa565b6040518060e0016040528060008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b03168152602001612454612466565b8152602001612461612466565b905290565b6040518060200160405280600081525090565b604051806040016040528060008152602001600081525090565b6040518060e001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b03168152602001606081525090565b604051806040016040528060008152602001612461612466565b828054828255906000526020600020908101928215612537579160200282015b8281111561253757825182559160200191906001019061251c565b50612543929150612547565b5090565b5b808211156125435760008155600101612548565b8035610f278161344c565b600060208284031215612578578081fd5b61258260206133ce565b9135825250919050565b600060e0828403121561259d578081fd5b6125a760e06133ce565b905081358152602082013560208201526040820135604082015260608201356125cf8161344c565b606082015260808201356125e28161344c565b60808201526125f48360a08401612567565b60a08201526126068360c08401612567565b60c082015292915050565b600060208284031215612622578081fd5b81356107608161344c565b60006020828403121561263e578081fd5b81518015158114610760578182fd5b60008060006101208486031215612662578182fd5b61266c858561258c565b925060e084013591506101008401356126848161344c565b809150509250925092565b600080600080600061016086880312156126a7578081fd5b6126b1878761258c565b945060e086013593506101008601356126c98161344c565b92506126d9876101208801612567565b915061014086013567ffffffffffffffff8111156126f5578182fd5b8601601f81018813612705578182fd5b8035612718612713826133f5565b6133ce565b808282526020808301925080850160408d83828802890101111561273a578788fd5b8796505b858710156127875780828f031215612754578788fd5b61275d816133ce565b8235815261276d8f858501612567565b81850152855260019690960195938201939081019061273e565b505050809450505050509295509295909350565b600080600080600061016086880312156127b3578081fd5b6127bd878761258c565b945060e086013593506101008601356127d58161344c565b92506127e5876101208801612567565b94979396509194610140013592915050565b600060208284031215612808578081fd5b5035919050565b60008060408385031215612821578182fd5b8235915060208301356128338161344c565b809150509250929050565b60008060408385031215612850578182fd5b50508035926020909101359150565b600080600060608486031215612873578283fd5b833592506020808501359250604085013567ffffffffffffffff811115612898578283fd5b8501601f810187136128a8578283fd5b80356128b6612713826133f5565b81815283810190838501858402850186018b10156128d2578687fd5b8694505b838510156128fc576128e88b8261255c565b8352600194909401939185019185016128d6565b5080955050505050509250925092565b600080600060608486031215612920578081fd5b505081359360208301359350604090920135919050565b815260200190565b80518252602090810151910152565b805182526020810151602083015260408101516040830152606081015160018060a01b038082166060850152806080840151166080850152505060a08101515160a083015260c08101515160c08301525050565b600082516129b4818460208701613420565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b9115158252602082015260400190565b6060810160038410612a3857fe5b838252610760602083018461293f565b6101008101612a5684613415565b8252610760602083018461294e565b6101008101612a738a613415565b8252602082019890985260408101969096526060860194909452608085019290925260a084015260c083015260e090910152919050565b6000602082528251806020840152612ac9816040850160208701613420565b601f01601f19169190910160400192915050565b6020808252601f908201527f496e76616c696420696e74657276616c20756e6c6f636b696e67207061727400604082015260600190565b602080825260149082015273139bc81858d8dbdd5b9d1cc81c1c9bdd9a59195960621b604082015260600190565b6020808252600c908201526b46656520677465203130302560a01b604082015260600190565b60208082526023908201527f496e76616c696420696e74657276616c207374617274696e672074696d6573746040820152620616d760ec1b606082015260800190565b6020808252601e908201527f4163636f756e74207061796d656e74206c696d69742065786365656465640000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f4e6f74206e6f6d696e6174656420746f20706f6f6c206f776e65727368697000604082015260600190565b6020808252601590820152744e6f20636f6c6c6563746564207061796d656e747360581b604082015260600190565b6020808252818101527f526571756573746564207061796d656e7420616d6f756e74206973207a65726f604082015260600190565b60208082526010908201526f141bdbdb081b9bdd081cdd185c9d195960821b604082015260600190565b6020808252601f908201527f556e6c6f636b696e672070617274206e6f7420657175616c20746f206f6e6500604082015260600190565b60208082526017908201527f49737375616e6365206c696d6974206578636565646564000000000000000000604082015260600190565b6020808252603c908201527f4c696e65617220756e6c6f636b696e67206c657373207468616e206f7220657160408201527f75616c20746f20706f6f6c20656e64696e672074696d657374616d7000000000606082015260800190565b602080825260119082015270139bdd081a5b9d195c9d985b081c1bdbdb607a1b604082015260600190565b60208082526018908201527f496e76616c696420656e64696e672074696d657374616d700000000000000000604082015260600190565b60208082526011908201527014195c9b5a5cdcda5bdb8819195b9a5959607a1b604082015260600190565b6020808252600a9082015269141bdbdb08195b99195960b21b604082015260600190565b6020808252600e908201526d141bdbdb081b9bdd08195b99195960921b604082015260600190565b60208082526010908201526f105b1c9958591e481d5b9b1bd8dad95960821b604082015260600190565b6020808252600e908201526d416d6f756e74206973207a65726f60901b604082015260600190565b6020808252600f908201526e139bdd081b1a5b99585c881c1bdbdb608a1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252600d908201526c20b63932b0b23c9037bbb732b960991b604082015260600190565b602080825260149082015273125b9d195c9d985b081b9bdd081cdd185c9d195960621b604082015260600190565b6020808252601a908201527f4e6f74206e6f6d696e6174656420746f206f776e657273686970000000000000604082015260600190565b6020808252601a908201527f416c6c2066756e647320616c726561647920756e6c6f636b6564000000000000604082015260600190565b6020808252601190820152704e6f20636f6c6c6563746564206665657360781b604082015260600190565b6020808252600990820152682737ba1037bbb732b960b91b604082015260600190565b602080825260099082015268139bc81d5b9cdbdb1960ba1b604082015260600190565b602080825260099082015268139bdd08195b99195960ba1b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601590820152744e6f20617661696c61626c652069737375616e636560581b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252600f908201526e131a5b5a5d081b9bdd08199bdd5b99608a1b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602080825260169082015275092dcecc2d8d2c840d2dce8cae4ecc2d840d2dcc8caf60531b604082015260600190565b60208082526028908201527f496e76616c696420696d6d6564696174656c7920756e6c6f636b696e6720706160408201526772742076616c756560c01b606082015260800190565b6020808252600e908201526d141bdbdb081b9bdd08199bdd5b9960921b604082015260600190565b60a08101613253828661293f565b613260604083018561293f565b826080830152949350505050565b6000610120808301613280848861294e565b855160e0850152610100840191909152835190819052610140830190602090818601845b828110156132cc578151805186528401515184860152604090940193908301906001016132a4565b509298975050505050505050565b61014081016132e9828661294e565b835160e0830152611e0761010083018461293f565b6000602080835261010083018451828501528185015160408501526040850151606085015260608501516080850152608085015160018060a01b0380821660a08701528060a08801511660c0870152505060c085015160e08086015281815161336781856133a1565b9285019350859291505b8083101561339657613384828551612937565b91508484019350600183019250613371565b509695505050505050565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff811182821017156133ed57600080fd5b604052919050565b600067ffffffffffffffff82111561340b578081fd5b5060209081020190565b806003811061058257fe5b60005b8381101561343b578181015183820152602001613423565b8381111561200e5750506000910152565b6001600160a01b038116811461193357600080fdfea2646970667358221220e7863b28d7b6082e040393f913a2d938617eca21f680fb4c41e0f3573910c4c864736f6c634300060c003300000000000000000000000021ddf70bfb842e9eed59df7af411fc602d7eed4b

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80638da5cb5b11610104578063bcde0451116100a2578063e43b156011610071578063e43b156014610417578063ee90ac8214610438578063f63d8d321461044b578063f6f94e2c1461045e576101cf565b8063bcde0451146103ae578063beaa1176146103c1578063ceec13ff146103d4578063d96073cf146103f6576101cf565b8063a90101fb116100de578063a90101fb14610362578063a969ff0a14610375578063ae4ff9dc14610388578063b333ad871461039b576101cf565b80638da5cb5b1461032657806398ecde321461032e5780639a419e2e1461034f576101cf565b806344e4b97b116101715780636ccc56cd1161014b5780636ccc56cd146102e357806376d6ffa11461030357806379ba5097146103165780638c788de01461031e576101cf565b806344e4b97b1461029a57806346f75858146102bb57806353a47bb7146102ce576101cf565b80631cead9a7116101ad5780631cead9a71461023257806323fc3136146102525780632f9afafc1461026557806341975af814610287576101cf565b8063059332ec146101d45780631627540c146101ff5780631ac3ddeb1461021f575b600080fd5b6101e76101e23660046127f7565b610471565b6040516101f6939291906132da565b60405180910390f35b61021261020d366004612611565b61053f565b6040516101f69190612a0f565b61021261022d366004612611565b610587565b610245610240366004612611565b610662565b6040516101f691906133a1565b61021261026036600461285f565b61067d565b6102786102733660046127f7565b610767565b6040516101f69392919061326e565b6102126102953660046127f7565b61088e565b6102ad6102a836600461279b565b610937565b6040516101f6929190612a1a565b6102126102c93660046127f7565b610a08565b6102d6610aa6565b6040516101f691906129be565b6102f66102f13660046127f7565b610ab5565b6040516101f691906132fe565b6102456103113660046127f7565b610b79565b610212610d02565b610245610d4a565b6102d6610d50565b61034161033c3660046127f7565b610d5f565b6040516101f6929190612a48565b61024561035d36600461283e565b610df3565b61021261037036600461280f565b610e6c565b6102126103833660046127f7565b610f2d565b6102126103963660046127f7565b610f6b565b6102126103a936600461283e565b61102b565b6102ad6103bc36600461268f565b611130565b6102ad6103cf36600461264d565b6112cb565b6103e76103e236600461280f565b611319565b6040516101f693929190613245565b61040961040436600461283e565b6113a2565b6040516101f69291906133aa565b61042a61042536600461280f565b61161e565b6040516101f6929190612a2a565b61021261044636600461290c565b611677565b6103e761045936600461280f565b6116fe565b61024561046c36600461283e565b611787565b61047961240c565b610481612466565b610489612479565b6000610494856118be565b905061049f81611904565b6040805160e08101825260038301548152600483015460208083019190915260058401548284015260068401546001600160a01b0390811660608401526007850154166080830152825180820184526008850154815260a0830152825180820184526009850154815260c083015282518082018452600285015481528351808501909452600a8501548452600b9094015490830152969195509350915050565b6002546000906001600160a01b031633146105755760405162461bcd60e51b815260040161056c9061302c565b60405180910390fd5b61057e82611936565b5060015b919050565b6002546000906001600160a01b031633146105b45760405162461bcd60e51b815260040161056c9061302c565b6001600160a01b038216600090815260046020526040902054806105ea5760405162461bcd60e51b815260040161056c90613001565b6001600160a01b03831660008181526004602052604080822091909155517f78473f3f373f7673597f4f0fa5873cb4d375fea6d4339ad6b56dbd411513cb3f906106359084906133a1565b60405180910390a2610659610648610d50565b6001600160a01b03851690836119c9565b50600192915050565b6001600160a01b031660009081526004602052604090205490565b600080610689856118be565b90506106958133611a24565b61069f8185611a57565b8251806106be5760405162461bcd60e51b815260040161056c90612b14565b60005b818110156107585760008582815181106106d757fe5b6020908102919091018101516001600160a01b0381166000908152601487019092526040909120805491925090881415610712575050610750565b87815560405188906001600160a01b038416908b907fd98eb3f94d757b6a35fcfb91cf696b9bc1a78ec87a7378e0b0429bc21386bb3b90600090a450505b6001016106c1565b506001925050505b9392505050565b61076f61240c565b610777612466565b60606000610784856118be565b905061078f81611a7a565b6040805160e08101825260038301548152600483015460208083019190915260058401548284015260068401546001600160a01b0390811660608401526007850154166080830152825180820184526008850154815260a0830152825180820184526009850154815260c0830152825180820184526002850154815260138501805485518185028101850190965280865293949193909283919060009084015b8282101561087a57600084815260209081902060408051808201825260028602909201805483528151808501909252600190810154825282840191909152908352909201910161082f565b505050509050935093509350509193909250565b60008061089a836118be565b9050336108a78282611a24565b6108b082611aa9565b600f820154806108d25760405162461bcd60e51b815260040161056c90612c50565b6000600f84015560405185907fa21048fafbb2c049d83f70c98e05b976cf8f1e5f767ef698a6fdb1e7444c28289061090b9084906133a1565b60405180910390a2600683015461092c906001600160a01b031683836119c9565b506001949350505050565b60025460009081906001600160a01b031633146109665760405162461bcd60e51b815260040161056c9061302c565b866040015183116109895760405162461bcd60e51b815260040161056c90612d4c565b60006109988888886002611b9e565b90506109a48186611e0f565b600a81018490556040808901518503600b830155600182015490517f09fff9e1458ed4445723dc13dc4b99f6ae814f666b62ac4d767dd5b942744943906109ec9087906133a1565b60405180910390a2600190810154909890975095505050505050565b600080610a14836118be565b601081015490915033906001600160a01b03168114610a455760405162461bcd60e51b815260040161056c90612c19565b6011820180546001600160a01b0383166001600160a01b03199182168117909255601084018054909116905560405185907f1db9920ce261cf5299c96ab18ed9969b1b467e3ac5f5e7a33656d6471495cf0790600090a35060019392505050565b6001546001600160a01b031690565b610abd612493565b610ac6826118be565b6040805160e081018252600c830180548252600d840154602080840191909152600e85015483850152600f850154606084015260108501546001600160a01b03908116608085015260118601541660a0840152601290940180548451818702810187019095528085529294919360c08601939092830182828015610b6957602002820191906000526020600020905b815481526020019060010190808311610b55575b5050505050815250509050919050565b60003381610b85611e81565b90506000610b92856118be565b9050610b9d81611904565b60058101548211610bc05760405162461bcd60e51b815260040161056c90612e5a565b6001600160a01b03831660009081526014820160205260409020600281015460038201548111610c025760405162461bcd60e51b815260040161056c90612fca565b6005830154600483015490850390600090610c1e908490611e85565b600b860154909150600090610c3d90610c378585611ec7565b90611f01565b9050600086600a0160000154881015610c6e576004860154610c6990610c639084611f43565b86611f68565b610c70565b845b6003870154909150610c83908290611e85565b99508915610cf4576003860181905560018701546040516001600160a01b038b1691907f238e86f4971c795f36cd7b184dc9e65155fad7d6cf7dc94da2ced659781b653c90610cd3908e906133a1565b60405180910390a36007870154610cf4906001600160a01b03168a8c6119c9565b505050505050505050919050565b6001546000906001600160a01b03163314610d2f5760405162461bcd60e51b815260040161056c90612f93565b600154610d44906001600160a01b0316611f7e565b50600190565b60035490565b6002546001600160a01b031690565b6000610d6961240c565b6000610d74846118be565b80546040805160e08101825260038401548152600484015460208083019190915260058501548284015260068501546001600160a01b0390811660608401526007860154166080830152825180820184526008860154815260a08301528251908101909252600990930154815260c083015260ff169350915050915091565b600080610dff846118be565b9050610e0b8133611a24565b601281018054600181018255600091825260209091208101849055604051909250829085907f123042b7c2ada7097e3ab9d05b9dd5b54bab274a5690d2e16a2316f6e274844a90610e5d9087906133a1565b60405180910390a35092915050565b600080610e78846118be565b9050610e848133611a24565b60118101546001600160a01b0384811691161415610eb45760405162461bcd60e51b815260040161056c90612f3e565b60108101546001600160a01b0384811691161415610ed6576001915050610f27565b6010810180546001600160a01b0319166001600160a01b03851690811790915560405185907fceff235f9d95a8aba06f4cf159261832d21ce128a9e450e75c5f32faeb2df8e290600090a360019150505b92915050565b6002546000906001600160a01b03163314610f5a5760405162461bcd60e51b815260040161056c9061302c565b61057e610f66836118be565b611aa9565b600080610f77836118be565b905033610f848282611a24565b6005820154610f91611e81565b1015610faf5760405162461bcd60e51b815260040161056c90613072565b600c82015480610fd15760405162461bcd60e51b815260040161056c9061304f565b6000600c84015560405185907f4caa9523353802828989b84b2bb248c625aeb6d44999cd9ba0fe7e15711f3db79061100a9084906133a1565b60405180910390a2600783015461092c906001600160a01b031683836119c9565b600080821161104c5760405162461bcd60e51b815260040161056c90612eac565b6000611057846118be565b6005810154909150611067611e81565b106110845760405162461bcd60e51b815260040161056c90612e36565b3361108f8282611a24565b600d82015461109e9085611f43565b600d8301819055600383015410156110c85760405162461bcd60e51b815260040161056c90612d15565b600c8201546110d79085611f43565b600c83015560405185907f4ef8678904704bdf752e12cfb17a926ce33dcaf9077e565fb660cfe644ed22649061110e9087906133a1565b60405180910390a2600782015461092c906001600160a01b0316823087611fed565b60025460009081906001600160a01b0316331461115f5760405162461bcd60e51b815260040161056c9061302c565b600061116e8888886001611b9e565b905061117a8186611e0f565b8351611184612466565b50604089015186906000190160005b8381101561128c576111a36124e2565b8882815181106111af57fe5b602002602001015190506111d084826020015161201490919063ffffffff16565b6111ec5760405162461bcd60e51b815260040161056c90612add565b602081015181519094508381116112155760405162461bcd60e51b815260040161056c90612b68565b60138701805460018181018355600092835260209283902085516002909302018281559285015151920182905560405192955085928a927f9ad21f79ce9c3c640f4c7e4d5cccb24f33967153042855c93f33f9cb457b70959261127a929091906133aa565b60405180910390a25050600101611193565b5061129882600161201b565b6112b45760405162461bcd60e51b815260040161056c90612cde565b505050600190810154909890975095505050505050565b60025460009081906001600160a01b031633146112fa5760405162461bcd60e51b815260040161056c9061302c565b60016113098686866000611b9e565b6001015491509150935093915050565b611321612479565b611329612479565b600080611335866118be565b905061134081611904565b6001600160a01b0385166000908152601490910160209081526040918290206004810154835180850185528254815260018301548185015284518086019095526002830154855260039092015492840192909252945090925090509250925092565b600080600260005414156113c85760405162461bcd60e51b815260040161056c9061316e565b6002600055826113ea5760405162461bcd60e51b815260040161056c90612c7f565b3360006113f6866118be565b90506000611402611e81565b60048301549091508110156114295760405162461bcd60e51b815260040161056c90612cb4565b6005820154811061144c5760405162461bcd60e51b815260040161056c90612e36565b600c82015461146d5760405162461bcd60e51b815260040161056c906130cc565b611478828785612059565b6001600160a01b03851660009081526014850160205260409020919650945085156114df57600e8301546114ac9087611f43565b600e84015560018101546114c09087611f43565b600182015560068301546114df906001600160a01b0316853089611fed565b84156115c6576000835460ff1660028111156114f757fe5b141561151b576007830154611516906001600160a01b031685876119c9565b6115b1565b600281015460009061152d9087611f43565b6002808401829055604080516020810190915290860154815290915060009061155f9061155a908461214c565b612176565b6003840180549082905590915081036002865460ff16600281111561158057fe5b141561158e57600484018290555b80156115ad5760078601546115ad906001600160a01b031688836119c9565b5050505b600c8301546115c09086611e85565b600c8401555b836001600160a01b0316887f7d421bbd3ba855339632fdd240923952de83fd611d837a284506157b596f4932898989604051611604939291906133b8565b60405180910390a350506001600055509194909350915050565b6000611628612479565b6000611633856118be565b80546001600160a01b038616600090815260149092016020908152604092839020835180850190945280548452600101549083015260ff1693509150509250929050565b600080611683856118be565b905061168f8133611a24565b6116998185611a57565b8281600c0160060185815481106116ac57fe5b906000526020600020018190555083857fc128898667140122862a239400b6468386a01fb68fe432ebe587a84166d241ad856040516116eb91906133a1565b60405180910390a3506001949350505050565b611706612479565b61170e612479565b60008061171a866118be565b905061172581611a7a565b6001600160a01b0385166000908152601490910160209081526040918290206005810154835180850185528254815260018301548185015284518086019095526002830154855260039092015492840192909252945090925090509250925092565b60003381611794856118be565b905061179f81611a7a565b601381015484106117c25760405162461bcd60e51b815260040161056c906131a5565b60008160130185815481106117d357fe5b906000526020600020906002020190506117eb611e81565b8154111561180b5760405162461bcd60e51b815260040161056c90612f65565b6001600160a01b0383166000908152601483016020526040902060058101548610156118495760405162461bcd60e51b815260040161056c90612e82565b60028101546040805160208101909152600184015481526000916118709161155a9161214c565b600383018054908290559091508103801561189e57600785015461189e906001600160a01b031687836119c9565b6118a9886001611f43565b60059093019290925550935050505092915050565b60035460009082106118e25760405162461bcd60e51b815260040161056c9061321d565b600382815481106118ef57fe5b90600052602060002090601502019050919050565b6002815460ff16600281111561191657fe5b146119335760405162461bcd60e51b815260040161056c90612ed4565b50565b6001546001600160a01b038281169116141561195157611933565b6002546001600160a01b038281169116141561197f5760405162461bcd60e51b815260040161056c90612f3e565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290600090a250565b611a1f8363a9059cbb60e01b84846040516024016119e89291906129f6565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612185565b505050565b60118201546001600160a01b03828116911614611a535760405162461bcd60e51b815260040161056c90612e0b565b5050565b60128201548110611a535760405162461bcd60e51b815260040161056c90613145565b6001815460ff166002811115611a8c57fe5b146119335760405162461bcd60e51b815260040161056c90612da9565b600e810154611ab757611933565b600e810154604080516020810190915260088301548152600091611ae391611ade9161214c565b612214565b60068301546001600160a01b0316600090815260046020526040902054909150611b0d9082611f43565b60068301546001600160a01b0316600090815260046020526040812091909155600e830154611b3c9083611e85565b600f840154909150611b4e9082611f43565b600f8401556000600e84015560018301546040517f969043bab89ac5dd319ed2e1356119888d1624898734ac8516a120bea7fb426090611b9190849086906133aa565b60405180910390a2505050565b600080611ba9611e81565b90508086602001511015611bbf57602086018190525b60a0860151611bcf90606461224e565b611beb5760405162461bcd60e51b815260040161056c90612b42565b8560400151866020015110611c125760405162461bcd60e51b815260040161056c90612dd4565b506003805460018101808355600083815291929083908110611c3057fe5b60009182526020909120600160159092020181810184905580549092508591839160ff191690836002811115611c6257fe5b0217905550865160038201556020808801516004830155604080890151600584015560608901516006840180546001600160a01b039283166001600160a01b03199182161790915560808b015160078601805491909316911617905560a089015151600884015560c08901515160098401558051600180825281830190925291828101908036833750508151611d0192601285019250602001906124fc565b508581600c01600601600081548110611d1657fe5b90600052602060002001819055508481600c0160050160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555086608001516001600160a01b031687606001516001600160a01b03167f6d0a80f2ee73de8861b1887eb263d606bb9e1b85beff2d71b45b913b0f9aed3186858b600001518c602001518d604001518e60a00151600001518f60c00151600001518f604051611dc5989796959493929190612a65565b60405180910390a36040516001600160a01b0386169083907f1db9920ce261cf5299c96ab18ed9969b1b467e3ac5f5e7a33656d6471495cf0790600090a39150505b949350505050565b611e1a81600161224e565b611e365760405162461bcd60e51b815260040161056c906131d5565b805160028301819055600183015460405190917f4b934b79ea913cbf45273ed2d6516ef75fd53b22d460b29bfc3627bdda76103f91611e7591906133a1565b60405180910390a25050565b4290565b600061076083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061228c565b600082611ed657506000610f27565b82820282848281611ee357fe5b04146107605760405162461bcd60e51b815260040161056c90612efd565b600061076083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122b8565b6000828201838110156107605760405162461bcd60e51b815260040161056c90612be2565b6000818310611f775781610760565b5090919050565b6002546001600160a01b0382811691161415611f9957611933565b600280546001600160a01b0383166001600160a01b031991821681179092556001805490911690556040517fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf3690600090a250565b61200e846323b872dd60e01b8585856040516024016119e8939291906129d2565b50505050565b5190511190565b60007812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f2182111561204657506000610f27565b509051670de0b6b3a76400009091021490565b6001600160a01b03811660009081526014840160205260408120805460128601805486949392849291811061208a57fe5b90600052602060002001549050808260000160010154106120bd5760405162461bcd60e51b815260040161056c90612bab565b600182015481906120ce9086611f43565b11156120e75760018201546120e4908290611e85565b93505b6040805160208101909152600988015481526121079061155a908661214c565b600c88015490935083111561214257600c87015460408051602081019091526009890154815290935061213f90611ade9085906122ef565b93505b5050935093915050565b612154612466565b60408051602081019091528351819061216d9085611ec7565b90529392505050565b51670de0b6b3a7640000900490565b60606121da826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123239092919063ffffffff16565b805190915015611a1f57808060200190518101906121f8919061262d565b611a1f5760405162461bcd60e51b815260040161056c906130fb565b8051600090670de0b6b3a7640000900661222f576000612232565b60015b60ff166012600a0a83600001518161224657fe5b040192915050565b60007812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f2182111561227957506001610f27565b509051670de0b6b3a76400009091021190565b600081848411156122b05760405162461bcd60e51b815260040161056c9190612aaa565b505050900390565b600081836122d95760405162461bcd60e51b815260040161056c9190612aaa565b5060008385816122e557fe5b0495945050505050565b6122f7612466565b60408051602081019091528251819061216d90610c37876ec097ce7bc90715b34b9f1000000000611ec7565b6060611e07848460008585612337856123cd565b6123535760405162461bcd60e51b815260040161056c90613095565b60006060866001600160a01b0316858760405161237091906129a2565b60006040518083038185875af1925050503d80600081146123ad576040519150601f19603f3d011682016040523d82523d6000602084013e6123b2565b606091505b50915091506123c28282866123d3565b979650505050505050565b3b151590565b606083156123e2575081610760565b8251156123f25782518084602001fd5b8160405162461bcd60e51b815260040161056c9190612aaa565b6040518060e0016040528060008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b03168152602001612454612466565b8152602001612461612466565b905290565b6040518060200160405280600081525090565b604051806040016040528060008152602001600081525090565b6040518060e001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b03168152602001606081525090565b604051806040016040528060008152602001612461612466565b828054828255906000526020600020908101928215612537579160200282015b8281111561253757825182559160200191906001019061251c565b50612543929150612547565b5090565b5b808211156125435760008155600101612548565b8035610f278161344c565b600060208284031215612578578081fd5b61258260206133ce565b9135825250919050565b600060e0828403121561259d578081fd5b6125a760e06133ce565b905081358152602082013560208201526040820135604082015260608201356125cf8161344c565b606082015260808201356125e28161344c565b60808201526125f48360a08401612567565b60a08201526126068360c08401612567565b60c082015292915050565b600060208284031215612622578081fd5b81356107608161344c565b60006020828403121561263e578081fd5b81518015158114610760578182fd5b60008060006101208486031215612662578182fd5b61266c858561258c565b925060e084013591506101008401356126848161344c565b809150509250925092565b600080600080600061016086880312156126a7578081fd5b6126b1878761258c565b945060e086013593506101008601356126c98161344c565b92506126d9876101208801612567565b915061014086013567ffffffffffffffff8111156126f5578182fd5b8601601f81018813612705578182fd5b8035612718612713826133f5565b6133ce565b808282526020808301925080850160408d83828802890101111561273a578788fd5b8796505b858710156127875780828f031215612754578788fd5b61275d816133ce565b8235815261276d8f858501612567565b81850152855260019690960195938201939081019061273e565b505050809450505050509295509295909350565b600080600080600061016086880312156127b3578081fd5b6127bd878761258c565b945060e086013593506101008601356127d58161344c565b92506127e5876101208801612567565b94979396509194610140013592915050565b600060208284031215612808578081fd5b5035919050565b60008060408385031215612821578182fd5b8235915060208301356128338161344c565b809150509250929050565b60008060408385031215612850578182fd5b50508035926020909101359150565b600080600060608486031215612873578283fd5b833592506020808501359250604085013567ffffffffffffffff811115612898578283fd5b8501601f810187136128a8578283fd5b80356128b6612713826133f5565b81815283810190838501858402850186018b10156128d2578687fd5b8694505b838510156128fc576128e88b8261255c565b8352600194909401939185019185016128d6565b5080955050505050509250925092565b600080600060608486031215612920578081fd5b505081359360208301359350604090920135919050565b815260200190565b80518252602090810151910152565b805182526020810151602083015260408101516040830152606081015160018060a01b038082166060850152806080840151166080850152505060a08101515160a083015260c08101515160c08301525050565b600082516129b4818460208701613420565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b9115158252602082015260400190565b6060810160038410612a3857fe5b838252610760602083018461293f565b6101008101612a5684613415565b8252610760602083018461294e565b6101008101612a738a613415565b8252602082019890985260408101969096526060860194909452608085019290925260a084015260c083015260e090910152919050565b6000602082528251806020840152612ac9816040850160208701613420565b601f01601f19169190910160400192915050565b6020808252601f908201527f496e76616c696420696e74657276616c20756e6c6f636b696e67207061727400604082015260600190565b602080825260149082015273139bc81858d8dbdd5b9d1cc81c1c9bdd9a59195960621b604082015260600190565b6020808252600c908201526b46656520677465203130302560a01b604082015260600190565b60208082526023908201527f496e76616c696420696e74657276616c207374617274696e672074696d6573746040820152620616d760ec1b606082015260800190565b6020808252601e908201527f4163636f756e74207061796d656e74206c696d69742065786365656465640000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f4e6f74206e6f6d696e6174656420746f20706f6f6c206f776e65727368697000604082015260600190565b6020808252601590820152744e6f20636f6c6c6563746564207061796d656e747360581b604082015260600190565b6020808252818101527f526571756573746564207061796d656e7420616d6f756e74206973207a65726f604082015260600190565b60208082526010908201526f141bdbdb081b9bdd081cdd185c9d195960821b604082015260600190565b6020808252601f908201527f556e6c6f636b696e672070617274206e6f7420657175616c20746f206f6e6500604082015260600190565b60208082526017908201527f49737375616e6365206c696d6974206578636565646564000000000000000000604082015260600190565b6020808252603c908201527f4c696e65617220756e6c6f636b696e67206c657373207468616e206f7220657160408201527f75616c20746f20706f6f6c20656e64696e672074696d657374616d7000000000606082015260800190565b602080825260119082015270139bdd081a5b9d195c9d985b081c1bdbdb607a1b604082015260600190565b60208082526018908201527f496e76616c696420656e64696e672074696d657374616d700000000000000000604082015260600190565b60208082526011908201527014195c9b5a5cdcda5bdb8819195b9a5959607a1b604082015260600190565b6020808252600a9082015269141bdbdb08195b99195960b21b604082015260600190565b6020808252600e908201526d141bdbdb081b9bdd08195b99195960921b604082015260600190565b60208082526010908201526f105b1c9958591e481d5b9b1bd8dad95960821b604082015260600190565b6020808252600e908201526d416d6f756e74206973207a65726f60901b604082015260600190565b6020808252600f908201526e139bdd081b1a5b99585c881c1bdbdb608a1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252600d908201526c20b63932b0b23c9037bbb732b960991b604082015260600190565b602080825260149082015273125b9d195c9d985b081b9bdd081cdd185c9d195960621b604082015260600190565b6020808252601a908201527f4e6f74206e6f6d696e6174656420746f206f776e657273686970000000000000604082015260600190565b6020808252601a908201527f416c6c2066756e647320616c726561647920756e6c6f636b6564000000000000604082015260600190565b6020808252601190820152704e6f20636f6c6c6563746564206665657360781b604082015260600190565b6020808252600990820152682737ba1037bbb732b960b91b604082015260600190565b602080825260099082015268139bc81d5b9cdbdb1960ba1b604082015260600190565b602080825260099082015268139bdd08195b99195960ba1b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601590820152744e6f20617661696c61626c652069737375616e636560581b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252600f908201526e131a5b5a5d081b9bdd08199bdd5b99608a1b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602080825260169082015275092dcecc2d8d2c840d2dce8cae4ecc2d840d2dcc8caf60531b604082015260600190565b60208082526028908201527f496e76616c696420696d6d6564696174656c7920756e6c6f636b696e6720706160408201526772742076616c756560c01b606082015260800190565b6020808252600e908201526d141bdbdb081b9bdd08199bdd5b9960921b604082015260600190565b60a08101613253828661293f565b613260604083018561293f565b826080830152949350505050565b6000610120808301613280848861294e565b855160e0850152610100840191909152835190819052610140830190602090818601845b828110156132cc578151805186528401515184860152604090940193908301906001016132a4565b509298975050505050505050565b61014081016132e9828661294e565b835160e0830152611e0761010083018461293f565b6000602080835261010083018451828501528185015160408501526040850151606085015260608501516080850152608085015160018060a01b0380821660a08701528060a08801511660c0870152505060c085015160e08086015281815161336781856133a1565b9285019350859291505b8083101561339657613384828551612937565b91508484019350600183019250613371565b509695505050505050565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff811182821017156133ed57600080fd5b604052919050565b600067ffffffffffffffff82111561340b578081fd5b5060209081020190565b806003811061058257fe5b60005b8381101561343b578181015183820152602001613423565b8381111561200e5750506000910152565b6001600160a01b038116811461193357600080fdfea2646970667358221220e7863b28d7b6082e040393f913a2d938617eca21f680fb4c41e0f3573910c4c864736f6c634300060c0033

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

00000000000000000000000021ddf70bfb842e9eed59df7af411fc602d7eed4b

-----Decoded View---------------
Arg [0] : owner_ (address): 0x21Ddf70Bfb842E9eed59DF7aF411fc602d7eED4B

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000021ddf70bfb842e9eed59df7af411fc602d7eed4b


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.