ETH Price: $1,919.87 (-2.90%)
 

Overview

ETH Balance

7.24919109764332159 ETH

Eth Value

$13,917.47 (@ $1,919.87/ETH)

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw All ETH164681032023-01-23 7:47:111127 days ago1674460031IN
PieDAO: YPIE Oven 2
0 ETH0.0005535515.45496674
Deposit164608852023-01-22 7:34:591128 days ago1674372899IN
PieDAO: YPIE Oven 2
0.1 ETH0.0008117815.77682114
Withdraw All ETH142774672022-02-25 20:35:281458 days ago1645821328IN
PieDAO: YPIE Oven 2
0 ETH0.00470547131.37554685
Deposit142398462022-02-20 0:58:431464 days ago1645318723IN
PieDAO: YPIE Oven 2
0.2 ETH0.0048837794.91529888
Withdraw All ETH141502342022-02-06 4:13:371478 days ago1644120817IN
PieDAO: YPIE Oven 2
0 ETH0.002488469.45223949
Deposit141440422022-02-05 5:16:481479 days ago1644038208IN
PieDAO: YPIE Oven 2
0.2 ETH0.0043722184.9732128
Deposit140630302022-01-23 16:41:101491 days ago1642956070IN
PieDAO: YPIE Oven 2
6.1273 ETH0.00627335121.92170749
Deposit140575862022-01-22 20:35:491492 days ago1642883749IN
PieDAO: YPIE Oven 2
0.4 ETH0.00582272169.49189894
Deposit140560892022-01-22 14:59:521492 days ago1642863592IN
PieDAO: YPIE Oven 2
0.4 ETH0.00637003123.80055448
Withdraw All ETH139579262022-01-07 10:59:371507 days ago1641553177IN
PieDAO: YPIE Oven 2
0 ETH0.0028708180.12539181
Deposit139470902022-01-05 18:35:341509 days ago1641407734IN
PieDAO: YPIE Oven 2
0.3 ETH0.00796786154.8542125
Deposit139280412022-01-02 19:56:361512 days ago1641153396IN
PieDAO: YPIE Oven 2
0.122 ETH0.00664722129.18779652
Withdraw Output134282952021-10-16 9:47:591591 days ago1634377679IN
PieDAO: YPIE Oven 2
0 ETH0.005758380.54929327
Withdraw All ETH134049252021-10-12 17:11:551594 days ago1634058715IN
PieDAO: YPIE Oven 2
0 ETH0.00383241107
Withdraw All ETH133810022021-10-08 22:59:481598 days ago1633733988IN
PieDAO: YPIE Oven 2
0 ETH0.0035533999.17650595
Deposit133494342021-10-04 0:22:291603 days ago1633306949IN
PieDAO: YPIE Oven 2
0.2 ETH0.0034596967.23852386
Withdraw All ETH133492002021-10-03 23:31:251603 days ago1633303885IN
PieDAO: YPIE Oven 2
0 ETH0.0022818263.68652753
Deposit133466252021-10-03 13:59:351603 days ago1633269575IN
PieDAO: YPIE Oven 2
0.2 ETH0.0030371559.02669214
Withdraw Output133146722021-09-28 14:03:431608 days ago1632837823IN
PieDAO: YPIE Oven 2
0 ETH0.0058352581.62563926
Withdraw Output133140572021-09-28 11:46:411608 days ago1632829601IN
PieDAO: YPIE Oven 2
0 ETH0.0027971839.12808183
Withdraw Output132077522021-09-12 0:46:271625 days ago1631407587IN
PieDAO: YPIE Oven 2
0 ETH0.0030303142.38911698
Withdraw Output131982002021-09-10 13:15:221626 days ago1631279722IN
PieDAO: YPIE Oven 2
0 ETH0.004746766.39855971
Bake131980242021-09-10 12:33:071626 days ago1631277187IN
PieDAO: YPIE Oven 2
0 ETH0.1512646760.89503974
Deposit131919652021-09-09 14:06:151627 days ago1631196375IN
PieDAO: YPIE Oven 2
10 ETH0.01395183271.15157468
Deposit131142362021-08-28 13:47:361639 days ago1630158456IN
PieDAO: YPIE Oven 2
0.04 ETH0.002572750
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer164681032023-01-23 7:47:111127 days ago1674460031
PieDAO: YPIE Oven 2
0.1 ETH
-142774672022-02-25 20:35:281458 days ago1645821328
PieDAO: YPIE Oven 2
0.2 ETH
-141502342022-02-06 4:13:371478 days ago1644120817
PieDAO: YPIE Oven 2
0.2 ETH
-139579262022-01-07 10:59:371507 days ago1641553177
PieDAO: YPIE Oven 2
0.3 ETH
-134049252021-10-12 17:11:551594 days ago1634058715
PieDAO: YPIE Oven 2
0.04 ETH
-133810022021-10-08 22:59:481598 days ago1633733988
PieDAO: YPIE Oven 2
0.2 ETH
-133492002021-10-03 23:31:251603 days ago1633303885
PieDAO: YPIE Oven 2
0.2 ETH
-131980242021-09-10 12:33:071626 days ago1631277187
PieDAO: YPIE Oven 2
10.58180891 ETH
-130623032021-08-20 13:07:501647 days ago1629464870
PieDAO: YPIE Oven 2
0.1 ETH
-130409222021-08-17 5:44:111651 days ago1629179051
PieDAO: YPIE Oven 2
0.1 ETH
-129749092021-08-07 1:19:551661 days ago1628299195
PieDAO: YPIE Oven 2
0.1 ETH
-129055512021-07-27 2:39:401672 days ago1627353580
PieDAO: YPIE Oven 2
0.22126239 ETH
-127264662021-06-29 3:08:511700 days ago1624936131
PieDAO: YPIE Oven 2
0.15 ETH
-126411052021-06-15 19:59:001713 days ago1623787140
PieDAO: YPIE Oven 2
0.4 ETH
-126245672021-06-13 6:44:141716 days ago1623566654
PieDAO: YPIE Oven 2
2 ETH
-126038852021-06-10 1:41:441719 days ago1623289304
PieDAO: YPIE Oven 2
0.1 ETH
-124990452021-05-24 19:55:381735 days ago1621886138
PieDAO: YPIE Oven 2
1 ETH
-124901682021-05-23 11:06:411736 days ago1621768001
PieDAO: YPIE Oven 2
11.5357376 ETH
-124861232021-05-22 19:57:221737 days ago1621713442
PieDAO: YPIE Oven 2
0.280739 ETH
-124602952021-05-18 19:31:081741 days ago1621366268
PieDAO: YPIE Oven 2
0.11 ETH
-124564712021-05-18 5:23:501742 days ago1621315430
PieDAO: YPIE Oven 2
3.5 ETH
-124418912021-05-15 23:03:301744 days ago1621119810
PieDAO: YPIE Oven 2
0.2 ETH
-123791072021-05-06 6:18:401754 days ago1620281920
PieDAO: YPIE Oven 2
0.093 ETH
-123710472021-05-05 0:40:561755 days ago1620175256
PieDAO: YPIE Oven 2
0.25955738 ETH
-123709122021-05-05 0:11:561755 days ago1620173516
PieDAO: YPIE Oven 2
10.74884261 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Oven

