Address Details
contract

0x16396273D244a651C2Bf3D33aD3CA21952E4dE2A

Contract Name
ConstantProductPricingModule
Creator
0x278160–50fc38 at 0x1296c7–c5ae83
Balance
0 CELO
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
15290471
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
ConstantProductPricingModule




Optimization enabled
true
Compiler version
v0.5.17+commit.d19bba13




Optimization runs
10000
EVM Version
istanbul




Verified at
2022-12-01T05:37:00.129914Z

contracts/ConstantProductPricingModule.sol

pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;

import { IPricingModule } from "./interfaces/IPricingModule.sol";

import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import { FixidityLib } from "./common/FixidityLib.sol";

/**
 * @title ConstantProductPricingModule
 * @notice The ConstantProductPricingModule calculates the amount in and the amount out for a constant product AMM.
 */
contract ConstantProductPricingModule is IPricingModule {
  using SafeMath for uint256;
  using FixidityLib for FixidityLib.Fraction;

  /* ==================== View Functions ==================== */
  /**
   * @notice Calculates the amount of tokens that should be received based on the given parameters
   * @dev amountOut = (tokenOutBucketSize * (1-spread) * amountIn ) / (tokenInBucketSize + amountIn * (1-spread))
   * @param tokenInBucketSize The bucket size of the token swapt in.
   * @param tokenOutBucketSize The bucket size of the token swapt out.
   * @param spread The spread that is applied to a swap.
   * @param amountIn The amount of tokens in wei that is swapt in.
   * @return amountOut The amount of tokens in wei that should be received.
   */
  function getAmountOut(
    uint256 tokenInBucketSize,
    uint256 tokenOutBucketSize,
    uint256 spread,
    uint256 amountIn
  ) external view returns (uint256) {
    if (amountIn == 0) return 0;

    FixidityLib.Fraction memory spreadFraction = FixidityLib.wrap(spread);
    FixidityLib.Fraction memory netAmountIn = FixidityLib.fixed1().subtract(spreadFraction).multiply(
      FixidityLib.newFixed(amountIn)
    );

    FixidityLib.Fraction memory numerator = netAmountIn.multiply(FixidityLib.newFixed(tokenOutBucketSize));
    FixidityLib.Fraction memory denominator = FixidityLib.newFixed(tokenInBucketSize).add(netAmountIn);

    // Can't use FixidityLib.divide because numerator can easily be greater
    // than maxFixedDivisor.
    // Fortunately, we expect an integer result, so integer division gives us as
    // much precision as we could hope for.
    return numerator.unwrap().div(denominator.unwrap());
  }

  /**
   * @notice Calculates the amount of tokens that should be provided in order to receive the desired amount out.
   * @dev amountIn = (amountOut * tokenInBucketSize) / (Y-dy) ) * (1-spread)
   * @param tokenInBucketSize The bucket size of the token swapt in.
   * @param tokenOutBucketSize The bucket size of the token swapt out.
   * @param spread The spread that is applied to a swap.
   * @param amountOut The amount of tokens in wei that should be swapt out.
   * @return amountIn The amount of tokens in wei that should be provided.
   */
  function getAmountIn(
    uint256 tokenInBucketSize,
    uint256 tokenOutBucketSize,
    uint256 spread,
    uint256 amountOut
  ) external view returns (uint256) {
    FixidityLib.Fraction memory spreadFraction = FixidityLib.wrap(spread);

    FixidityLib.Fraction memory numerator = FixidityLib.newFixed(amountOut.mul(tokenInBucketSize));
    FixidityLib.Fraction memory denominator = FixidityLib.newFixed(tokenOutBucketSize.sub(amountOut)).multiply(
      FixidityLib.fixed1().subtract(spreadFraction)
    );

    // See comment in getAmountOut.
    return numerator.unwrap().div(denominator.unwrap());
  }

  /**
   * @notice Returns the AMM that the IPricingModule implements
   * @return Constant Product.
   */
  function name() external view returns (string memory) {
    return "ConstantProduct";
  }
}
        

/lib/openzeppelin-contracts/contracts/math/SafeMath.sol

