Address Details
contract
0xEDF3F7e01037e4583de2659C5e243621Ea2501A4
- Contract Name
- Exchange
- Creator
- 0xf3eb91–a79239 at 0xf96909–815573
- 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
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 13810081
This contract has been partially verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- Exchange
- Optimization enabled
- false
- Compiler version
- v0.5.13+commit.5b0b510c
- EVM Version
- istanbul
- Verified at
- 2021-10-22T08:27:29.684383Z
Contract source code
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./interfaces/IExchange.sol"; import "./interfaces/ISortedOracles.sol"; import "./interfaces/IReserve.sol"; import "./interfaces/IStableToken.sol"; import "../common/Initializable.sol"; import "../common/FixidityLib.sol"; import "../common/Freezable.sol"; import "../common/UsingRegistry.sol"; import "../common/interfaces/ICeloVersionedContract.sol"; import "../common/libraries/ReentrancyGuard.sol"; /** * @title Contract that allows to exchange StableToken for GoldToken and vice versa * using a Constant Product Market Maker Model */ contract Exchange is IExchange, ICeloVersionedContract, Initializable, Ownable, UsingRegistry, ReentrancyGuard, Freezable { using SafeMath for uint256; using FixidityLib for FixidityLib.Fraction; event Exchanged(address indexed exchanger, uint256 sellAmount, uint256 buyAmount, bool soldGold); event UpdateFrequencySet(uint256 updateFrequency); event MinimumReportsSet(uint256 minimumReports); event StableTokenSet(address indexed stable); event SpreadSet(uint256 spread); event ReserveFractionSet(uint256 reserveFraction); event BucketsUpdated(uint256 goldBucket, uint256 stableBucket); FixidityLib.Fraction public spread; // Fraction of the Reserve that is committed to the gold bucket when updating // buckets. FixidityLib.Fraction public reserveFraction; address public stable; // Size of the Uniswap gold bucket uint256 public goldBucket; // Size of the Uniswap stable token bucket uint256 public stableBucket; uint256 public lastBucketUpdate = 0; uint256 public updateFrequency; uint256 public minimumReports; modifier updateBucketsIfNecessary() { _updateBucketsIfNecessary(); _; } /** * @notice Returns the storage, major, minor, and patch version of the contract. * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { return (1, 1, 1, 0); } /** * @notice Sets initialized == true on implementation contracts * @param test Set to true to skip implementation initialization */ constructor(bool test) public Initializable(test) {} /** * @notice Used in place of the constructor to allow the contract to be upgradable via proxy. * @param registryAddress The address of the registry core smart contract. * @param stableToken Address of the stable token * @param _spread Spread charged on exchanges * @param _reserveFraction Fraction to commit to the gold bucket * @param _updateFrequency The time period that needs to elapse between bucket * updates * @param _minimumReports The minimum number of fresh reports that need to be * present in the oracle to update buckets * commit to the gold bucket */ function initialize( address registryAddress, address stableToken, uint256 _spread, uint256 _reserveFraction, uint256 _updateFrequency, uint256 _minimumReports ) external initializer { _transferOwnership(msg.sender); setRegistry(registryAddress); setStableToken(stableToken); setSpread(_spread); setReserveFraction(_reserveFraction); setUpdateFrequency(_updateFrequency); setMinimumReports(_minimumReports); _updateBucketsIfNecessary(); } /** * @notice Exchanges a specific amount of one token for an unspecified amount * (greater than a threshold) of another. * @param sellAmount The number of tokens to send to the exchange. * @param minBuyAmount The minimum number of tokens for the exchange to send in return. * @param sellGold True if the caller is sending CELO to the exchange, false otherwise. * @return The number of tokens sent by the exchange. * @dev The caller must first have approved `sellAmount` to the exchange. * @dev This function can be frozen via the Freezable interface. */ function sell(uint256 sellAmount, uint256 minBuyAmount, bool sellGold) public onlyWhenNotFrozen updateBucketsIfNecessary nonReentrant returns (uint256) { (uint256 buyTokenBucket, uint256 sellTokenBucket) = _getBuyAndSellBuckets(sellGold); uint256 buyAmount = _getBuyTokenAmount(buyTokenBucket, sellTokenBucket, sellAmount); require(buyAmount >= minBuyAmount, "Calculated buyAmount was less than specified minBuyAmount"); _exchange(sellAmount, buyAmount, sellGold); return buyAmount; } /** * @dev DEPRECATED - Use `buy` or `sell`. * @notice Exchanges a specific amount of one token for an unspecified amount * (greater than a threshold) of another. * @param sellAmount The number of tokens to send to the exchange. * @param minBuyAmount The minimum number of tokens for the exchange to send in return. * @param sellGold True if the caller is sending CELO to the exchange, false otherwise. * @return The number of tokens sent by the exchange. * @dev The caller must first have approved `sellAmount` to the exchange. * @dev This function can be frozen via the Freezable interface. */ function exchange(uint256 sellAmount, uint256 minBuyAmount, bool sellGold) external returns (uint256) { return sell(sellAmount, minBuyAmount, sellGold); } /** * @notice Exchanges an unspecified amount (up to a threshold) of one token for * a specific amount of another. * @param buyAmount The number of tokens for the exchange to send in return. * @param maxSellAmount The maximum number of tokens to send to the exchange. * @param buyGold True if the exchange is sending CELO to the caller, false otherwise. * @return The number of tokens sent to the exchange. * @dev The caller must first have approved `maxSellAmount` to the exchange. * @dev This function can be frozen via the Freezable interface. */ function buy(uint256 buyAmount, uint256 maxSellAmount, bool buyGold) external onlyWhenNotFrozen updateBucketsIfNecessary nonReentrant returns (uint256) { bool sellGold = !buyGold; (uint256 buyTokenBucket, uint256 sellTokenBucket) = _getBuyAndSellBuckets(sellGold); uint256 sellAmount = _getSellTokenAmount(buyTokenBucket, sellTokenBucket, buyAmount); require( sellAmount <= maxSellAmount, "Calculated sellAmount was greater than specified maxSellAmount" ); _exchange(sellAmount, buyAmount, sellGold); return sellAmount; } /** * @notice Exchanges a specific amount of one token for a specific amount of another. * @param sellAmount The number of tokens to send to the exchange. * @param buyAmount The number of tokens for the exchange to send in return. * @param sellGold True if the msg.sender is sending CELO to the exchange, false otherwise. */ function _exchange(uint256 sellAmount, uint256 buyAmount, bool sellGold) private { IReserve reserve = IReserve(registry.getAddressForOrDie(RESERVE_REGISTRY_ID)); if (sellGold) { goldBucket = goldBucket.add(sellAmount); stableBucket = stableBucket.sub(buyAmount); require( getGoldToken().transferFrom(msg.sender, address(reserve), sellAmount), "Transfer of sell token failed" ); require(IStableToken(stable).mint(msg.sender, buyAmount), "Mint of stable token failed"); } else { stableBucket = stableBucket.add(sellAmount); goldBucket = goldBucket.sub(buyAmount); require( IERC20(stable).transferFrom(msg.sender, address(this), sellAmount), "Transfer of sell token failed" ); IStableToken(stable).burn(sellAmount); require(reserve.transferExchangeGold(msg.sender, buyAmount), "Transfer of buyToken failed"); } emit Exchanged(msg.sender, sellAmount, buyAmount, sellGold); } /** * @notice Returns the amount of buy tokens a user would get for sellAmount of the sell token. * @param sellAmount The amount of sellToken the user is selling to the exchange. * @param sellGold `true` if gold is the sell token. * @return The corresponding buyToken amount. */ function getBuyTokenAmount(uint256 sellAmount, bool sellGold) external view returns (uint256) { (uint256 buyTokenBucket, uint256 sellTokenBucket) = getBuyAndSellBuckets(sellGold); return _getBuyTokenAmount(buyTokenBucket, sellTokenBucket, sellAmount); } /** * @notice Returns the amount of sell tokens a user would need to exchange to receive buyAmount of * buy tokens. * @param buyAmount The amount of buyToken the user would like to purchase. * @param sellGold `true` if gold is the sell token. * @return The corresponding sellToken amount. */ function getSellTokenAmount(uint256 buyAmount, bool sellGold) external view returns (uint256) { (uint256 buyTokenBucket, uint256 sellTokenBucket) = getBuyAndSellBuckets(sellGold); return _getSellTokenAmount(buyTokenBucket, sellTokenBucket, buyAmount); } /** * @notice Returns the buy token and sell token bucket sizes, in order. The ratio of * the two also represents the exchange rate between the two. * @param sellGold `true` if gold is the sell token. * @return (buyTokenBucket, sellTokenBucket) */ function getBuyAndSellBuckets(bool sellGold) public view returns (uint256, uint256) { uint256 currentGoldBucket = goldBucket; uint256 currentStableBucket = stableBucket; if (shouldUpdateBuckets()) { (currentGoldBucket, currentStableBucket) = getUpdatedBuckets(); } if (sellGold) { return (currentStableBucket, currentGoldBucket); } else { return (currentGoldBucket, currentStableBucket); } } /** * @notice Allows owner to set the update frequency * @param newUpdateFrequency The new update frequency */ function setUpdateFrequency(uint256 newUpdateFrequency) public onlyOwner { updateFrequency = newUpdateFrequency; emit UpdateFrequencySet(newUpdateFrequency); } /** * @notice Allows owner to set the minimum number of reports required * @param newMininumReports The new update minimum number of reports required */ function setMinimumReports(uint256 newMininumReports) public onlyOwner { minimumReports = newMininumReports; emit MinimumReportsSet(newMininumReports); } /** * @notice Allows owner to set the Stable Token address * @param newStableToken The new address for Stable Token */ function setStableToken(address newStableToken) public onlyOwner { stable = newStableToken; emit StableTokenSet(newStableToken); } /** * @notice Allows owner to set the spread * @param newSpread The new value for the spread */ function setSpread(uint256 newSpread) public onlyOwner { spread = FixidityLib.wrap(newSpread); emit SpreadSet(newSpread); } /** * @notice Allows owner to set the Reserve Fraction * @param newReserveFraction The new value for the reserve fraction */ function setReserveFraction(uint256 newReserveFraction) public onlyOwner { reserveFraction = FixidityLib.wrap(newReserveFraction); require(reserveFraction.lt(FixidityLib.fixed1()), "reserve fraction must be smaller than 1"); emit ReserveFractionSet(newReserveFraction); } /** * @notice Returns the buy token and sell token bucket sizes, in order. The ratio of * the two also represents the exchange rate between the two. * @param sellGold `true` if gold is the sell token. * @return (buyTokenBucket, sellTokenBucket) */ function _getBuyAndSellBuckets(bool sellGold) private view returns (uint256, uint256) { if (sellGold) { return (stableBucket, goldBucket); } else { return (goldBucket, stableBucket); } } /** * @dev Returns the amount of buy tokens a user would get for sellAmount of the sell. * @param buyTokenBucket The buy token bucket size. * @param sellTokenBucket The sell token bucket size. * @param sellAmount The amount the user is selling to the exchange. * @return The corresponding buy amount. */ function _getBuyTokenAmount(uint256 buyTokenBucket, uint256 sellTokenBucket, uint256 sellAmount) private view returns (uint256) { if (sellAmount == 0) return 0; FixidityLib.Fraction memory reducedSellAmount = getReducedSellAmount(sellAmount); FixidityLib.Fraction memory numerator = reducedSellAmount.multiply( FixidityLib.newFixed(buyTokenBucket) ); FixidityLib.Fraction memory denominator = FixidityLib.newFixed(sellTokenBucket).add( reducedSellAmount ); // Can't use FixidityLib.divide because denominator 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 Returns the amount of sell tokens a user would need to exchange to receive buyAmount of * buy tokens. * @param buyTokenBucket The buy token bucket size. * @param sellTokenBucket The sell token bucket size. * @param buyAmount The amount the user is buying from the exchange. * @return The corresponding sell amount. */ function _getSellTokenAmount(uint256 buyTokenBucket, uint256 sellTokenBucket, uint256 buyAmount) private view returns (uint256) { if (buyAmount == 0) return 0; FixidityLib.Fraction memory numerator = FixidityLib.newFixed(buyAmount.mul(sellTokenBucket)); FixidityLib.Fraction memory denominator = FixidityLib .newFixed(buyTokenBucket.sub(buyAmount)) .multiply(FixidityLib.fixed1().subtract(spread)); // See comment in _getBuyTokenAmount return numerator.unwrap().div(denominator.unwrap()); } function getUpdatedBuckets() private view returns (uint256, uint256) { uint256 updatedGoldBucket = getUpdatedGoldBucket(); uint256 exchangeRateNumerator; uint256 exchangeRateDenominator; (exchangeRateNumerator, exchangeRateDenominator) = getOracleExchangeRate(); uint256 updatedStableBucket = exchangeRateNumerator.mul(updatedGoldBucket).div( exchangeRateDenominator ); return (updatedGoldBucket, updatedStableBucket); } function getUpdatedGoldBucket() private view returns (uint256) { uint256 reserveGoldBalance = getReserve().getUnfrozenReserveGoldBalance(); return reserveFraction.multiply(FixidityLib.newFixed(reserveGoldBalance)).fromFixed(); } /** * @notice If conditions are met, updates the Uniswap bucket sizes to track * the price reported by the Oracle. */ function _updateBucketsIfNecessary() private { if (shouldUpdateBuckets()) { // solhint-disable-next-line not-rely-on-time lastBucketUpdate = now; (goldBucket, stableBucket) = getUpdatedBuckets(); emit BucketsUpdated(goldBucket, stableBucket); } } /** * @notice Calculates the sell amount reduced by the spread. * @param sellAmount The original sell amount. * @return The reduced sell amount, computed as (1 - spread) * sellAmount */ function getReducedSellAmount(uint256 sellAmount) private view returns (FixidityLib.Fraction memory) { return FixidityLib.fixed1().subtract(spread).multiply(FixidityLib.newFixed(sellAmount)); } /* * @notice Checks conditions required for bucket updates. * @return Whether or not buckets should be updated. */ function shouldUpdateBuckets() private view returns (bool) { ISortedOracles sortedOracles = ISortedOracles( registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID) ); (bool isReportExpired, ) = sortedOracles.isOldestReportExpired(stable); // solhint-disable-next-line not-rely-on-time bool timePassed = now >= lastBucketUpdate.add(updateFrequency); bool enoughReports = sortedOracles.numRates(stable) >= minimumReports; // solhint-disable-next-line not-rely-on-time bool medianReportRecent = sortedOracles.medianTimestamp(stable) > now.sub(updateFrequency); return timePassed && enoughReports && medianReportRecent && !isReportExpired; } function getOracleExchangeRate() private view returns (uint256, uint256) { uint256 rateNumerator; uint256 rateDenominator; (rateNumerator, rateDenominator) = ISortedOracles( registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID) ) .medianRate(stable); require(rateDenominator > 0, "exchange rate denominator must be greater than 0"); return (rateNumerator, rateDenominator); } }
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 */ 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 // solium-disable-next-line 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"); 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()); } }
Freezable.sol
pragma solidity ^0.5.13; import "./UsingRegistry.sol"; contract Freezable is UsingRegistry { // onlyWhenNotFrozen functions can only be called when `frozen` is false, otherwise they will // revert. modifier onlyWhenNotFrozen() { require(!getFreezer().isFrozen(address(this)), "can't call when contract is frozen"); _; } }
Initializable.sol
pragma solidity ^0.5.13; contract Initializable { bool public initialized; constructor(bool testingDeployment) public { if (!testingDeployment) { initialized = true; } } modifier initializer() { require(!initialized, "contract already initialized"); initialized = true; _; } }
UsingRegistry.sol
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IAccounts.sol"; import "./interfaces/IFeeCurrencyWhitelist.sol"; import "./interfaces/IFreezer.sol"; import "./interfaces/IRegistry.sol"; import "../governance/interfaces/IElection.sol"; import "../governance/interfaces/IGovernance.sol"; import "../governance/interfaces/ILockedGold.sol"; import "../governance/interfaces/IValidators.sol"; import "../identity/interfaces/IRandom.sol"; import "../identity/interfaces/IAttestations.sol"; import "../stability/interfaces/IExchange.sol"; import "../stability/interfaces/IReserve.sol"; import "../stability/interfaces/ISortedOracles.sol"; import "../stability/interfaces/IStableToken.sol"; contract UsingRegistry is Ownable { event RegistrySet(address indexed registryAddress); // solhint-disable state-visibility bytes32 constant ACCOUNTS_REGISTRY_ID = keccak256(abi.encodePacked("Accounts")); bytes32 constant ATTESTATIONS_REGISTRY_ID = keccak256(abi.encodePacked("Attestations")); bytes32 constant DOWNTIME_SLASHER_REGISTRY_ID = keccak256(abi.encodePacked("DowntimeSlasher")); bytes32 constant DOUBLE_SIGNING_SLASHER_REGISTRY_ID = keccak256( abi.encodePacked("DoubleSigningSlasher") ); bytes32 constant ELECTION_REGISTRY_ID = keccak256(abi.encodePacked("Election")); bytes32 constant EXCHANGE_REGISTRY_ID = keccak256(abi.encodePacked("Exchange")); bytes32 constant FEE_CURRENCY_WHITELIST_REGISTRY_ID = keccak256( abi.encodePacked("FeeCurrencyWhitelist") ); bytes32 constant FREEZER_REGISTRY_ID = keccak256(abi.encodePacked("Freezer")); bytes32 constant GOLD_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("GoldToken")); bytes32 constant GOVERNANCE_REGISTRY_ID = keccak256(abi.encodePacked("Governance")); bytes32 constant GOVERNANCE_SLASHER_REGISTRY_ID = keccak256( abi.encodePacked("GovernanceSlasher") ); bytes32 constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold")); bytes32 constant RESERVE_REGISTRY_ID = keccak256(abi.encodePacked("Reserve")); bytes32 constant RANDOM_REGISTRY_ID = keccak256(abi.encodePacked("Random")); bytes32 constant SORTED_ORACLES_REGISTRY_ID = keccak256(abi.encodePacked("SortedOracles")); bytes32 constant STABLE_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("StableToken")); bytes32 constant VALIDATORS_REGISTRY_ID = keccak256(abi.encodePacked("Validators")); // solhint-enable state-visibility IRegistry public registry; modifier onlyRegisteredContract(bytes32 identifierHash) { require(registry.getAddressForOrDie(identifierHash) == msg.sender, "only registered contract"); _; } modifier onlyRegisteredContracts(bytes32[] memory identifierHashes) { require(registry.isOneOf(identifierHashes, msg.sender), "only registered contracts"); _; } /** * @notice Updates the address pointing to a Registry contract. * @param registryAddress The address of a registry contract for routing to other contracts. */ function setRegistry(address registryAddress) public onlyOwner { require(registryAddress != address(0), "Cannot register the null address"); registry = IRegistry(registryAddress); emit RegistrySet(registryAddress); } function getAccounts() internal view returns (IAccounts) { return IAccounts(registry.getAddressForOrDie(ACCOUNTS_REGISTRY_ID)); } function getAttestations() internal view returns (IAttestations) { return IAttestations(registry.getAddressForOrDie(ATTESTATIONS_REGISTRY_ID)); } function getElection() internal view returns (IElection) { return IElection(registry.getAddressForOrDie(ELECTION_REGISTRY_ID)); } function getExchange() internal view returns (IExchange) { return IExchange(registry.getAddressForOrDie(EXCHANGE_REGISTRY_ID)); } function getFeeCurrencyWhitelistRegistry() internal view returns (IFeeCurrencyWhitelist) { return IFeeCurrencyWhitelist(registry.getAddressForOrDie(FEE_CURRENCY_WHITELIST_REGISTRY_ID)); } function getFreezer() internal view returns (IFreezer) { return IFreezer(registry.getAddressForOrDie(FREEZER_REGISTRY_ID)); } function getGoldToken() internal view returns (IERC20) { return IERC20(registry.getAddressForOrDie(GOLD_TOKEN_REGISTRY_ID)); } function getGovernance() internal view returns (IGovernance) { return IGovernance(registry.getAddressForOrDie(GOVERNANCE_REGISTRY_ID)); } function getLockedGold() internal view returns (ILockedGold) { return ILockedGold(registry.getAddressForOrDie(LOCKED_GOLD_REGISTRY_ID)); } function getRandom() internal view returns (IRandom) { return IRandom(registry.getAddressForOrDie(RANDOM_REGISTRY_ID)); } function getReserve() internal view returns (IReserve) { return IReserve(registry.getAddressForOrDie(RESERVE_REGISTRY_ID)); } function getSortedOracles() internal view returns (ISortedOracles) { return ISortedOracles(registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID)); } function getStableToken() internal view returns (IStableToken) { return IStableToken(registry.getAddressForOrDie(STABLE_TOKEN_REGISTRY_ID)); } function getValidators() internal view returns (IValidators) { return IValidators(registry.getAddressForOrDie(VALIDATORS_REGISTRY_ID)); } }
IAccounts.sol
pragma solidity ^0.5.13; interface IAccounts { function isAccount(address) external view returns (bool); function voteSignerToAccount(address) external view returns (address); function validatorSignerToAccount(address) external view returns (address); function attestationSignerToAccount(address) external view returns (address); function signerToAccount(address) external view returns (address); function getAttestationSigner(address) external view returns (address); function getValidatorSigner(address) external view returns (address); function getVoteSigner(address) external view returns (address); function hasAuthorizedVoteSigner(address) external view returns (bool); function hasAuthorizedValidatorSigner(address) external view returns (bool); function hasAuthorizedAttestationSigner(address) external view returns (bool); function setAccountDataEncryptionKey(bytes calldata) external; function setMetadataURL(string calldata) external; function setName(string calldata) external; function setWalletAddress(address, uint8, bytes32, bytes32) external; function setAccount(string calldata, bytes calldata, address, uint8, bytes32, bytes32) external; function getDataEncryptionKey(address) external view returns (bytes memory); function getWalletAddress(address) external view returns (address); function getMetadataURL(address) external view returns (string memory); function batchGetMetadataURL(address[] calldata) external view returns (uint256[] memory, bytes memory); function getName(address) external view returns (string memory); function authorizeVoteSigner(address, uint8, bytes32, bytes32) external; function authorizeValidatorSigner(address, uint8, bytes32, bytes32) external; function authorizeValidatorSignerWithPublicKey(address, uint8, bytes32, bytes32, bytes calldata) external; function authorizeValidatorSignerWithKeys( address, uint8, bytes32, bytes32, bytes calldata, bytes calldata, bytes calldata ) external; function authorizeAttestationSigner(address, uint8, bytes32, bytes32) external; function createAccount() external returns (bool); }
ICeloVersionedContract.sol
pragma solidity ^0.5.13; interface ICeloVersionedContract { /** * @notice Returns the storage, major, minor, and patch version of the contract. * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256); }
IFeeCurrencyWhitelist.sol
pragma solidity ^0.5.13; interface IFeeCurrencyWhitelist { function addToken(address) external; function getWhitelist() external view returns (address[] memory); }
IFreezer.sol
pragma solidity ^0.5.13; interface IFreezer { function isFrozen(address) external view returns (bool); }
IRegistry.sol
pragma solidity ^0.5.13; interface IRegistry { function setAddressFor(string calldata, address) external; function getAddressForOrDie(bytes32) external view returns (address); function getAddressFor(bytes32) external view returns (address); function getAddressForStringOrDie(string calldata identifier) external view returns (address); function getAddressForString(string calldata identifier) external view returns (address); function isOneOf(bytes32[] calldata, address) external view returns (bool); }
ReentrancyGuard.sol
pragma solidity ^0.5.13; /** * @title Helps contracts guard against reentrancy attacks. * @author Remco Bloemen <remco@2π.com>, Eenae <alexey@mixbytes.io> * @dev If you mark a function `nonReentrant`, you should also * mark it `external`. */ contract ReentrancyGuard { /// @dev counter to allow mutex lock with only one SSTORE operation uint256 private _guardCounter; constructor() internal { // The counter starts at one to prevent changing it from zero to a non-zero // value, which is a more expensive operation. _guardCounter = 1; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { _guardCounter += 1; uint256 localCounter = _guardCounter; _; require(localCounter == _guardCounter, "reentrant call"); } }
IElection.sol
pragma solidity ^0.5.13; interface IElection { function electValidatorSigners() external view returns (address[] memory); function electNValidatorSigners(uint256, uint256) external view returns (address[] memory); function vote(address, uint256, address, address) external returns (bool); function activate(address) external returns (bool); function revokeActive(address, uint256, address, address, uint256) external returns (bool); function revokeAllActive(address, address, address, uint256) external returns (bool); function revokePending(address, uint256, address, address, uint256) external returns (bool); function markGroupIneligible(address) external; function markGroupEligible(address, address, address) external; function forceDecrementVotes( address, uint256, address[] calldata, address[] calldata, uint256[] calldata ) external returns (uint256); // view functions function getElectableValidators() external view returns (uint256, uint256); function getElectabilityThreshold() external view returns (uint256); function getNumVotesReceivable(address) external view returns (uint256); function getTotalVotes() external view returns (uint256); function getActiveVotes() external view returns (uint256); function getTotalVotesByAccount(address) external view returns (uint256); function getPendingVotesForGroupByAccount(address, address) external view returns (uint256); function getActiveVotesForGroupByAccount(address, address) external view returns (uint256); function getTotalVotesForGroupByAccount(address, address) external view returns (uint256); function getActiveVoteUnitsForGroupByAccount(address, address) external view returns (uint256); function getTotalVotesForGroup(address) external view returns (uint256); function getActiveVotesForGroup(address) external view returns (uint256); function getPendingVotesForGroup(address) external view returns (uint256); function getGroupEligibility(address) external view returns (bool); function getGroupEpochRewards(address, uint256, uint256[] calldata) external view returns (uint256); function getGroupsVotedForByAccount(address) external view returns (address[] memory); function getEligibleValidatorGroups() external view returns (address[] memory); function getTotalVotesForEligibleValidatorGroups() external view returns (address[] memory, uint256[] memory); function getCurrentValidatorSigners() external view returns (address[] memory); function canReceiveVotes(address, uint256) external view returns (bool); function hasActivatablePendingVotes(address, address) external view returns (bool); // only owner function setElectableValidators(uint256, uint256) external returns (bool); function setMaxNumGroupsVotedFor(uint256) external returns (bool); function setElectabilityThreshold(uint256) external returns (bool); // only VM function distributeEpochRewards(address, uint256, address, address) external; }
IGovernance.sol
pragma solidity ^0.5.13; interface IGovernance { function isVoting(address) external view returns (bool); }
ILockedGold.sol
pragma solidity ^0.5.13; interface ILockedGold { function incrementNonvotingAccountBalance(address, uint256) external; function decrementNonvotingAccountBalance(address, uint256) external; function getAccountTotalLockedGold(address) external view returns (uint256); function getTotalLockedGold() external view returns (uint256); function getPendingWithdrawals(address) external view returns (uint256[] memory, uint256[] memory); function getTotalPendingWithdrawals(address) external view returns (uint256); function lock() external payable; function unlock(uint256) external; function relock(uint256, uint256) external; function withdraw(uint256) external; function slash( address account, uint256 penalty, address reporter, uint256 reward, address[] calldata lessers, address[] calldata greaters, uint256[] calldata indices ) external; function isSlasher(address) external view returns (bool); }
IValidators.sol
pragma solidity ^0.5.13; interface IValidators { function registerValidator(bytes calldata, bytes calldata, bytes calldata) external returns (bool); function deregisterValidator(uint256) external returns (bool); function affiliate(address) external returns (bool); function deaffiliate() external returns (bool); function updateBlsPublicKey(bytes calldata, bytes calldata) external returns (bool); function registerValidatorGroup(uint256) external returns (bool); function deregisterValidatorGroup(uint256) external returns (bool); function addMember(address) external returns (bool); function addFirstMember(address, address, address) external returns (bool); function removeMember(address) external returns (bool); function reorderMember(address, address, address) external returns (bool); function updateCommission() external; function setNextCommissionUpdate(uint256) external; function resetSlashingMultiplier() external; // only owner function setCommissionUpdateDelay(uint256) external; function setMaxGroupSize(uint256) external returns (bool); function setMembershipHistoryLength(uint256) external returns (bool); function setValidatorScoreParameters(uint256, uint256) external returns (bool); function setGroupLockedGoldRequirements(uint256, uint256) external returns (bool); function setValidatorLockedGoldRequirements(uint256, uint256) external returns (bool); function setSlashingMultiplierResetPeriod(uint256) external; // view functions function getMaxGroupSize() external view returns (uint256); function getCommissionUpdateDelay() external view returns (uint256); function getValidatorScoreParameters() external view returns (uint256, uint256); function getMembershipHistory(address) external view returns (uint256[] memory, address[] memory, uint256, uint256); function calculateEpochScore(uint256) external view returns (uint256); function calculateGroupEpochScore(uint256[] calldata) external view returns (uint256); function getAccountLockedGoldRequirement(address) external view returns (uint256); function meetsAccountLockedGoldRequirements(address) external view returns (bool); function getValidatorBlsPublicKeyFromSigner(address) external view returns (bytes memory); function getValidator(address account) external view returns (bytes memory, bytes memory, address, uint256, address); function getValidatorGroup(address) external view returns (address[] memory, uint256, uint256, uint256, uint256[] memory, uint256, uint256); function getGroupNumMembers(address) external view returns (uint256); function getTopGroupValidators(address, uint256) external view returns (address[] memory); function getGroupsNumMembers(address[] calldata accounts) external view returns (uint256[] memory); function getNumRegisteredValidators() external view returns (uint256); function groupMembershipInEpoch(address, uint256, uint256) external view returns (address); // only registered contract function updateEcdsaPublicKey(address, address, bytes calldata) external returns (bool); function updatePublicKeys(address, address, bytes calldata, bytes calldata, bytes calldata) external returns (bool); function getValidatorLockedGoldRequirements() external view returns (uint256, uint256); function getGroupLockedGoldRequirements() external view returns (uint256, uint256); function getRegisteredValidators() external view returns (address[] memory); function getRegisteredValidatorSigners() external view returns (address[] memory); function getRegisteredValidatorGroups() external view returns (address[] memory); function isValidatorGroup(address) external view returns (bool); function isValidator(address) external view returns (bool); function getValidatorGroupSlashingMultiplier(address) external view returns (uint256); function getMembershipInLastEpoch(address) external view returns (address); function getMembershipInLastEpochFromSigner(address) external view returns (address); // only VM function updateValidatorScoreFromSigner(address, uint256) external; function distributeEpochPaymentsFromSigner(address, uint256) external returns (uint256); // only slasher function forceDeaffiliateIfValidator(address) external; function halveSlashingMultiplier(address) external; }
IAttestations.sol
pragma solidity ^0.5.13; interface IAttestations { function request(bytes32, uint256, address) external; function selectIssuers(bytes32) external; function complete(bytes32, uint8, bytes32, bytes32) external; function revoke(bytes32, uint256) external; function withdraw(address) external; function approveTransfer(bytes32, uint256, address, address, bool) external; // view functions function getUnselectedRequest(bytes32, address) external view returns (uint32, uint32, address); function getAttestationIssuers(bytes32, address) external view returns (address[] memory); function getAttestationStats(bytes32, address) external view returns (uint32, uint32); function batchGetAttestationStats(bytes32[] calldata) external view returns (uint256[] memory, address[] memory, uint64[] memory, uint64[] memory); function getAttestationState(bytes32, address, address) external view returns (uint8, uint32, address); function getCompletableAttestations(bytes32, address) external view returns (uint32[] memory, address[] memory, uint256[] memory, bytes memory); function getAttestationRequestFee(address) external view returns (uint256); function getMaxAttestations() external view returns (uint256); function validateAttestationCode(bytes32, address, uint8, bytes32, bytes32) external view returns (address); function lookupAccountsForIdentifier(bytes32) external view returns (address[] memory); function requireNAttestationsRequested(bytes32, address, uint32) external view; // only owner function setAttestationRequestFee(address, uint256) external; function setAttestationExpiryBlocks(uint256) external; function setSelectIssuersWaitBlocks(uint256) external; function setMaxAttestations(uint256) external; }
IRandom.sol
pragma solidity ^0.5.13; interface IRandom { function revealAndCommit(bytes32, bytes32, address) external; function randomnessBlockRetentionWindow() external view returns (uint256); function random() external view returns (bytes32); function getBlockRandomness(uint256) external view returns (bytes32); }
IExchange.sol
pragma solidity ^0.5.13; interface IExchange { function buy(uint256, uint256, bool) external returns (uint256); function sell(uint256, uint256, bool) external returns (uint256); function exchange(uint256, uint256, bool) external returns (uint256); function setUpdateFrequency(uint256) external; function getBuyTokenAmount(uint256, bool) external view returns (uint256); function getSellTokenAmount(uint256, bool) external view returns (uint256); function getBuyAndSellBuckets(bool) external view returns (uint256, uint256); }
IReserve.sol
pragma solidity ^0.5.13; interface IReserve { function setTobinTaxStalenessThreshold(uint256) external; function addToken(address) external returns (bool); function removeToken(address, uint256) external returns (bool); function transferGold(address payable, uint256) external returns (bool); function transferExchangeGold(address payable, uint256) external returns (bool); function getReserveGoldBalance() external view returns (uint256); function getUnfrozenReserveGoldBalance() external view returns (uint256); function getOrComputeTobinTax() external returns (uint256, uint256); function getTokens() external view returns (address[] memory); function getReserveRatio() external view returns (uint256); function addExchangeSpender(address) external; function removeExchangeSpender(address, uint256) external; function addSpender(address) external; function removeSpender(address) external; }
ISortedOracles.sol
pragma solidity ^0.5.13; interface ISortedOracles { function addOracle(address, address) external; function removeOracle(address, address, uint256) external; function report(address, uint256, address, address) external; function removeExpiredReports(address, uint256) external; function isOldestReportExpired(address token) external view returns (bool, address); function numRates(address) external view returns (uint256); function medianRate(address) external view returns (uint256, uint256); function numTimestamps(address) external view returns (uint256); function medianTimestamp(address) external view returns (uint256); }
IStableToken.sol
pragma solidity ^0.5.13; /** * @title This interface describes the functions specific to Celo Stable Tokens, and in the * absence of interface inheritance is intended as a companion to IERC20.sol and ICeloToken.sol. */ interface IStableToken { function mint(address, uint256) external returns (bool); function burn(uint256) external returns (bool); function setInflationParameters(uint256, uint256) external; function valueToUnits(uint256) external view returns (uint256); function unitsToValue(uint256) external view returns (uint256); function getInflationParameters() external view returns (uint256, uint256, uint256, uint256); // NOTE: duplicated with IERC20.sol, remove once interface inheritance is supported. function balanceOf(address) external view returns (uint256); }
Context.sol
pragma solidity ^0.5.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. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
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; } }
Ownable.sol
pragma solidity ^0.5.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. * * 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 () internal { 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(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _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 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 onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
IERC20.sol
pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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); }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"BucketsUpdated","inputs":[{"type":"uint256","name":"goldBucket","internalType":"uint256","indexed":false},{"type":"uint256","name":"stableBucket","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Exchanged","inputs":[{"type":"address","name":"exchanger","internalType":"address","indexed":true},{"type":"uint256","name":"sellAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"buyAmount","internalType":"uint256","indexed":false},{"type":"bool","name":"soldGold","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"MinimumReportsSet","inputs":[{"type":"uint256","name":"minimumReports","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RegistrySet","inputs":[{"type":"address","name":"registryAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveFractionSet","inputs":[{"type":"uint256","name":"reserveFraction","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SpreadSet","inputs":[{"type":"uint256","name":"spread","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"StableTokenSet","inputs":[{"type":"address","name":"stable","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"UpdateFrequencySet","inputs":[{"type":"uint256","name":"updateFrequency","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"buy","inputs":[{"type":"uint256","name":"buyAmount","internalType":"uint256"},{"type":"uint256","name":"maxSellAmount","internalType":"uint256"},{"type":"bool","name":"buyGold","internalType":"bool"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"exchange","inputs":[{"type":"uint256","name":"sellAmount","internalType":"uint256"},{"type":"uint256","name":"minBuyAmount","internalType":"uint256"},{"type":"bool","name":"sellGold","internalType":"bool"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBuyAndSellBuckets","inputs":[{"type":"bool","name":"sellGold","internalType":"bool"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBuyTokenAmount","inputs":[{"type":"uint256","name":"sellAmount","internalType":"uint256"},{"type":"bool","name":"sellGold","internalType":"bool"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getSellTokenAmount","inputs":[{"type":"uint256","name":"buyAmount","internalType":"uint256"},{"type":"bool","name":"sellGold","internalType":"bool"}],"constant":true},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersionNumber","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"goldBucket","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"initialize","inputs":[{"type":"address","name":"registryAddress","internalType":"address"},{"type":"address","name":"stableToken","internalType":"address"},{"type":"uint256","name":"_spread","internalType":"uint256"},{"type":"uint256","name":"_reserveFraction","internalType":"uint256"},{"type":"uint256","name":"_updateFrequency","internalType":"uint256"},{"type":"uint256","name":"_minimumReports","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"initialized","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastBucketUpdate","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minimumReports","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registry","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"name":"reserveFraction","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"sell","inputs":[{"type":"uint256","name":"sellAmount","internalType":"uint256"},{"type":"uint256","name":"minBuyAmount","internalType":"uint256"},{"type":"bool","name":"sellGold","internalType":"bool"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setMinimumReports","inputs":[{"type":"uint256","name":"newMininumReports","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setRegistry","inputs":[{"type":"address","name":"registryAddress","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setReserveFraction","inputs":[{"type":"uint256","name":"newReserveFraction","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setSpread","inputs":[{"type":"uint256","name":"newSpread","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setStableToken","inputs":[{"type":"address","name":"newStableToken","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setUpdateFrequency","inputs":[{"type":"uint256","name":"newUpdateFrequency","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"name":"spread","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"stable","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"stableBucket","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"updateFrequency","inputs":[],"constant":true}]
Contract Creation Code
0x6080604052600060085560006100196100c560201b60201c565b905080600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35060016002819055506100cd565b600033905090565b6139af80620000dd6000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80637b103999116100f9578063b66a261c11610097578063db1bc87b11610071578063db1bc87b14610735578063dda57b9314610779578063e0c8b50a14610797578063f2fde38b146107b5576101c4565b8063b66a261c14610681578063c3434883146106af578063d404f7f814610707576101c4565b80638da5cb5b116100d35780638da5cb5b146105835780638f32d59b146105cd5780639ed02b58146105ef578063a91ee0dc1461063d576101c4565b80637b1039991461045557806386489ba91461049f5780638ab1a5d41461052b576101c4565b806354255be011610166578063673ea08611610140578063673ea086146103b45780636a5eaf47146103d2578063715018a61461040057806378ba9cfd1461040a576101c4565b806354255be0146103455780635c25c76c1461037857806362f0908414610396576101c4565b806325ac2de6116101a257806325ac2de6146102535780632bc7d67a146102715780634a1be6cb146102c95780634c0226a2146102f7576101c4565b8063158ef93e146101c957806322503ce5146101eb57806322be3de114610209575b600080fd5b6101d16107f9565b604051808215151515815260200191505060405180910390f35b6101f361080b565b6040518082815260200191505060405180910390f35b610211610811565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61025b610837565b6040518082815260200191505060405180910390f35b6102b36004803603606081101561028757600080fd5b81019080803590602001909291908035906020019092919080351515906020019092919050505061083d565b6040518082815260200191505060405180910390f35b6102f5600480360360208110156102df57600080fd5b8101908080359060200190929190505050610853565b005b61032f6004803603604081101561030d57600080fd5b810190808035906020019092919080351515906020019092919050505061090e565b6040518082815260200191505060405180910390f35b61034d610935565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b61038061095c565b6040518082815260200191505060405180910390f35b61039e610968565b6040518082815260200191505060405180910390f35b6103bc61096e565b6040518082815260200191505060405180910390f35b6103fe600480360360208110156103e857600080fd5b8101908080359060200190929190505050610974565b005b610408610ac5565b005b6104386004803603602081101561042057600080fd5b81019080803515159060200190929190505050610bff565b604051808381526020018281526020019250505060405180910390f35b61045d610c4f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610529600480360360c08110156104b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610c75565b005b61056d6004803603606081101561054157600080fd5b810190808035906020019092919080359060200190929190803515159060200190929190505050610d60565b6040518082815260200191505060405180910390f35b61058b610f9f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105d5610fc8565b604051808215151515815260200191505060405180910390f35b6106276004803603604081101561060557600080fd5b8101908080359060200190929190803515159060200190929190505050611026565b6040518082815260200191505060405180910390f35b61067f6004803603602081101561065357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061104d565b005b6106ad6004803603602081101561069757600080fd5b81019080803590602001909291905050506111f1565b005b6106f1600480360360608110156106c557600080fd5b8101908080359060200190929190803590602001909291908035151590602001909291905050506112bd565b6040518082815260200191505060405180910390f35b6107336004803603602081101561071d57600080fd5b8101908080359060200190929190505050611503565b005b6107776004803603602081101561074b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115be565b005b6107816116bf565b6040518082815260200191505060405180910390f35b61079f6116cb565b6040518082815260200191505060405180910390f35b6107f7600480360360208110156107cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116d1565b005b6000809054906101000a900460ff1681565b600a5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b600061084a848484610d60565b90509392505050565b61085b610fc8565b6108cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b806009819055507f90c0a4a142fbfbc2ae8c21f50729a2f4bc56e85a66c1a1b6654f1e85092a54a6816040518082815260200191505060405180910390a150565b600080600061091c84610bff565b9150915061092b828287611757565b9250505092915050565b60008060008060018060016000839350829250819150809050935093509350935090919293565b60038060000154905081565b60065481565b60095481565b61097c610fc8565b6109ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6109f781611824565b600460008201518160000155905050610a36610a11611842565b600460405180602001604052908160008201548152505061186890919063ffffffff16565b610a8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806139546027913960400191505060405180910390fd5b7fb690f84efb1d9039c2834effb7bebc792a85bfec7ef84f4b269528454f363ccf816040518082815260200191505060405180910390a150565b610acd610fc8565b610b3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000806000600654905060006007549050610c1861187d565b15610c2e57610c25611c7a565b80925081935050505b8415610c41578082935093505050610c4a565b81819350935050505b915091565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900460ff1615610cf7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b60016000806101000a81548160ff021916908315150217905550610d1a33611cd3565b610d238661104d565b610d2c856115be565b610d35846111f1565b610d3e83610974565b610d4782610853565b610d5081611503565b610d58611e19565b505050505050565b6000610d6a611e8f565b73ffffffffffffffffffffffffffffffffffffffff1663e5839836306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610de657600080fd5b505afa158015610dfa573d6000803e3d6000fd5b505050506040513d6020811015610e1057600080fd5b810190808051906020019092919050505015610e77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061386d6022913960400191505060405180910390fd5b610e7f611e19565b600160026000828254019250508190555060006002549050600080610ea385611f8a565b915091506000610eb483838a611fb2565b905086811015610f0f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806138346039913960400191505060405180910390fd5b610f1a888288612052565b8094505050506002548114610f97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b509392505050565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661100a61285e565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b600080600061103484610bff565b91509150611043828287611fb2565b9250505092915050565b611055610fc8565b6110c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561116a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f7420726567697374657220746865206e756c6c206164647265737381525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b60405160405180910390a250565b6111f9610fc8565b61126b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61127481611824565b6003600082015181600001559050507f8946f328efcc515b5cc3282f6cd95e87a6c0d3508421af0b52d4d3620b3e2db3816040518082815260200191505060405180910390a150565b60006112c7611e8f565b73ffffffffffffffffffffffffffffffffffffffff1663e5839836306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561134357600080fd5b505afa158015611357573d6000803e3d6000fd5b505050506040513d602081101561136d57600080fd5b8101908080519060200190929190505050156113d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061386d6022913960400191505060405180910390fd5b6113dc611e19565b60016002600082825401925050819055506000600254905060008315905060008061140683611f8a565b91509150600061141783838b611757565b905087811115611472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603e8152602001806138c5603e913960400191505060405180910390fd5b61147d818a86612052565b8095505050505060025481146114fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b509392505050565b61150b610fc8565b61157d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600a819055507f08523596abc266fb46d9c40ddf78fdfd3c08142252833ddce1a2b46f76521035816040518082815260200191505060405180910390a150565b6115c6610fc8565b611638576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f119a23392e161a0bc5f9d5f3e2a6040c45b40d43a36973e10ea1de916f3d8a8a60405160405180910390a250565b60048060000154905081565b60085481565b6116d9610fc8565b61174b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61175481611cd3565b50565b60008082141561176a576000905061181d565b6117726137fa565b61178d611788858561286690919063ffffffff16565b6128ec565b90506117976137fa565b6117f36117ca60036040518060200160405290816000820154815250506117bc611842565b61297690919063ffffffff16565b6117e56117e0878a612a1d90919063ffffffff16565b6128ec565b612a6790919063ffffffff16565b905061181861180182612ec6565b61180a84612ec6565b612ed490919063ffffffff16565b925050505b9392505050565b61182c6137fa565b6040518060200160405280838152509050919050565b61184a6137fa565b604051806020016040528069d3c21bcecceda1000000815250905090565b60008160000151836000015110905092915050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561193957600080fd5b505afa15801561194d573d6000803e3d6000fd5b505050506040513d602081101561196357600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff1663ffe736bf600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b158015611a1657600080fd5b505afa158015611a2a573d6000803e3d6000fd5b505050506040513d6040811015611a4057600080fd5b8101908080519060200190929190805190602001909291905050505090506000611a77600954600854612f1e90919063ffffffff16565b42101590506000600a548473ffffffffffffffffffffffffffffffffffffffff1663bbc66a94600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611b2057600080fd5b505afa158015611b34573d6000803e3d6000fd5b505050506040513d6020811015611b4a57600080fd5b8101908080519060200190929190505050101590506000611b7660095442612a1d90919063ffffffff16565b8573ffffffffffffffffffffffffffffffffffffffff1663071b48fc600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611c1557600080fd5b505afa158015611c29573d6000803e3d6000fd5b505050506040513d6020811015611c3f57600080fd5b8101908080519060200190929190505050119050828015611c5d5750815b8015611c665750805b8015611c70575083155b9550505050505090565b6000806000611c87612fa6565b9050600080611c94613072565b80925081935050506000611cc382611cb5868661286690919063ffffffff16565b612ed490919063ffffffff16565b9050838195509550505050509091565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d59576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061380e6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611e2161187d565b15611e8d5742600881905550611e35611c7a565b60066000600760008491905055839190505550507fa18ec663cb684011386aa866c4dacb32d2d2ad859a35d3440b6ce7200a76bad8600654600754604051808381526020018281526020019250505060405180910390a15b565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f467265657a6572000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611f4a57600080fd5b505afa158015611f5e573d6000803e3d6000fd5b505050506040513d6020811015611f7457600080fd5b8101908080519060200190929190505050905090565b6000808215611fa25760075460065491509150611fad565b600654600754915091505b915091565b600080821415611fc5576000905061204b565b611fcd6137fa565b611fd6836132bb565b9050611fe06137fa565b611ffb611fec876128ec565b83612a6790919063ffffffff16565b90506120056137fa565b61202083612012886128ec565b61331490919063ffffffff16565b905061204561202e82612ec6565b61203784612ec6565b612ed490919063ffffffff16565b93505050505b9392505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f52657365727665000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561210d57600080fd5b505afa158015612121573d6000803e3d6000fd5b505050506040513d602081101561213757600080fd5b8101908080519060200190929190505050905081156124505761216584600654612f1e90919063ffffffff16565b60068190555061218083600754612a1d90919063ffffffff16565b60078190555061218e6133bd565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd3383876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561224857600080fd5b505af115801561225c573d6000803e3d6000fd5b505050506040513d602081101561227257600080fd5b81019080805190602001909291905050506122f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5472616e73666572206f662073656c6c20746f6b656e206661696c656400000081525060200191505060405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1933856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561239e57600080fd5b505af11580156123b2573d6000803e3d6000fd5b505050506040513d60208110156123c857600080fd5b810190808051906020019092919050505061244b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4d696e74206f6620737461626c6520746f6b656e206661696c6564000000000081525060200191505060405180910390fd5b6127f6565b61246584600754612f1e90919063ffffffff16565b60078190555061248083600654612a1d90919063ffffffff16565b600681905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561256357600080fd5b505af1158015612577573d6000803e3d6000fd5b505050506040513d602081101561258d57600080fd5b8101908080519060200190929190505050612610576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5472616e73666572206f662073656c6c20746f6b656e206661696c656400000081525060200191505060405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c68856040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561268557600080fd5b505af1158015612699573d6000803e3d6000fd5b505050506040513d60208110156126af57600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff166303a0fea333856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561274857600080fd5b505af115801561275c573d6000803e3d6000fd5b505050506040513d602081101561277257600080fd5b81019080805190602001909291905050506127f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f5472616e73666572206f6620627579546f6b656e206661696c6564000000000081525060200191505060405180910390fd5b5b3373ffffffffffffffffffffffffffffffffffffffff167f402ac9185b4616422c2794bf5b118bfcc68ed496d52c0d9841dfa114fdeb05ba8585856040518084815260200183815260200182151515158152602001935050505060405180910390a250505050565b600033905090565b60008083141561287957600090506128e6565b600082840290508284828161288a57fe5b04146128e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806139336021913960400191505060405180910390fd5b809150505b92915050565b6128f46137fa565b6128fc6134b8565b821115612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061388f6036913960400191505060405180910390fd5b604051806020016040528069d3c21bcecceda100000084028152509050919050565b61297e6137fa565b8160000151836000015110156129fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f737562737472616374696f6e20756e646572666c6f772064657465637465640081525060200191505060405180910390fd5b60405180602001604052808360000151856000015103815250905092915050565b6000612a5f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506134d7565b905092915050565b612a6f6137fa565b600083600001511480612a86575060008260000151145b15612aa257604051806020016040528060008152509050612ec0565b69d3c21bcecceda100000082600001511415612ac057829050612ec0565b69d3c21bcecceda100000083600001511415612ade57819050612ec0565b600069d3c21bcecceda1000000612af485613597565b6000015181612aff57fe5b0490506000612b0d856135ce565b600001519050600069d3c21bcecceda1000000612b2986613597565b6000015181612b3457fe5b0490506000612b42866135ce565b6000015190506000828502905060008514612bd65782858281612b6157fe5b0414612bd5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600069d3c21bcecceda10000008202905060008214612c785769d3c21bcecceda1000000828281612c0357fe5b0414612c77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f766572666c6f772078317931202a206669786564312064657465637465640081525060200191505060405180910390fd5b5b8091506000848602905060008614612d095784868281612c9457fe5b0414612d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b6000848802905060008814612d975784888281612d2257fe5b0414612d96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b612d9f61360b565b8781612da757fe5b049650612db261360b565b8581612dba57fe5b0494506000858802905060008814612e4b5785888281612dd657fe5b0414612e4a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b612e536137fa565b6040518060200160405280878152509050612e7c81604051806020016040528087815250613314565b9050612e9681604051806020016040528086815250613314565b9050612eb081604051806020016040528085815250613314565b9050809a50505050505050505050505b92915050565b600081600001519050919050565b6000612f1683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613618565b905092915050565b600080828401905083811015612f9c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080612fb16136de565b73ffffffffffffffffffffffffffffffffffffffff16638b7df8d46040518163ffffffff1660e01b815260040160206040518083038186803b158015612ff657600080fd5b505afa15801561300a573d6000803e3d6000fd5b505050506040513d602081101561302057600080fd5b8101908080519060200190929190505050905061306c613067613042836128ec565b6004604051806020016040529081600082015481525050612a6790919063ffffffff16565b6137d9565b91505090565b600080600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561313157600080fd5b505afa158015613145573d6000803e3d6000fd5b505050506040513d602081101561315b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663ef90e1b0600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b15801561320957600080fd5b505afa15801561321d573d6000803e3d6000fd5b505050506040513d604081101561323357600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050600081116132af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806139036030913960400191505060405180910390fd5b81819350935050509091565b6132c36137fa565b61330d6132cf836128ec565b6132ff60036040518060200160405290816000820154815250506132f1611842565b61297690919063ffffffff16565b612a6790919063ffffffff16565b9050919050565b61331c6137fa565b60008260000151846000015101905083600001518110156133a5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f616464206f766572666c6f77206465746563746564000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808281525091505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f476f6c64546f6b656e00000000000000000000000000000000000000000000008152506009019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561347857600080fd5b505afa15801561348c573d6000803e3d6000fd5b505050506040513d60208110156134a257600080fd5b8101908080519060200190929190505050905090565b60007601357c299a88ea76a58924d52ce4f26a85af186c2b9e74905090565b6000838311158290613584576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561354957808201518184015260208101905061352e565b50505050905090810190601f1680156135765780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b61359f6137fa565b604051806020016040528069d3c21bcecceda1000000808560000151816135c257fe5b04028152509050919050565b6135d66137fa565b604051806020016040528069d3c21bcecceda1000000808560000151816135f957fe5b04028460000151038152509050919050565b600064e8d4a51000905090565b600080831182906136c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561368957808201518184015260208101905061366e565b50505050905090810190601f1680156136b65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816136d057fe5b049050809150509392505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f52657365727665000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561379957600080fd5b505afa1580156137ad573d6000803e3d6000fd5b505050506040513d60208110156137c357600080fd5b8101908080519060200190929190505050905090565b600069d3c21bcecceda10000008260000151816137f257fe5b049050919050565b604051806020016040528060008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737343616c63756c6174656420627579416d6f756e7420776173206c657373207468616e20737065636966696564206d696e427579416d6f756e7463616e27742063616c6c207768656e20636f6e74726163742069732066726f7a656e63616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e65774669786564282943616c63756c617465642073656c6c416d6f756e74207761732067726561746572207468616e20737065636966696564206d617853656c6c416d6f756e7465786368616e676520726174652064656e6f6d696e61746f72206d7573742062652067726561746572207468616e2030536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7772657365727665206672616374696f6e206d75737420626520736d616c6c6572207468616e2031a265627a7a723158206a36a0755899772f035282a371c759f0dc856de9b5ccaa852de98c58a680605c64736f6c634300050d0032
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80637b103999116100f9578063b66a261c11610097578063db1bc87b11610071578063db1bc87b14610735578063dda57b9314610779578063e0c8b50a14610797578063f2fde38b146107b5576101c4565b8063b66a261c14610681578063c3434883146106af578063d404f7f814610707576101c4565b80638da5cb5b116100d35780638da5cb5b146105835780638f32d59b146105cd5780639ed02b58146105ef578063a91ee0dc1461063d576101c4565b80637b1039991461045557806386489ba91461049f5780638ab1a5d41461052b576101c4565b806354255be011610166578063673ea08611610140578063673ea086146103b45780636a5eaf47146103d2578063715018a61461040057806378ba9cfd1461040a576101c4565b806354255be0146103455780635c25c76c1461037857806362f0908414610396576101c4565b806325ac2de6116101a257806325ac2de6146102535780632bc7d67a146102715780634a1be6cb146102c95780634c0226a2146102f7576101c4565b8063158ef93e146101c957806322503ce5146101eb57806322be3de114610209575b600080fd5b6101d16107f9565b604051808215151515815260200191505060405180910390f35b6101f361080b565b6040518082815260200191505060405180910390f35b610211610811565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61025b610837565b6040518082815260200191505060405180910390f35b6102b36004803603606081101561028757600080fd5b81019080803590602001909291908035906020019092919080351515906020019092919050505061083d565b6040518082815260200191505060405180910390f35b6102f5600480360360208110156102df57600080fd5b8101908080359060200190929190505050610853565b005b61032f6004803603604081101561030d57600080fd5b810190808035906020019092919080351515906020019092919050505061090e565b6040518082815260200191505060405180910390f35b61034d610935565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b61038061095c565b6040518082815260200191505060405180910390f35b61039e610968565b6040518082815260200191505060405180910390f35b6103bc61096e565b6040518082815260200191505060405180910390f35b6103fe600480360360208110156103e857600080fd5b8101908080359060200190929190505050610974565b005b610408610ac5565b005b6104386004803603602081101561042057600080fd5b81019080803515159060200190929190505050610bff565b604051808381526020018281526020019250505060405180910390f35b61045d610c4f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610529600480360360c08110156104b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610c75565b005b61056d6004803603606081101561054157600080fd5b810190808035906020019092919080359060200190929190803515159060200190929190505050610d60565b6040518082815260200191505060405180910390f35b61058b610f9f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105d5610fc8565b604051808215151515815260200191505060405180910390f35b6106276004803603604081101561060557600080fd5b8101908080359060200190929190803515159060200190929190505050611026565b6040518082815260200191505060405180910390f35b61067f6004803603602081101561065357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061104d565b005b6106ad6004803603602081101561069757600080fd5b81019080803590602001909291905050506111f1565b005b6106f1600480360360608110156106c557600080fd5b8101908080359060200190929190803590602001909291908035151590602001909291905050506112bd565b6040518082815260200191505060405180910390f35b6107336004803603602081101561071d57600080fd5b8101908080359060200190929190505050611503565b005b6107776004803603602081101561074b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115be565b005b6107816116bf565b6040518082815260200191505060405180910390f35b61079f6116cb565b6040518082815260200191505060405180910390f35b6107f7600480360360208110156107cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116d1565b005b6000809054906101000a900460ff1681565b600a5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b600061084a848484610d60565b90509392505050565b61085b610fc8565b6108cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b806009819055507f90c0a4a142fbfbc2ae8c21f50729a2f4bc56e85a66c1a1b6654f1e85092a54a6816040518082815260200191505060405180910390a150565b600080600061091c84610bff565b9150915061092b828287611757565b9250505092915050565b60008060008060018060016000839350829250819150809050935093509350935090919293565b60038060000154905081565b60065481565b60095481565b61097c610fc8565b6109ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6109f781611824565b600460008201518160000155905050610a36610a11611842565b600460405180602001604052908160008201548152505061186890919063ffffffff16565b610a8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806139546027913960400191505060405180910390fd5b7fb690f84efb1d9039c2834effb7bebc792a85bfec7ef84f4b269528454f363ccf816040518082815260200191505060405180910390a150565b610acd610fc8565b610b3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000806000600654905060006007549050610c1861187d565b15610c2e57610c25611c7a565b80925081935050505b8415610c41578082935093505050610c4a565b81819350935050505b915091565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900460ff1615610cf7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b60016000806101000a81548160ff021916908315150217905550610d1a33611cd3565b610d238661104d565b610d2c856115be565b610d35846111f1565b610d3e83610974565b610d4782610853565b610d5081611503565b610d58611e19565b505050505050565b6000610d6a611e8f565b73ffffffffffffffffffffffffffffffffffffffff1663e5839836306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610de657600080fd5b505afa158015610dfa573d6000803e3d6000fd5b505050506040513d6020811015610e1057600080fd5b810190808051906020019092919050505015610e77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061386d6022913960400191505060405180910390fd5b610e7f611e19565b600160026000828254019250508190555060006002549050600080610ea385611f8a565b915091506000610eb483838a611fb2565b905086811015610f0f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806138346039913960400191505060405180910390fd5b610f1a888288612052565b8094505050506002548114610f97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b509392505050565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661100a61285e565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b600080600061103484610bff565b91509150611043828287611fb2565b9250505092915050565b611055610fc8565b6110c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561116a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f7420726567697374657220746865206e756c6c206164647265737381525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b60405160405180910390a250565b6111f9610fc8565b61126b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61127481611824565b6003600082015181600001559050507f8946f328efcc515b5cc3282f6cd95e87a6c0d3508421af0b52d4d3620b3e2db3816040518082815260200191505060405180910390a150565b60006112c7611e8f565b73ffffffffffffffffffffffffffffffffffffffff1663e5839836306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561134357600080fd5b505afa158015611357573d6000803e3d6000fd5b505050506040513d602081101561136d57600080fd5b8101908080519060200190929190505050156113d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061386d6022913960400191505060405180910390fd5b6113dc611e19565b60016002600082825401925050819055506000600254905060008315905060008061140683611f8a565b91509150600061141783838b611757565b905087811115611472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603e8152602001806138c5603e913960400191505060405180910390fd5b61147d818a86612052565b8095505050505060025481146114fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b509392505050565b61150b610fc8565b61157d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600a819055507f08523596abc266fb46d9c40ddf78fdfd3c08142252833ddce1a2b46f76521035816040518082815260200191505060405180910390a150565b6115c6610fc8565b611638576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f119a23392e161a0bc5f9d5f3e2a6040c45b40d43a36973e10ea1de916f3d8a8a60405160405180910390a250565b60048060000154905081565b60085481565b6116d9610fc8565b61174b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61175481611cd3565b50565b60008082141561176a576000905061181d565b6117726137fa565b61178d611788858561286690919063ffffffff16565b6128ec565b90506117976137fa565b6117f36117ca60036040518060200160405290816000820154815250506117bc611842565b61297690919063ffffffff16565b6117e56117e0878a612a1d90919063ffffffff16565b6128ec565b612a6790919063ffffffff16565b905061181861180182612ec6565b61180a84612ec6565b612ed490919063ffffffff16565b925050505b9392505050565b61182c6137fa565b6040518060200160405280838152509050919050565b61184a6137fa565b604051806020016040528069d3c21bcecceda1000000815250905090565b60008160000151836000015110905092915050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561193957600080fd5b505afa15801561194d573d6000803e3d6000fd5b505050506040513d602081101561196357600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff1663ffe736bf600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b158015611a1657600080fd5b505afa158015611a2a573d6000803e3d6000fd5b505050506040513d6040811015611a4057600080fd5b8101908080519060200190929190805190602001909291905050505090506000611a77600954600854612f1e90919063ffffffff16565b42101590506000600a548473ffffffffffffffffffffffffffffffffffffffff1663bbc66a94600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611b2057600080fd5b505afa158015611b34573d6000803e3d6000fd5b505050506040513d6020811015611b4a57600080fd5b8101908080519060200190929190505050101590506000611b7660095442612a1d90919063ffffffff16565b8573ffffffffffffffffffffffffffffffffffffffff1663071b48fc600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611c1557600080fd5b505afa158015611c29573d6000803e3d6000fd5b505050506040513d6020811015611c3f57600080fd5b8101908080519060200190929190505050119050828015611c5d5750815b8015611c665750805b8015611c70575083155b9550505050505090565b6000806000611c87612fa6565b9050600080611c94613072565b80925081935050506000611cc382611cb5868661286690919063ffffffff16565b612ed490919063ffffffff16565b9050838195509550505050509091565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d59576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061380e6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611e2161187d565b15611e8d5742600881905550611e35611c7a565b60066000600760008491905055839190505550507fa18ec663cb684011386aa866c4dacb32d2d2ad859a35d3440b6ce7200a76bad8600654600754604051808381526020018281526020019250505060405180910390a15b565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f467265657a6572000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611f4a57600080fd5b505afa158015611f5e573d6000803e3d6000fd5b505050506040513d6020811015611f7457600080fd5b8101908080519060200190929190505050905090565b6000808215611fa25760075460065491509150611fad565b600654600754915091505b915091565b600080821415611fc5576000905061204b565b611fcd6137fa565b611fd6836132bb565b9050611fe06137fa565b611ffb611fec876128ec565b83612a6790919063ffffffff16565b90506120056137fa565b61202083612012886128ec565b61331490919063ffffffff16565b905061204561202e82612ec6565b61203784612ec6565b612ed490919063ffffffff16565b93505050505b9392505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f52657365727665000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561210d57600080fd5b505afa158015612121573d6000803e3d6000fd5b505050506040513d602081101561213757600080fd5b8101908080519060200190929190505050905081156124505761216584600654612f1e90919063ffffffff16565b60068190555061218083600754612a1d90919063ffffffff16565b60078190555061218e6133bd565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd3383876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561224857600080fd5b505af115801561225c573d6000803e3d6000fd5b505050506040513d602081101561227257600080fd5b81019080805190602001909291905050506122f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5472616e73666572206f662073656c6c20746f6b656e206661696c656400000081525060200191505060405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1933856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561239e57600080fd5b505af11580156123b2573d6000803e3d6000fd5b505050506040513d60208110156123c857600080fd5b810190808051906020019092919050505061244b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4d696e74206f6620737461626c6520746f6b656e206661696c6564000000000081525060200191505060405180910390fd5b6127f6565b61246584600754612f1e90919063ffffffff16565b60078190555061248083600654612a1d90919063ffffffff16565b600681905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561256357600080fd5b505af1158015612577573d6000803e3d6000fd5b505050506040513d602081101561258d57600080fd5b8101908080519060200190929190505050612610576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5472616e73666572206f662073656c6c20746f6b656e206661696c656400000081525060200191505060405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c68856040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561268557600080fd5b505af1158015612699573d6000803e3d6000fd5b505050506040513d60208110156126af57600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff166303a0fea333856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561274857600080fd5b505af115801561275c573d6000803e3d6000fd5b505050506040513d602081101561277257600080fd5b81019080805190602001909291905050506127f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f5472616e73666572206f6620627579546f6b656e206661696c6564000000000081525060200191505060405180910390fd5b5b3373ffffffffffffffffffffffffffffffffffffffff167f402ac9185b4616422c2794bf5b118bfcc68ed496d52c0d9841dfa114fdeb05ba8585856040518084815260200183815260200182151515158152602001935050505060405180910390a250505050565b600033905090565b60008083141561287957600090506128e6565b600082840290508284828161288a57fe5b04146128e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806139336021913960400191505060405180910390fd5b809150505b92915050565b6128f46137fa565b6128fc6134b8565b821115612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061388f6036913960400191505060405180910390fd5b604051806020016040528069d3c21bcecceda100000084028152509050919050565b61297e6137fa565b8160000151836000015110156129fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f737562737472616374696f6e20756e646572666c6f772064657465637465640081525060200191505060405180910390fd5b60405180602001604052808360000151856000015103815250905092915050565b6000612a5f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506134d7565b905092915050565b612a6f6137fa565b600083600001511480612a86575060008260000151145b15612aa257604051806020016040528060008152509050612ec0565b69d3c21bcecceda100000082600001511415612ac057829050612ec0565b69d3c21bcecceda100000083600001511415612ade57819050612ec0565b600069d3c21bcecceda1000000612af485613597565b6000015181612aff57fe5b0490506000612b0d856135ce565b600001519050600069d3c21bcecceda1000000612b2986613597565b6000015181612b3457fe5b0490506000612b42866135ce565b6000015190506000828502905060008514612bd65782858281612b6157fe5b0414612bd5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600069d3c21bcecceda10000008202905060008214612c785769d3c21bcecceda1000000828281612c0357fe5b0414612c77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f766572666c6f772078317931202a206669786564312064657465637465640081525060200191505060405180910390fd5b5b8091506000848602905060008614612d095784868281612c9457fe5b0414612d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b6000848802905060008814612d975784888281612d2257fe5b0414612d96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b612d9f61360b565b8781612da757fe5b049650612db261360b565b8581612dba57fe5b0494506000858802905060008814612e4b5785888281612dd657fe5b0414612e4a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b612e536137fa565b6040518060200160405280878152509050612e7c81604051806020016040528087815250613314565b9050612e9681604051806020016040528086815250613314565b9050612eb081604051806020016040528085815250613314565b9050809a50505050505050505050505b92915050565b600081600001519050919050565b6000612f1683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613618565b905092915050565b600080828401905083811015612f9c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080612fb16136de565b73ffffffffffffffffffffffffffffffffffffffff16638b7df8d46040518163ffffffff1660e01b815260040160206040518083038186803b158015612ff657600080fd5b505afa15801561300a573d6000803e3d6000fd5b505050506040513d602081101561302057600080fd5b8101908080519060200190929190505050905061306c613067613042836128ec565b6004604051806020016040529081600082015481525050612a6790919063ffffffff16565b6137d9565b91505090565b600080600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561313157600080fd5b505afa158015613145573d6000803e3d6000fd5b505050506040513d602081101561315b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663ef90e1b0600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b15801561320957600080fd5b505afa15801561321d573d6000803e3d6000fd5b505050506040513d604081101561323357600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050600081116132af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806139036030913960400191505060405180910390fd5b81819350935050509091565b6132c36137fa565b61330d6132cf836128ec565b6132ff60036040518060200160405290816000820154815250506132f1611842565b61297690919063ffffffff16565b612a6790919063ffffffff16565b9050919050565b61331c6137fa565b60008260000151846000015101905083600001518110156133a5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f616464206f766572666c6f77206465746563746564000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808281525091505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f476f6c64546f6b656e00000000000000000000000000000000000000000000008152506009019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561347857600080fd5b505afa15801561348c573d6000803e3d6000fd5b505050506040513d60208110156134a257600080fd5b8101908080519060200190929190505050905090565b60007601357c299a88ea76a58924d52ce4f26a85af186c2b9e74905090565b6000838311158290613584576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561354957808201518184015260208101905061352e565b50505050905090810190601f1680156135765780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b61359f6137fa565b604051806020016040528069d3c21bcecceda1000000808560000151816135c257fe5b04028152509050919050565b6135d66137fa565b604051806020016040528069d3c21bcecceda1000000808560000151816135f957fe5b04028460000151038152509050919050565b600064e8d4a51000905090565b600080831182906136c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561368957808201518184015260208101905061366e565b50505050905090810190601f1680156136b65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816136d057fe5b049050809150509392505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f52657365727665000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561379957600080fd5b505afa1580156137ad573d6000803e3d6000fd5b505050506040513d60208110156137c357600080fd5b8101908080519060200190929190505050905090565b600069d3c21bcecceda10000008260000151816137f257fe5b049050919050565b604051806020016040528060008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737343616c63756c6174656420627579416d6f756e7420776173206c657373207468616e20737065636966696564206d696e427579416d6f756e7463616e27742063616c6c207768656e20636f6e74726163742069732066726f7a656e63616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e65774669786564282943616c63756c617465642073656c6c416d6f756e74207761732067726561746572207468616e20737065636966696564206d617853656c6c416d6f756e7465786368616e676520726174652064656e6f6d696e61746f72206d7573742062652067726561746572207468616e2030536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7772657365727665206672616374696f6e206d75737420626520736d616c6c6572207468616e2031a265627a7a723158206a36a0755899772f035282a371c759f0dc856de9b5ccaa852de98c58a680605c64736f6c634300050d0032