Compiler Version
v0.7.1+commit.f4a555be

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "../interfaces/PieRecipe.sol";

contract Oven is AccessControl {
    using SafeMath for uint256;

    event Deposit(address user, uint256 amount);
    event WithdrawETH(address user, uint256 amount, address receiver);
    event WithdrawOuput(address user, uint256 amount, address receiver);
    event Bake(address user, uint256 amount, uint256 price);

    // uses the default admin role
    bytes32 constant public CONTROLLER_ROLE = DEFAULT_ADMIN_ROLE;
    bytes32 constant public CAP_SETTER_ROLE = keccak256(abi.encode("CAP_SETTER"));
    bytes32 constant public BAKER_ROLE = keccak256(abi.encode("BAKER"));

    // Agent controlled by Pie-Crust voting app
    address payable constant public TOKEN_SAFE = 0xAF2fE0d4fe879066B2BaA68d9e56cC375DF22815;

    mapping(address => uint256) public ethBalanceOf;
    mapping(address => uint256) public outputBalanceOf;

    IERC20 public pie;
    PieRecipe public recipe;
    uint256 public cap;

    constructor(
        address _controller,
        address _capSetter,
        address _baker,
        address _pie,
        address _recipe
    ) public {
        _setupRole(CONTROLLER_ROLE, _controller);
        _setupRole(CAP_SETTER_ROLE, _capSetter);
        _setupRole(BAKER_ROLE, _baker);
        pie = IERC20(_pie);
        recipe = PieRecipe(_recipe);
    }

    modifier ovenIsReady {
        require(address(pie) != address(0), "PIE_NOT_SET");
        require(address(recipe) != address(0), "RECIPE_NOT_SET");
        _;
    }

    modifier onlyRole(bytes32 _role) {
        require(hasRole(_role, msg.sender), "AUTH_FAILED");
        _;
    }

    // _maxprice should be equal to the sum of _receivers.
    // this variable is needed because in the time between calling this function
    // and execution, the _receiver amounts can differ.
    function bake(
        address[] calldata _receivers,
        uint256 _outputAmount,
        uint256 _maxPrice
    ) public ovenIsReady onlyRole(BAKER_ROLE) {
        uint256 realPrice = recipe.calcToPie(address(pie), _outputAmount);
        require(realPrice <= _maxPrice, "PRICE_ERROR");

        uint256 totalInputAmount = 0;
        for (uint256 i = 0; i < _receivers.length; i++) {
            // This logic aims to execute the following logic
            // E.g. 5 eth is needed to mint the outputAmount
            // User 1: 2 eth (100% used)
            // User 2: 2 eth (100% used)
            // User 3: 2 eth (50% used)
            // User 4: 2 eth (0% used)

            uint256 userAmount = ethBalanceOf[_receivers[i]];
            if (totalInputAmount == realPrice) {
                break;
            } else if (totalInputAmount.add(userAmount) <= realPrice) {
                totalInputAmount = totalInputAmount.add(userAmount);
            } else {
                userAmount = realPrice.sub(totalInputAmount);
                // e.g. totalInputAmount = realPrice
                totalInputAmount = totalInputAmount.add(userAmount);
            }

            ethBalanceOf[_receivers[i]] = ethBalanceOf[_receivers[i]].sub(
                userAmount
            );

            uint256 userBakeAmount = _outputAmount.mul(userAmount).div(
                realPrice
            );
            outputBalanceOf[_receivers[i]] = outputBalanceOf[_receivers[i]].add(
                userBakeAmount
            );

            emit Bake(_receivers[i], userBakeAmount, userAmount);
        }
        // Provided balances are too low.
        require(totalInputAmount == realPrice, "INSUFFICIENT_FUNDS");
        recipe.toPie{value: realPrice}(address(pie), _outputAmount);
    }

    function deposit() public payable ovenIsReady {
        ethBalanceOf[msg.sender] = ethBalanceOf[msg.sender].add(msg.value);
        require(address(this).balance <= cap, "MAX_CAP");
        emit Deposit(msg.sender, msg.value);
    }

    receive() external payable {
        deposit();
    }

    function withdrawAll(address payable _receiver) external ovenIsReady {
        withdrawAllETH(_receiver);
        withdrawOutput(_receiver);
    }

    function withdrawAllETH(address payable _receiver) public ovenIsReady {
        withdrawETH(ethBalanceOf[msg.sender], _receiver);
    }

    function withdrawETH(uint256 _amount, address payable _receiver)
        public
        ovenIsReady
    {
        ethBalanceOf[msg.sender] = ethBalanceOf[msg.sender].sub(_amount);
        _receiver.transfer(_amount);
        emit WithdrawETH(msg.sender, _amount, _receiver);
    }

    function withdrawOutput(address _receiver) public ovenIsReady {
        uint256 _amount = outputBalanceOf[msg.sender];
        outputBalanceOf[msg.sender] = 0;
        pie.transfer(_receiver, _amount);
        emit WithdrawOuput(msg.sender, _amount, _receiver);
    }

    function setCap(uint256 _cap) external onlyRole(CAP_SETTER_ROLE) {
        cap = _cap;
    }

    function setPie(address _pie) public onlyRole(CONTROLLER_ROLE) {
        // Only able to change pie from address(0) to an actual address
        // Otherwise old outputBalances can conflict with a new pie
        // require(address(pie) == address(0), "PIE_ALREADY_SET");
        pie = IERC20(_pie);
    }

    function setRecipe(address _recipe) public onlyRole(CONTROLLER_ROLE) {
        // Only able to change pie from address(0) to an actual address
        // Otherwise old outputBalances can conflict with a new pie
        // require(address(recipe) == address(0), "RECIPE_ALREADY_SET");
        recipe = PieRecipe(_recipe);
    }

    function setPieAndRecipe(address _pie, address _recipe) external {
        setPie(_pie);
        setRecipe(_recipe);
    }

    function getCap() external view returns (uint256) {
        return cap;
    }

    function saveToken(address _token) external onlyRole(CONTROLLER_ROLE) {
        IERC20 token = IERC20(_token);

        token.transfer(
            TOKEN_SAFE,
            token.balanceOf(address(this))
        );
    }

    function saveETH() external onlyRole(CONTROLLER_ROLE) {
        TOKEN_SAFE.transfer(address(this).balance);
    }
}