pragma solidity ^0.5.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.
     *
     * _Available since v2.4.0._
     */
    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.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}
          

/contracts/interfaces/IPricingModule.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

/**
 * @title Interface for a Mento Pricing Module.
 * @notice A Mento pricing module represents an exchange relation between a pair of ERC20 assets.
 */
interface IPricingModule {
  /**
   * @notice Returns the output amount and new bucket sizes for a given input amount.
   * @param tokenInBucketSize Size of the tokenIn bucket.
   * @param tokenOutBucketSize Size of the tokenOut bucket.
   * @param spread Spread charged on exchanges.
   * @param amountIn Amount of tokenIn being paid in.
   * @return amountOut Amount of tokenOut that will be paid out.
   */
  function getAmountOut(
    uint256 tokenInBucketSize,
    uint256 tokenOutBucketSize,
    uint256 spread,
    uint256 amountIn
  ) external view returns (uint256 amountOut);

  /**
   * @notice Returns the input amount necessary for a given output amount.
   * @param tokenInBucketSize Size of the tokenIn bucket.
   * @param tokenOutBucketSize Size of the tokenOut bucket.
   * @param spread Spread charged on exchanges.
   * @param amountOut Amount of tokenIn being paid out.
   * @return amountIn Amount of tokenOut that would have to be paid in.
   */
  function getAmountIn(
    uint256 tokenInBucketSize,
    uint256 tokenOutBucketSize,
    uint256 spread,
    uint256 amountOut
  ) external view returns (uint256 amountIn);

  /**
   * @notice Retrieve the name of this pricing module.
   * @return exchangeName The name of the pricing module.
   */
  function name() external view returns (string memory pricingModuleName);
}
          

/contracts/common/FixidityLib.sol

pragma solidity ^0.5.13;

/**
 * @title FixidityLib
 * @author Gadi Guy, Alberto Cuesta Canada
 * @notice This library provides fixed point arithmetic with protection against
 * overflow.
 * All operations are done with uint256 and the operands must have been created
 * with any of the newFrom* functions, which shift the comma digits() to the
 * right and check for limits, or with wrap() which expects a number already
 * in the internal representation of a fraction.
 * When using this library be sure to use maxNewFixed() as the upper limit for
 * creation of fixed point numbers.
 * @dev All contained functions are pure and thus marked internal to be inlined
 * on consuming contracts at compile time for gas efficiency.
 */
library FixidityLib {
  struct Fraction {
    uint256 value;
  }

  /**
   * @notice Number of positions that the comma is shifted to the right.
   */
  function digits() internal pure returns (uint8) {
    return 24;
  }

  uint256 private constant FIXED1_UINT = 1000000000000000000000000;

  /**
   * @notice This is 1 in the fixed point units used in this library.
   * @dev Test fixed1() equals 10^digits()
   * Hardcoded to 24 digits.
   */
  function fixed1() internal pure returns (Fraction memory) {
    return Fraction(FIXED1_UINT);
  }

  /**
   * @notice Wrap a uint256 that represents a 24-decimal fraction in a Fraction
   * struct.
   * @param x Number that already represents a 24-decimal fraction.
   * @return A Fraction struct with contents x.
   */
  function wrap(uint256 x) internal pure returns (Fraction memory) {
    return Fraction(x);
  }

  /**
   * @notice Unwraps the uint256 inside of a Fraction struct.
   */
  function unwrap(Fraction memory x) internal pure returns (uint256) {
    return x.value;
  }

  /**
   * @notice The amount of decimals lost on each multiplication operand.
   * @dev Test mulPrecision() equals sqrt(fixed1)
   */
  function mulPrecision() internal pure returns (uint256) {
    return 1000000000000;
  }

  /**
   * @notice Maximum value that can be converted to fixed point. Optimize for deployment.
   * @dev
   * Test maxNewFixed() equals maxUint256() / fixed1()
   */
  function maxNewFixed() internal pure returns (uint256) {
    return 115792089237316195423570985008687907853269984665640564;
  }

  /**
   * @notice Converts a uint256 to fixed point Fraction
   * @dev Test newFixed(0) returns 0
   * Test newFixed(1) returns fixed1()
   * Test newFixed(maxNewFixed()) returns maxNewFixed() * fixed1()
   * Test newFixed(maxNewFixed()+1) fails
   */
  function newFixed(uint256 x) internal pure returns (Fraction memory) {
    require(x <= maxNewFixed(), "can't create fixidity number larger than maxNewFixed()");
    return Fraction(x * FIXED1_UINT);
  }

  /**
   * @notice Converts a uint256 in the fixed point representation of this
   * library to a non decimal. All decimal digits will be truncated.
   */
  function fromFixed(Fraction memory x) internal pure returns (uint256) {
    return x.value / FIXED1_UINT;
  }

  /**
   * @notice Converts two uint256 representing a fraction to fixed point units,
   * equivalent to multiplying dividend and divisor by 10^digits().
   * @param numerator numerator must be <= maxNewFixed()
   * @param denominator denominator must be <= maxNewFixed() and denominator can't be 0
   * @dev
   * Test newFixedFraction(1,0) fails
   * Test newFixedFraction(0,1) returns 0
   * Test newFixedFraction(1,1) returns fixed1()
   * Test newFixedFraction(1,fixed1()) returns 1
   */
  function newFixedFraction(uint256 numerator, uint256 denominator) internal pure returns (Fraction memory) {
    Fraction memory convertedNumerator = newFixed(numerator);
    Fraction memory convertedDenominator = newFixed(denominator);
    return divide(convertedNumerator, convertedDenominator);
  }

  /**
   * @notice Returns the integer part of a fixed point number.
   * @dev
   * Test integer(0) returns 0
   * Test integer(fixed1()) returns fixed1()
   * Test integer(newFixed(maxNewFixed())) returns maxNewFixed()*fixed1()
   */
  function integer(Fraction memory x) internal pure returns (Fraction memory) {
    return Fraction((x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
  }

  /**
   * @notice Returns the fractional part of a fixed point number.
   * In the case of a negative number the fractional is also negative.
   * @dev
   * Test fractional(0) returns 0
   * Test fractional(fixed1()) returns 0
   * Test fractional(fixed1()-1) returns 10^24-1
   */
  function fractional(Fraction memory x) internal pure returns (Fraction memory) {
    return Fraction(x.value - (x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
  }

  /**
   * @notice x+y.
   * @dev The maximum value that can be safely used as an addition operator is defined as
   * maxFixedAdd = maxUint256()-1 / 2, or
   * 57896044618658097711785492504343953926634992332820282019728792003956564819967.
   * Test add(maxFixedAdd,maxFixedAdd) equals maxFixedAdd + maxFixedAdd
   * Test add(maxFixedAdd+1,maxFixedAdd+1) throws
   */
  function add(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
    uint256 z = x.value + y.value;
    require(z >= x.value, "add overflow detected");
    return Fraction(z);
  }

  /**
   * @notice x-y.
   * @dev
   * Test subtract(6, 10) fails
   */
  function subtract(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
    require(x.value >= y.value, "substraction underflow detected");
    return Fraction(x.value - y.value);
  }

  /**
   * @notice x*y. If any of the operators is higher than the max multiplier value it
   * might overflow.
   * @dev The maximum value that can be safely used as a multiplication operator
   * (maxFixedMul) is calculated as sqrt(maxUint256()*fixed1()),
   * or 340282366920938463463374607431768211455999999999999
   * Test multiply(0,0) returns 0
   * Test multiply(maxFixedMul,0) returns 0
   * Test multiply(0,maxFixedMul) returns 0
   * Test multiply(fixed1()/mulPrecision(),fixed1()*mulPrecision()) returns fixed1()
   * Test multiply(maxFixedMul,maxFixedMul) is around maxUint256()
   * Test multiply(maxFixedMul+1,maxFixedMul+1) fails
   */
  // solhint-disable-next-line code-complexity
  function multiply(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
    if (x.value == 0 || y.value == 0) return Fraction(0);
    if (y.value == FIXED1_UINT) return x;
    if (x.value == FIXED1_UINT) return y;

    // Separate into integer and fractional parts
    // x = x1 + x2, y = y1 + y2
    uint256 x1 = integer(x).value / FIXED1_UINT;
    uint256 x2 = fractional(x).value;
    uint256 y1 = integer(y).value / FIXED1_UINT;
    uint256 y2 = fractional(y).value;

    // (x1 + x2) * (y1 + y2) = (x1 * y1) + (x1 * y2) + (x2 * y1) + (x2 * y2)
    uint256 x1y1 = x1 * y1;
    if (x1 != 0) require(x1y1 / x1 == y1, "overflow x1y1 detected");

    // x1y1 needs to be multiplied back by fixed1
    // solhint-disable-next-line var-name-mixedcase
    uint256 fixed_x1y1 = x1y1 * FIXED1_UINT;
    if (x1y1 != 0) require(fixed_x1y1 / x1y1 == FIXED1_UINT, "overflow x1y1 * fixed1 detected");
    x1y1 = fixed_x1y1;

    uint256 x2y1 = x2 * y1;
    if (x2 != 0) require(x2y1 / x2 == y1, "overflow x2y1 detected");

    uint256 x1y2 = x1 * y2;
    if (x1 != 0) require(x1y2 / x1 == y2, "overflow x1y2 detected");

    x2 = x2 / mulPrecision();
    y2 = y2 / mulPrecision();
    uint256 x2y2 = x2 * y2;
    if (x2 != 0) require(x2y2 / x2 == y2, "overflow x2y2 detected");

    // result = fixed1() * x1 * y1 + x1 * y2 + x2 * y1 + x2 * y2 / fixed1();
    Fraction memory result = Fraction(x1y1);
    result = add(result, Fraction(x2y1)); // Add checks for overflow
    result = add(result, Fraction(x1y2)); // Add checks for overflow
    result = add(result, Fraction(x2y2)); // Add checks for overflow
    return result;
  }

  /**
   * @notice 1/x
   * @dev
   * Test reciprocal(0) fails
   * Test reciprocal(fixed1()) returns fixed1()
   * Test reciprocal(fixed1()*fixed1()) returns 1 // Testing how the fractional is truncated
   * Test reciprocal(1+fixed1()*fixed1()) returns 0 // Testing how the fractional is truncated
   * Test reciprocal(newFixedFraction(1, 1e24)) returns newFixed(1e24)
   */
  function reciprocal(Fraction memory x) internal pure returns (Fraction memory) {
    require(x.value != 0, "can't call reciprocal(0)");
    return Fraction((FIXED1_UINT * FIXED1_UINT) / x.value); // Can't overflow
  }

  /**
   * @notice x/y. If the dividend is higher than the max dividend value, it
   * might overflow. You can use multiply(x,reciprocal(y)) instead.
   * @dev The maximum value that can be safely used as a dividend (maxNewFixed) is defined as
   * divide(maxNewFixed,newFixedFraction(1,fixed1())) is around maxUint256().
   * This yields the value 115792089237316195423570985008687907853269984665640564.
   * Test maxNewFixed equals maxUint256()/fixed1()
   * Test divide(maxNewFixed,1) equals maxNewFixed*(fixed1)
   * Test divide(maxNewFixed+1,multiply(mulPrecision(),mulPrecision())) throws
   * Test divide(fixed1(),0) fails
   * Test divide(maxNewFixed,1) = maxNewFixed*(10^digits())
   * Test divide(maxNewFixed+1,1) throws
   */
  function divide(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
    require(y.value != 0, "can't divide by 0");
    // solhint-disable-next-line var-name-mixedcase
    uint256 X = x.value * FIXED1_UINT;
    require(X / FIXED1_UINT == x.value, "overflow at divide");
    return Fraction(X / y.value);
  }

  /**
   * @notice x > y
   */
  function gt(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value > y.value;
  }

  /**
   * @notice x >= y
   */
  function gte(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value >= y.value;
  }

  /**
   * @notice x < y
   */
  function lt(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value < y.value;
  }

  /**
   * @notice x <= y
   */
  function lte(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value <= y.value;
  }

  /**
   * @notice x == y
   */
  function equals(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value == y.value;
  }

  /**
   * @notice x <= 1
   */
  function isProperFraction(Fraction memory x) internal pure returns (bool) {
    return lte(x, fixed1());
  }
}
          

Contract ABI

[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getAmountIn","inputs":[{"type":"uint256","name":"tokenInBucketSize","internalType":"uint256"},{"type":"uint256","name":"tokenOutBucketSize","internalType":"uint256"},{"type":"uint256","name":"spread","internalType":"uint256"},{"type":"uint256","name":"amountOut","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getAmountOut","inputs":[{"type":"uint256","name":"tokenInBucketSize","internalType":"uint256"},{"type":"uint256","name":"tokenOutBucketSize","internalType":"uint256"},{"type":"uint256","name":"spread","internalType":"uint256"},{"type":"uint256","name":"amountIn","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[],"constant":true}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50610cff806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806306fdde031461004657806352707d8c14610064578063571fd01214610084575b600080fd5b61004e610097565b60405161005b9190610b92565b60405180910390f35b61007761007236600461089d565b6100ce565b60405161005b9190610c33565b61007761009236600461089d565b6101a0565b60408051808201909152600f81527f436f6e7374616e7450726f647563740000000000000000000000000000000000602082015290565b6000816100dd57506000610198565b6100e561087f565b6100ee8461021b565b90506100f861087f565b61012861010485610235565b61011c846101106102a7565b9063ffffffff6102cb16565b9063ffffffff61032916565b905061013261087f565b61014b61013e88610235565b839063ffffffff61032916565b905061015561087f565b61016e836101628b610235565b9063ffffffff61061416565b905061019161017c82610672565b61018584610672565b9063ffffffff61067616565b9450505050505b949350505050565b60006101aa61087f565b6101b38461021b565b90506101bd61087f565b6101d56101d0858963ffffffff6106bf16565b610235565b90506101df61087f565b6102016101ee846101106102a7565b61011c6101d08a8963ffffffff61071316565b905061020f61017c82610672565b98975050505050505050565b61022361087f565b50604080516020810190915290815290565b61023d61087f565b610245610755565b821115610287576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610bd3565b60405180910390fd5b50604080516020810190915269d3c21bcecceda100000082028152919050565b6102af61087f565b50604080516020810190915269d3c21bcecceda1000000815290565b6102d361087f565b81518351101561030f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610bb3565b506040805160208101909152815183510381525b92915050565b61033161087f565b8251158061033e57508151155b156103585750604080516020810190915260008152610323565b815169d3c21bcecceda10000001415610372575081610323565b825169d3c21bcecceda1000000141561038c575080610323565b600069d3c21bcecceda10000006103a285610770565b51816103aa57fe5b04905060006103b8856107a5565b519050600069d3c21bcecceda10000006103d186610770565b51816103d957fe5b04905060006103e7866107a5565b519050838202841561043557828582816103fd57fe5b0414610435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610ba3565b69d3c21bcecceda1000000810281156104945769d3c21bcecceda100000082828161045c57fe5b0414610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610c13565b90508084840285156104e257848682816104aa57fe5b04146104e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610c23565b868402871561052d57848882816104f557fe5b041461052d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610bf3565b6105356107df565b878161053d57fe5b0496506105486107df565b858161055057fe5b049450868502871561059e578588828161056657fe5b041461059e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610bc3565b6105a661087f565b60405180602001604052808781525090506105cf81604051806020016040528087815250610614565b90506105e981604051806020016040528086815250610614565b905061060381604051806020016040528085815250610614565b9d9c50505050505050505050505050565b61061c61087f565b815183519081019081101561065d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610c03565b60408051602081019091529081529392505050565b5190565b60006106b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506107e8565b9392505050565b6000826106ce57506000610323565b828202828482816106db57fe5b04146106b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610be3565b60006106b883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610839565b7601357c299a88ea76a58924d52ce4f26a85af186c2b9e7490565b61077861087f565b604051806020016040528069d3c21bcecceda10000008085600001518161079b57fe5b0402905292915050565b6107ad61087f565b604051806020016040528069d3c21bcecceda1000000808560000151816107d057fe5b95519504029093039092525090565b64e8d4a5100090565b60008183610823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e9190610b92565b50600083858161082f57fe5b0495945050505050565b60008184841115610877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e9190610b92565b505050900390565b6040518060200160405280600081525090565b803561032381610ca5565b600080600080608085870312156108b357600080fd5b60006108bf8787610892565b94505060206108d087828801610892565b93505060406108e187828801610892565b92505060606108f287828801610892565b91505092959194509250565b600061090982610672565b6109138185610c41565b9350610923818560208601610c4d565b61092c81610c7d565b9093019392505050565b6000610943601683610c41565b7f6f766572666c6f77207831793120646574656374656400000000000000000000815260200192915050565b600061097c601f83610c41565b7f737562737472616374696f6e20756e646572666c6f7720646574656374656400815260200192915050565b60006109b5601683610c41565b7f6f766572666c6f77207832793220646574656374656400000000000000000000815260200192915050565b60006109ee603683610c41565b7f63616e277420637265617465206669786964697479206e756d626572206c617281527f676572207468616e206d61784e65774669786564282900000000000000000000602082015260400192915050565b6000610a4d602183610c41565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f81527f7700000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000610aac601683610c41565b7f6f766572666c6f77207831793220646574656374656400000000000000000000815260200192915050565b6000610ae5601583610c41565b7f616464206f766572666c6f772064657465637465640000000000000000000000815260200192915050565b6000610b1e601f83610c41565b7f6f766572666c6f772078317931202a2066697865643120646574656374656400815260200192915050565b6000610b57601683610c41565b7f6f766572666c6f77207832793120646574656374656400000000000000000000815260200192915050565b610b8c81610c4a565b82525050565b602080825281016106b881846108fe565b6020808252810161032381610936565b602080825281016103238161096f565b60208082528101610323816109a8565b60208082528101610323816109e1565b6020808252810161032381610a40565b6020808252810161032381610a9f565b6020808252810161032381610ad8565b6020808252810161032381610b11565b6020808252810161032381610b4a565b602081016103238284610b83565b90815260200190565b90565b60005b83811015610c68578181015183820152602001610c50565b83811115610c77576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b610cae81610c4a565b8114610cb957600080fd5b5056fea365627a7a72315820905176f3f305c63be53707514ef0fb8352a56e6f1356c53405418966d4311d9c6c6578706572696d656e74616cf564736f6c63430005110040

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c806306fdde031461004657806352707d8c14610064578063571fd01214610084575b600080fd5b61004e610097565b60405161005b9190610b92565b60405180910390f35b61007761007236600461089d565b6100ce565b60405161005b9190610c33565b61007761009236600461089d565b6101a0565b60408051808201909152600f81527f436f6e7374616e7450726f647563740000000000000000000000000000000000602082015290565b6000816100dd57506000610198565b6100e561087f565b6100ee8461021b565b90506100f861087f565b61012861010485610235565b61011c846101106102a7565b9063ffffffff6102cb16565b9063ffffffff61032916565b905061013261087f565b61014b61013e88610235565b839063ffffffff61032916565b905061015561087f565b61016e836101628b610235565b9063ffffffff61061416565b905061019161017c82610672565b61018584610672565b9063ffffffff61067616565b9450505050505b949350505050565b60006101aa61087f565b6101b38461021b565b90506101bd61087f565b6101d56101d0858963ffffffff6106bf16565b610235565b90506101df61087f565b6102016101ee846101106102a7565b61011c6101d08a8963ffffffff61071316565b905061020f61017c82610672565b98975050505050505050565b61022361087f565b50604080516020810190915290815290565b61023d61087f565b610245610755565b821115610287576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610bd3565b60405180910390fd5b50604080516020810190915269d3c21bcecceda100000082028152919050565b6102af61087f565b50604080516020810190915269d3c21bcecceda1000000815290565b6102d361087f565b81518351101561030f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610bb3565b506040805160208101909152815183510381525b92915050565b61033161087f565b8251158061033e57508151155b156103585750604080516020810190915260008152610323565b815169d3c21bcecceda10000001415610372575081610323565b825169d3c21bcecceda1000000141561038c575080610323565b600069d3c21bcecceda10000006103a285610770565b51816103aa57fe5b04905060006103b8856107a5565b519050600069d3c21bcecceda10000006103d186610770565b51816103d957fe5b04905060006103e7866107a5565b519050838202841561043557828582816103fd57fe5b0414610435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610ba3565b69d3c21bcecceda1000000810281156104945769d3c21bcecceda100000082828161045c57fe5b0414610494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610c13565b90508084840285156104e257848682816104aa57fe5b04146104e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610c23565b868402871561052d57848882816104f557fe5b041461052d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610bf3565b6105356107df565b878161053d57fe5b0496506105486107df565b858161055057fe5b049450868502871561059e578588828161056657fe5b041461059e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610bc3565b6105a661087f565b60405180602001604052808781525090506105cf81604051806020016040528087815250610614565b90506105e981604051806020016040528086815250610614565b905061060381604051806020016040528085815250610614565b9d9c50505050505050505050505050565b61061c61087f565b815183519081019081101561065d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610c03565b60408051602081019091529081529392505050565b5190565b60006106b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506107e8565b9392505050565b6000826106ce57506000610323565b828202828482816106db57fe5b04146106b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e90610be3565b60006106b883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610839565b7601357c299a88ea76a58924d52ce4f26a85af186c2b9e7490565b61077861087f565b604051806020016040528069d3c21bcecceda10000008085600001518161079b57fe5b0402905292915050565b6107ad61087f565b604051806020016040528069d3c21bcecceda1000000808560000151816107d057fe5b95519504029093039092525090565b64e8d4a5100090565b60008183610823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e9190610b92565b50600083858161082f57fe5b0495945050505050565b60008184841115610877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027e9190610b92565b505050900390565b6040518060200160405280600081525090565b803561032381610ca5565b600080600080608085870312156108b357600080fd5b60006108bf8787610892565b94505060206108d087828801610892565b93505060406108e187828801610892565b92505060606108f287828801610892565b91505092959194509250565b600061090982610672565b6109138185610c41565b9350610923818560208601610c4d565b61092c81610c7d565b9093019392505050565b6000610943601683610c41565b7f6f766572666c6f77207831793120646574656374656400000000000000000000815260200192915050565b600061097c601f83610c41565b7f737562737472616374696f6e20756e646572666c6f7720646574656374656400815260200192915050565b60006109b5601683610c41565b7f6f766572666c6f77207832793220646574656374656400000000000000000000815260200192915050565b60006109ee603683610c41565b7f63616e277420637265617465206669786964697479206e756d626572206c617281527f676572207468616e206d61784e65774669786564282900000000000000000000602082015260400192915050565b6000610a4d602183610c41565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f81527f7700000000000000000000000000000000000000000000000000000000000000602082015260400192915050565b6000610aac601683610c41565b7f6f766572666c6f77207831793220646574656374656400000000000000000000815260200192915050565b6000610ae5601583610c41565b7f616464206f766572666c6f772064657465637465640000000000000000000000815260200192915050565b6000610b1e601f83610c41565b7f6f766572666c6f772078317931202a2066697865643120646574656374656400815260200192915050565b6000610b57601683610c41565b7f6f766572666c6f77207832793120646574656374656400000000000000000000815260200192915050565b610b8c81610c4a565b82525050565b602080825281016106b881846108fe565b6020808252810161032381610936565b602080825281016103238161096f565b60208082528101610323816109a8565b60208082528101610323816109e1565b6020808252810161032381610a40565b6020808252810161032381610a9f565b6020808252810161032381610ad8565b6020808252810161032381610b11565b6020808252810161032381610b4a565b602081016103238284610b83565b90815260200190565b90565b60005b83811015610c68578181015183820152602001610c50565b83811115610c77576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b610cae81610c4a565b8114610cb957600080fd5b5056fea365627a7a72315820905176f3f305c63be53707514ef0fb8352a56e6f1356c53405418966d4311d9c6c6578706572696d656e74616cf564736f6c63430005110040