File 2 of 19 : IExperiPie.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IExperiPie is IERC20 {
    // fee functions
    function setEntryFee(uint256 _fee) external;

    function getEntryFee() external view returns (uint256);

    function setExitFee(uint256 _fee) external;

    function getExitFee() external view returns (uint256);

    function setAnnualizedFee(uint256 _fee) external;

    function getAnnualizedFee() external view returns (uint256);

    function setFeeBeneficiary(address _beneficiary) external;

    function getFeeBeneficiary() external view returns (address);

    function setEntryFeeBeneficiaryShare(uint256 _share) external;

    function getEntryFeeBeneficiaryShare() external view returns (uint256);

    function setExitFeeBeneficiaryShare(uint256 _share) external;

    function getExitFeeBeneficiaryShare() external view returns (uint256);

    function calcOutStandingAnnualizedFee() external view returns (uint256);

    function chargeOutstandingAnnualizedFee() external;

    // function initialize(address[] memory _tokens, uint256 _maxCap) external;
    function joinPool(uint256 _amount) external;

    function exitPool(uint256 _amount) external;

    function getLock() external view returns (bool);

    function getLockBlock() external view returns (uint256);

    function setLock(uint256 _lock) external;

    function getCap() external view returns (uint256);

    function setCap(uint256 _maxCap) external returns (uint256);

    function balance(address _token) external view returns (uint256);

    function getTokens() external view returns (address[] memory);

    function addToken(address _token) external;

    function removeToken(address _token) external;

    function getTokenInPool(address _token) external view returns (bool);

    function mint(address _receiver, uint256 _amount) external;

    function burn(address _from, uint256 _amount) external;

    function calcTokensForAmount(uint256 _amount)
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts);

    function calcTokensForAmountExit(uint256 _amount)
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts);

    // CallFacet
    function call(
        address[] memory _targets,
        bytes[] memory _calldata,
        uint256[] memory _values
    ) external;

    function addCaller(address _caller) external;

    function removeCaller(address _caller) external;

    function canCall(address _caller) external view returns (bool);

    function getCallers() external view returns (address[] memory);

    // Ownership

    function transferOwnership(address _newOwner) external;

    function owner() external view returns (address);

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

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

    function decimals() external view returns (uint8);

    // ERC20 facet
    function initialize(
        uint256 _initialSupply,
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) external;
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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);
}

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

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "../interfaces/PieRecipe.sol";

contract TestPieRecipe {
    using SafeMath for uint256;
    mapping(address => uint256) private balance;

    uint256 public calcToPieAmount;

    function toPie(address _pie, uint256 _poolAmount) public payable {
        IERC20 pie = IERC20(_pie);
        uint256 amount = calcToPie(_pie, _poolAmount);
        require(msg.value == amount, "Amount ETH too low");
        pie.transfer(msg.sender, _poolAmount);
    }

    function testSetCalcToPieAmount(uint256 _amount) external {
        calcToPieAmount = _amount;
    }

    function calcToPie(address _pie, uint256 _poolAmount)
        public
        view
        returns (uint256)
    {
        return calcToPieAmount;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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;
    }
}

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

interface PieRecipe {
    function toPie(address _pie, uint256 _poolAmount) external payable;

    function calcToPie(address _pie, uint256 _poolAmount)
        external
        returns (uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../GSN/Context.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
 * (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint256(_at(set._inner, index)));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @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");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        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);
            }
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "./Oven.sol";

contract OvenFactoryContract is Ownable {
    event OvenCreated(
        address Oven,
        address Controller,
        address Pie,
        address Recipe
    );

    address[] public ovens;
    mapping(address => bool) public isOven;
    address public defaultController;
    address public defaultBaker;
    address public defaultCapSetter;

    function setDefaultController(address _controller) external onlyOwner {
        defaultController = _controller;
    }

    function setDefaultBaker(address _baker) external onlyOwner {
        defaultBaker = _baker;
    }

    function setDefaultCapSetter(address _capSetter) external onlyOwner {
        defaultCapSetter = _capSetter;
    }

    function CreateEmptyOven() external {
        CreateOven(address(0), address(0));
    }

    function CreateOven(address _pie, address _recipe) public {
        require(defaultController != address(0), "CONTROLLER_NOT_SET");

        Oven oven = new Oven(
            address(this), address(this), defaultBaker, _pie, _recipe
        );
        ovens.push(address(oven));
        isOven[address(oven)] = true;

        oven.setCap(uint256(-1));

        oven.grantRole(oven.CAP_SETTER_ROLE(), defaultCapSetter);
        oven.grantRole(oven.CONTROLLER_ROLE(), defaultController);

        oven.renounceRole(oven.CAP_SETTER_ROLE(), address(this));
        oven.renounceRole(oven.CONTROLLER_ROLE(), address(this));

        emit OvenCreated(address(oven), defaultController, _pie, _recipe);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../GSN/Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

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

import "@openzeppelin/contracts/math/SafeMath.sol";

contract TestPie {
    using SafeMath for uint256;

    mapping(address => uint256) private balance;

    constructor(uint256 _supply, address _address) {
        balance[_address] = _supply;
    }

    function transfer(address _to, uint256 _value) public returns (bool) {
        balance[msg.sender] = balance[msg.sender].sub(_value);
        balance[_to] = balance[_to].add(_value);
        return true;
    }

    function balanceOf(address _address) public view returns (uint256) {
        return balance[_address];
    }
}

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

interface IOven {
    function bake(
        address[] calldata _receivers,
        uint256 _outputAmount,
        uint256 _maxPrice
    ) external;

    function deposit() external payable;

    function withdrawAll(address payable _receiver) external;

    function withdrawAllETH(address payable _receiver) external;

    function withdrawETH(uint256 _amount, address payable _receiver) external;

    function withdrawOutput(address _receiver) external;

    function setCap(uint256 _cap) external;

    function setController(address _controller) external;

    function setPie(address _pie) external;

    function getCap() external view returns (uint256);

    function saveToken(address _token) external;
}

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMath {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, 'ds-math-add-overflow');
    }

    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'ds-math-sub-underflow');
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "ds-math-div-zero");
        uint256 c = a / b;
        return c;
    }
}

pragma solidity >=0.5.0;

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';

import "./SafeMath.sol";

library UniswapV2Library {
    using SafeMath for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        amountB = amountA.mul(reserveB) / reserveA;
    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn.mul(997);
        uint numerator = amountInWithFee.mul(reserveOut);
        uint denominator = reserveIn.mul(1000).add(amountInWithFee);
        amountOut = numerator / denominator;
    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
        require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint numerator = reserveIn.mul(amountOut).mul(1000);
        uint denominator = reserveOut.sub(amountOut).mul(997);
        amountIn = (numerator / denominator).add(1);
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
        }
    }

    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
        }
    }
}

pragma solidity >=0.5.0;

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

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

interface IUniswapV2Exchange {
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}

interface IUniswapV2Factory {
    function getPair(address tokenA, address tokenB) external view returns (address pair);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_capSetter","type":"address"},{"internalType":"address","name":"_baker","type":"address"},{"internalType":"address","name":"_pie","type":"address"},{"internalType":"address","name":"_recipe","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Bake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"WithdrawETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"WithdrawOuput","type":"event"},{"inputs":[],"name":"BAKER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CAP_SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTROLLER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_SAFE","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_receivers","type":"address[]"},{"internalType":"uint256","name":"_outputAmount","type":"uint256"},{"internalType":"uint256","name":"_maxPrice","type":"uint256"}],"name":"bake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ethBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"outputBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pie","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recipe","outputs":[{"internalType":"contract PieRecipe","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saveETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"saveToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cap","type":"uint256"}],"name":"setCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pie","type":"address"}],"name":"setPie","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pie","type":"address"},{"internalType":"address","name":"_recipe","type":"address"}],"name":"setPieAndRecipe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipe","type":"address"}],"name":"setRecipe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_receiver","type":"address"}],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_receiver","type":"address"}],"name":"withdrawAllETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address payable","name":"_receiver","type":"address"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"withdrawOutput","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b506040516200347f3803806200347f833981810160405260a08110156200003757600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190505050620000856000801b86620001e460201b60201c565b620000ee60405160200180806020018281038252600a8152602001807f4341505f534554544552000000000000000000000000000000000000000000008152506020019150506040516020818303038152906040528051906020012085620001e460201b60201c565b620001576040516020018080602001828103825260058152602001807f42414b45520000000000000000000000000000000000000000000000000000008152506020019150506040516020818303038152906040528051906020012084620001e460201b60201c565b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050506200037a565b620001f68282620001fa60201b60201c565b5050565b62000228816000808581526020019081526020016000206000016200029d60201b620028ca1790919060201c565b1562000299576200023e620002d560201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000620002cd836000018373ffffffffffffffffffffffffffffffffffffffff1660001b620002dd60201b60201c565b905092915050565b600033905090565b6000620002f183836200035760201b60201c565b6200034c57826000018290806001815401808255809150506001900390600052602060002001600090919091909150558260000180549050836001016000848152602001908152602001600020819055506001905062000351565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b6130f5806200038a6000396000f3fe6080604052600436106101d15760003560e01c806391d14854116100f7578063d0e30db011610095578063f1a7ccfd11610064578063f1a7ccfd1461097d578063f58bfed3146109ee578063fa09e63014610a19578063fd68d5bf14610a6a576101e0565b8063d0e30db014610876578063d547741f14610880578063d6ea4c10146108db578063e560ce9c1461092c576101e0565b8063a114a5d2116100d1578063a114a5d2146106fd578063a217fddf14610797578063b13820a7146107c2578063ca15c87314610827576101e0565b806391d14854146106105780639bf70abd146106815780639ebd9115146106ac576101e0565b80633a1d2d021161016f5780637252bbf21161013e5780637252bbf2146104e4578063896f1a95146105495780638a95a746146105605780639010d07c146105a1576101e0565b80633a1d2d02146103dc57806347786d371461042d578063554d578d1461046857806367d6f65f14610493576101e0565b8063355274ea116101ab578063355274ea146102ba57806336118b52146102e557806336568abe1461034057806336f585881461039b576101e0565b8063092c5b3b146101e5578063248a9ca3146102105780632f2ff15d1461025f576101e0565b366101e0576101de610aab565b005b600080fd5b3480156101f157600080fd5b506101fa610d99565b6040518082815260200191505060405180910390f35b34801561021c57600080fd5b506102496004803603602081101561023357600080fd5b8101908080359060200190929190505050610da0565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b506102b86004803603604081101561028257600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dbf565b005b3480156102c657600080fd5b506102cf610e48565b6040518082815260200191505060405180910390f35b3480156102f157600080fd5b5061033e6004803603604081101561030857600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4e565b005b34801561034c57600080fd5b506103996004803603604081101561036357600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061112b565b005b3480156103a757600080fd5b506103b06111c4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e857600080fd5b5061042b600480360360208110156103ff57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111ea565b005b34801561043957600080fd5b506104666004803603602081101561045057600080fd5b81019080803590602001909291905050506112af565b005b34801561047457600080fd5b5061047d61138e565b6040518082815260200191505060405180910390f35b34801561049f57600080fd5b506104e2600480360360208110156104b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611398565b005b3480156104f057600080fd5b506105336004803603602081101561050757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061145d565b6040518082815260200191505060405180910390f35b34801561055557600080fd5b5061055e611475565b005b34801561056c57600080fd5b50610575611553565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105ad57600080fd5b506105e4600480360360408110156105c457600080fd5b810190808035906020019092919080359060200190929190505050611579565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561061c57600080fd5b506106696004803603604081101561063357600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115aa565b60405180821515815260200191505060405180910390f35b34801561068d57600080fd5b506106966115db565b6040518082815260200191505060405180910390f35b3480156106b857600080fd5b506106fb600480360360208110156106cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611636565b005b34801561070957600080fd5b506107956004803603606081101561072057600080fd5b810190808035906020019064010000000081111561073d57600080fd5b82018360208201111561074f57600080fd5b8035906020019184602083028401116401000000008311171561077157600080fd5b9091929391929390803590602001909291908035906020019092919050505061180c565b005b3480156107a357600080fd5b506107ac61208f565b6040518082815260200191505060405180910390f35b3480156107ce57600080fd5b50610811600480360360208110156107e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612096565b6040518082815260200191505060405180910390f35b34801561083357600080fd5b506108606004803603602081101561084a57600080fd5b81019080803590602001909291905050506120ae565b6040518082815260200191505060405180910390f35b61087e610aab565b005b34801561088c57600080fd5b506108d9600480360360408110156108a357600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120d4565b005b3480156108e757600080fd5b5061092a600480360360208110156108fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061215d565b005b34801561093857600080fd5b5061097b6004803603602081101561094f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124b6565b005b34801561098957600080fd5b506109ec600480360360408110156109a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126a2565b005b3480156109fa57600080fd5b50610a036126b8565b6040518082815260200191505060405180910390f35b348015610a2557600080fd5b50610a6860048036036020811015610a3c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612713565b005b348015610a7657600080fd5b50610a7f6128b2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610c35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b610c8734600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128fa90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600554471115610d42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f4d41585f4341500000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b7fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1565b6000801b81565b6000806000838152602001908152602001600020600201549050919050565b610de560008084815260200190815260200160002060020154610de0612982565b6115aa565b610e3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613011602f913960400191505060405180910390fd5b610e44828261298a565b5050565b60055481565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610f13576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610fd8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b61102a82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a1d90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156110b3573d6000803e3d6000fd5b507f51faa29987d414cc66998a6556a58b18659c063a7ed944d9a8439e54ba1844bf338383604051808473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a15050565b611133612982565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146111b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613091602f913960400191505060405180910390fd5b6111c08282612a67565b5050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000801b6111f881336115aa565b61126a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60405160200180806020018281038252600a8152602001807f4341505f534554544552000000000000000000000000000000000000000000008152506020019150506040516020818303038152906040528051906020012061131181336115aa565b611383576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b816005819055505050565b6000600554905090565b6000801b6113a681336115aa565b611418576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60016020528060005260406000206000915090505481565b6000801b61148381336115aa565b6114f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b73af2fe0d4fe879066b2baa68d9e56cc375df2281573ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561154f573d6000803e3d6000fd5b5050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006115a282600080868152602001908152602001600020600001612afa90919063ffffffff16565b905092915050565b60006115d382600080868152602001908152602001600020600001612b1490919063ffffffff16565b905092915050565b6040516020018080602001828103825260058152602001807f42414b45520000000000000000000000000000000000000000000000000000008152506020019150506040516020818303038152906040528051906020012081565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156116fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156117c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b611809600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610e4e565b50565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156118d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b6040516020018080602001828103825260058152602001807f42414b4552000000000000000000000000000000000000000000000000000000815250602001915050604051602081830303815290604052805190602001206119f881336115aa565b611a6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663335d15e3600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611b2157600080fd5b505af1158015611b35573d6000803e3d6000fd5b505050506040513d6020811015611b4b57600080fd5b8101908080519060200190929190505050905082811115611bd4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f50524943455f4552524f5200000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000805b87879050811015611f42576000600160008a8a85818110611bf557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083831415611c5d5750611f42565b83611c7182856128fa90919063ffffffff16565b11611c9057611c8981846128fa90919063ffffffff16565b9250611cbb565b611ca38385612a1d90919063ffffffff16565b9050611cb881846128fa90919063ffffffff16565b92505b611d3581600160008c8c87818110611ccf57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a1d90919063ffffffff16565b600160008b8b86818110611d4557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000611dc785611db9848b612b4490919063ffffffff16565b612bca90919063ffffffff16565b9050611e4381600260008d8d88818110611ddd57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128fa90919063ffffffff16565b600260008c8c87818110611e5357fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f96c59bac7680c77217510ed14bc725bbca570081c194f20c9fad3fa3b349ca438a8a85818110611edb57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168284604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150508080600101915050611bd8565b50818114611fb8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f494e53554646494349454e545f46554e4453000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663731dae7e83600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16886040518463ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506000604051808303818588803b15801561206d57600080fd5b505af1158015612081573d6000803e3d6000fd5b505050505050505050505050565b6000801b81565b60026020528060005260406000206000915090505481565b60006120cd600080848152602001908152602001600020600001612c14565b9050919050565b6120fa600080848152602001908152602001600020600201546120f5612982565b6115aa565b61214f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806130406030913960400191505060405180910390fd5b6121598282612a67565b5050565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612222576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156122e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561240357600080fd5b505af1158015612417573d6000803e3d6000fd5b505050506040513d602081101561242d57600080fd5b8101908080519060200190929190505050507f601812e3be00387a6117506f98da8c90f2abbc8b7369b08016996918895287a4338284604051808473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a15050565b6000801b6124c481336115aa565b612536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb73af2fe0d4fe879066b2baa68d9e56cc375df228158373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156125d357600080fd5b505afa1580156125e7573d6000803e3d6000fd5b505050506040513d60208110156125fd57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561266157600080fd5b505af1158015612675573d6000803e3d6000fd5b505050506040513d602081101561268b57600080fd5b810190808051906020019092919050505050505050565b6126ab82611398565b6126b4816111ea565b5050565b60405160200180806020018281038252600a8152602001807f4341505f534554544552000000000000000000000000000000000000000000008152506020019150506040516020818303038152906040528051906020012081565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156127d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561289d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b6128a681611636565b6128af8161215d565b50565b73af2fe0d4fe879066b2baa68d9e56cc375df2281581565b60006128f2836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612c29565b905092915050565b600080828401905083811015612978576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b6129b1816000808581526020019081526020016000206000016128ca90919063ffffffff16565b15612a19576129be612982565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000612a5f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612c99565b905092915050565b612a8e81600080858152602001908152602001600020600001612d5990919063ffffffff16565b15612af657612a9b612982565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000612b098360000183612d89565b60001c905092915050565b6000612b3c836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612e0c565b905092915050565b600080831415612b575760009050612bc4565b6000828402905082848281612b6857fe5b0414612bbf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130706021913960400191505060405180910390fd5b809150505b92915050565b6000612c0c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612e2f565b905092915050565b6000612c2282600001612ef5565b9050919050565b6000612c358383612e0c565b612c8e578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612c93565b600090505b92915050565b6000838311158290612d46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d0b578082015181840152602081019050612cf0565b50505050905090810190601f168015612d385780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000612d81836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612f06565b905092915050565b600081836000018054905011612dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612fef6022913960400191505060405180910390fd5b826000018281548110612df957fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083118290612edb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612ea0578082015181840152602081019050612e85565b50505050905090810190601f168015612ecd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612ee757fe5b049050809150509392505050565b600081600001805490509050919050565b60008083600101600084815260200190815260200160002054905060008114612fe25760006001820390506000600186600001805490500390506000866000018281548110612f5157fe5b9060005260206000200154905080876000018481548110612f6e57fe5b9060005260206000200181905550600183018760010160008381526020019081526020016000208190555086600001805480612fa657fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612fe8565b60009150505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220cfa5fb6350a22c24a70c1746cc0428c60d859b55d243b517b1085ba13963d85c64736f6c6343000701003300000000000000000000000099f7bd5d58b01dab2cd268db7f4588153aa978ac00000000000000000000000099f7bd5d58b01dab2cd268db7f4588153aa978ac000000000000000000000000521946856bd1cee6efcae30a418810698a0f64a900000000000000000000000017525e4f4af59fbc29551bc4ece6ab60ed49ce310000000000000000000000006cb4b8669e23295563d3b34df4a760c0cee993c7

Deployed Bytecode

0x6080604052600436106101d15760003560e01c806391d14854116100f7578063d0e30db011610095578063f1a7ccfd11610064578063f1a7ccfd1461097d578063f58bfed3146109ee578063fa09e63014610a19578063fd68d5bf14610a6a576101e0565b8063d0e30db014610876578063d547741f14610880578063d6ea4c10146108db578063e560ce9c1461092c576101e0565b8063a114a5d2116100d1578063a114a5d2146106fd578063a217fddf14610797578063b13820a7146107c2578063ca15c87314610827576101e0565b806391d14854146106105780639bf70abd146106815780639ebd9115146106ac576101e0565b80633a1d2d021161016f5780637252bbf21161013e5780637252bbf2146104e4578063896f1a95146105495780638a95a746146105605780639010d07c146105a1576101e0565b80633a1d2d02146103dc57806347786d371461042d578063554d578d1461046857806367d6f65f14610493576101e0565b8063355274ea116101ab578063355274ea146102ba57806336118b52146102e557806336568abe1461034057806336f585881461039b576101e0565b8063092c5b3b146101e5578063248a9ca3146102105780632f2ff15d1461025f576101e0565b366101e0576101de610aab565b005b600080fd5b3480156101f157600080fd5b506101fa610d99565b6040518082815260200191505060405180910390f35b34801561021c57600080fd5b506102496004803603602081101561023357600080fd5b8101908080359060200190929190505050610da0565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b506102b86004803603604081101561028257600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dbf565b005b3480156102c657600080fd5b506102cf610e48565b6040518082815260200191505060405180910390f35b3480156102f157600080fd5b5061033e6004803603604081101561030857600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4e565b005b34801561034c57600080fd5b506103996004803603604081101561036357600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061112b565b005b3480156103a757600080fd5b506103b06111c4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e857600080fd5b5061042b600480360360208110156103ff57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111ea565b005b34801561043957600080fd5b506104666004803603602081101561045057600080fd5b81019080803590602001909291905050506112af565b005b34801561047457600080fd5b5061047d61138e565b6040518082815260200191505060405180910390f35b34801561049f57600080fd5b506104e2600480360360208110156104b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611398565b005b3480156104f057600080fd5b506105336004803603602081101561050757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061145d565b6040518082815260200191505060405180910390f35b34801561055557600080fd5b5061055e611475565b005b34801561056c57600080fd5b50610575611553565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105ad57600080fd5b506105e4600480360360408110156105c457600080fd5b810190808035906020019092919080359060200190929190505050611579565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561061c57600080fd5b506106696004803603604081101561063357600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115aa565b60405180821515815260200191505060405180910390f35b34801561068d57600080fd5b506106966115db565b6040518082815260200191505060405180910390f35b3480156106b857600080fd5b506106fb600480360360208110156106cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611636565b005b34801561070957600080fd5b506107956004803603606081101561072057600080fd5b810190808035906020019064010000000081111561073d57600080fd5b82018360208201111561074f57600080fd5b8035906020019184602083028401116401000000008311171561077157600080fd5b9091929391929390803590602001909291908035906020019092919050505061180c565b005b3480156107a357600080fd5b506107ac61208f565b6040518082815260200191505060405180910390f35b3480156107ce57600080fd5b50610811600480360360208110156107e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612096565b6040518082815260200191505060405180910390f35b34801561083357600080fd5b506108606004803603602081101561084a57600080fd5b81019080803590602001909291905050506120ae565b6040518082815260200191505060405180910390f35b61087e610aab565b005b34801561088c57600080fd5b506108d9600480360360408110156108a357600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120d4565b005b3480156108e757600080fd5b5061092a600480360360208110156108fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061215d565b005b34801561093857600080fd5b5061097b6004803603602081101561094f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124b6565b005b34801561098957600080fd5b506109ec600480360360408110156109a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126a2565b005b3480156109fa57600080fd5b50610a036126b8565b6040518082815260200191505060405180910390f35b348015610a2557600080fd5b50610a6860048036036020811015610a3c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612713565b005b348015610a7657600080fd5b50610a7f6128b2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610c35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b610c8734600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128fa90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600554471115610d42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f4d41585f4341500000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b7fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1565b6000801b81565b6000806000838152602001908152602001600020600201549050919050565b610de560008084815260200190815260200160002060020154610de0612982565b6115aa565b610e3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613011602f913960400191505060405180910390fd5b610e44828261298a565b5050565b60055481565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610f13576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610fd8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b61102a82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a1d90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156110b3573d6000803e3d6000fd5b507f51faa29987d414cc66998a6556a58b18659c063a7ed944d9a8439e54ba1844bf338383604051808473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a15050565b611133612982565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146111b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613091602f913960400191505060405180910390fd5b6111c08282612a67565b5050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000801b6111f881336115aa565b61126a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60405160200180806020018281038252600a8152602001807f4341505f534554544552000000000000000000000000000000000000000000008152506020019150506040516020818303038152906040528051906020012061131181336115aa565b611383576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b816005819055505050565b6000600554905090565b6000801b6113a681336115aa565b611418576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60016020528060005260406000206000915090505481565b6000801b61148381336115aa565b6114f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b73af2fe0d4fe879066b2baa68d9e56cc375df2281573ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561154f573d6000803e3d6000fd5b5050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006115a282600080868152602001908152602001600020600001612afa90919063ffffffff16565b905092915050565b60006115d382600080868152602001908152602001600020600001612b1490919063ffffffff16565b905092915050565b6040516020018080602001828103825260058152602001807f42414b45520000000000000000000000000000000000000000000000000000008152506020019150506040516020818303038152906040528051906020012081565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156116fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156117c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b611809600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610e4e565b50565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156118d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b6040516020018080602001828103825260058152602001807f42414b4552000000000000000000000000000000000000000000000000000000815250602001915050604051602081830303815290604052805190602001206119f881336115aa565b611a6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663335d15e3600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611b2157600080fd5b505af1158015611b35573d6000803e3d6000fd5b505050506040513d6020811015611b4b57600080fd5b8101908080519060200190929190505050905082811115611bd4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f50524943455f4552524f5200000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000805b87879050811015611f42576000600160008a8a85818110611bf557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083831415611c5d5750611f42565b83611c7182856128fa90919063ffffffff16565b11611c9057611c8981846128fa90919063ffffffff16565b9250611cbb565b611ca38385612a1d90919063ffffffff16565b9050611cb881846128fa90919063ffffffff16565b92505b611d3581600160008c8c87818110611ccf57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a1d90919063ffffffff16565b600160008b8b86818110611d4557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000611dc785611db9848b612b4490919063ffffffff16565b612bca90919063ffffffff16565b9050611e4381600260008d8d88818110611ddd57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128fa90919063ffffffff16565b600260008c8c87818110611e5357fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f96c59bac7680c77217510ed14bc725bbca570081c194f20c9fad3fa3b349ca438a8a85818110611edb57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168284604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150508080600101915050611bd8565b50818114611fb8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f494e53554646494349454e545f46554e4453000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663731dae7e83600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16886040518463ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506000604051808303818588803b15801561206d57600080fd5b505af1158015612081573d6000803e3d6000fd5b505050505050505050505050565b6000801b81565b60026020528060005260406000206000915090505481565b60006120cd600080848152602001908152602001600020600001612c14565b9050919050565b6120fa600080848152602001908152602001600020600201546120f5612982565b6115aa565b61214f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806130406030913960400191505060405180910390fd5b6121598282612a67565b5050565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612222576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156122e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561240357600080fd5b505af1158015612417573d6000803e3d6000fd5b505050506040513d602081101561242d57600080fd5b8101908080519060200190929190505050507f601812e3be00387a6117506f98da8c90f2abbc8b7369b08016996918895287a4338284604051808473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a15050565b6000801b6124c481336115aa565b612536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f415554485f4641494c454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb73af2fe0d4fe879066b2baa68d9e56cc375df228158373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156125d357600080fd5b505afa1580156125e7573d6000803e3d6000fd5b505050506040513d60208110156125fd57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561266157600080fd5b505af1158015612675573d6000803e3d6000fd5b505050506040513d602081101561268b57600080fd5b810190808051906020019092919050505050505050565b6126ab82611398565b6126b4816111ea565b5050565b60405160200180806020018281038252600a8152602001807f4341505f534554544552000000000000000000000000000000000000000000008152506020019150506040516020818303038152906040528051906020012081565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156127d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f5049455f4e4f545f53455400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561289d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f5245434950455f4e4f545f53455400000000000000000000000000000000000081525060200191505060405180910390fd5b6128a681611636565b6128af8161215d565b50565b73af2fe0d4fe879066b2baa68d9e56cc375df2281581565b60006128f2836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612c29565b905092915050565b600080828401905083811015612978576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b6129b1816000808581526020019081526020016000206000016128ca90919063ffffffff16565b15612a19576129be612982565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000612a5f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612c99565b905092915050565b612a8e81600080858152602001908152602001600020600001612d5990919063ffffffff16565b15612af657612a9b612982565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000612b098360000183612d89565b60001c905092915050565b6000612b3c836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612e0c565b905092915050565b600080831415612b575760009050612bc4565b6000828402905082848281612b6857fe5b0414612bbf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130706021913960400191505060405180910390fd5b809150505b92915050565b6000612c0c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612e2f565b905092915050565b6000612c2282600001612ef5565b9050919050565b6000612c358383612e0c565b612c8e578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612c93565b600090505b92915050565b6000838311158290612d46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d0b578082015181840152602081019050612cf0565b50505050905090810190601f168015612d385780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000612d81836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612f06565b905092915050565b600081836000018054905011612dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612fef6022913960400191505060405180910390fd5b826000018281548110612df957fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083118290612edb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612ea0578082015181840152602081019050612e85565b50505050905090810190601f168015612ecd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612ee757fe5b049050809150509392505050565b600081600001805490509050919050565b60008083600101600084815260200190815260200160002054905060008114612fe25760006001820390506000600186600001805490500390506000866000018281548110612f5157fe5b9060005260206000200154905080876000018481548110612f6e57fe5b9060005260206000200181905550600183018760010160008381526020019081526020016000208190555086600001805480612fa657fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612fe8565b60009150505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220cfa5fb6350a22c24a70c1746cc0428c60d859b55d243b517b1085ba13963d85c64736f6c63430007010033

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

00000000000000000000000099f7bd5d58b01dab2cd268db7f4588153aa978ac00000000000000000000000099f7bd5d58b01dab2cd268db7f4588153aa978ac000000000000000000000000521946856bd1cee6efcae30a418810698a0f64a900000000000000000000000017525e4f4af59fbc29551bc4ece6ab60ed49ce310000000000000000000000006cb4b8669e23295563d3b34df4a760c0cee993c7

-----Decoded View---------------
Arg [0] : _controller (address): 0x99f7bd5d58b01dAb2cd268dB7F4588153Aa978aC
Arg [1] : _capSetter (address): 0x99f7bd5d58b01dAb2cd268dB7F4588153Aa978aC
Arg [2] : _baker (address): 0x521946856Bd1cEE6eFCAE30a418810698a0f64A9
Arg [3] : _pie (address): 0x17525E4f4Af59fbc29551bC4eCe6AB60Ed49CE31
Arg [4] : _recipe (address): 0x6cB4b8669e23295563D3b34dF4a760c0CeE993C7

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 00000000000000000000000099f7bd5d58b01dab2cd268db7f4588153aa978ac
Arg [1] : 00000000000000000000000099f7bd5d58b01dab2cd268db7f4588153aa978ac
Arg [2] : 000000000000000000000000521946856bd1cee6efcae30a418810698a0f64a9
Arg [3] : 00000000000000000000000017525e4f4af59fbc29551bc4ece6ab60ed49ce31
Arg [4] : 0000000000000000000000006cb4b8669e23295563d3b34df4a760c0cee993c7


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ 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.