Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 1 from a total of 1 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
Amount
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Add Synths | 10528207 | 581 days ago | IN | 0 ETH | 0.000255721373 |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Issuer
Compiler Version
v0.5.16+commit.9c3226ce
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at sepolia-optimism.etherscan.io on 2024-04-11
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: Issuer.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/Issuer.sol
* Docs: https://docs.synthetix.io/contracts/Issuer
*
* Contract Dependencies:
* - IAddressResolver
* - IIssuer
* - MixinResolver
* - MixinSystemSettings
* - Owned
* Libraries:
* - SafeCast
* - SafeDecimalMath
* - SafeMath
*
* MIT License
* ===========
*
* Copyright (c) 2024 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity ^0.5.16;
// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
// https://docs.synthetix.io/contracts/source/interfaces/iaddressresolver
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
function getSynth(bytes32 key) external view returns (address);
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address);
}
// https://docs.synthetix.io/contracts/source/interfaces/isynth
interface ISynth {
// Views
function currencyKey() external view returns (bytes32);
function transferableSynths(address account) external view returns (uint);
// Mutative functions
function transferAndSettle(address to, uint value) external returns (bool);
function transferFromAndSettle(
address from,
address to,
uint value
) external returns (bool);
// Restricted: used internally to Synthetix
function burn(address account, uint amount) external;
function issue(address account, uint amount) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/iissuer
interface IIssuer {
// Views
function allNetworksDebtInfo()
external
view
returns (
uint256 debt,
uint256 sharesSupply,
bool isStale
);
function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availableSynthCount() external view returns (uint);
function availableSynths(uint index) external view returns (ISynth);
function canBurnSynths(address account) external view returns (bool);
function collateral(address account) external view returns (uint);
function collateralisationRatio(address issuer) external view returns (uint);
function collateralisationRatioAndAnyRatesInvalid(address _issuer)
external
view
returns (uint cratio, bool anyRateIsInvalid);
function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance);
function issuanceRatio() external view returns (uint);
function lastIssueEvent(address account) external view returns (uint);
function maxIssuableSynths(address issuer) external view returns (uint maxIssuable);
function minimumStakeTime() external view returns (uint);
function remainingIssuableSynths(address issuer)
external
view
returns (
uint maxIssuable,
uint alreadyIssued,
uint totalSystemDebt
);
function synths(bytes32 currencyKey) external view returns (ISynth);
function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory);
function synthsByAddress(address synthAddress) external view returns (bytes32);
function totalIssuedSynths(bytes32 currencyKey, bool excludeOtherCollateral) external view returns (uint);
function transferableSynthetixAndAnyRateIsInvalid(address account, uint balance)
external
view
returns (uint transferable, bool anyRateIsInvalid);
function liquidationAmounts(address account, bool isSelfLiquidation)
external
view
returns (
uint totalRedeemed,
uint debtToRemove,
uint escrowToLiquidate,
uint initialDebtBalance
);
// Restricted: used internally to Synthetix
function addSynths(ISynth[] calldata synthsToAdd) external;
function issueSynths(address from, uint amount) external;
function issueSynthsOnBehalf(
address issueFor,
address from,
uint amount
) external;
function issueMaxSynths(address from) external;
function issueMaxSynthsOnBehalf(address issueFor, address from) external;
function burnSynths(address from, uint amount) external;
function burnSynthsOnBehalf(
address burnForAddress,
address from,
uint amount
) external;
function burnSynthsToTarget(address from) external;
function burnSynthsToTargetOnBehalf(address burnForAddress, address from) external;
function burnForRedemption(
address deprecatedSynthProxy,
address account,
uint balance
) external;
function setCurrentPeriodId(uint128 periodId) external;
function liquidateAccount(address account, bool isSelfLiquidation)
external
returns (
uint totalRedeemed,
uint debtRemoved,
uint escrowToLiquidate
);
function issueSynthsWithoutDebt(
bytes32 currencyKey,
address to,
uint amount
) external returns (bool rateInvalid);
function burnSynthsWithoutDebt(
bytes32 currencyKey,
address to,
uint amount
) external returns (bool rateInvalid);
function burnAndIssueSynthsWithoutDebtCache(
address account,
bytes32 currencyKey,
uint amountOfSynth,
uint amountInsUSD
) external;
function modifyDebtSharesForMigration(address account, uint amount) external;
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/addressresolver
contract AddressResolver is Owned, IAddressResolver {
mapping(bytes32 => address) public repository;
constructor(address _owner) public Owned(_owner) {}
/* ========== RESTRICTED FUNCTIONS ========== */
function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner {
require(names.length == destinations.length, "Input lengths must match");
for (uint i = 0; i < names.length; i++) {
bytes32 name = names[i];
address destination = destinations[i];
repository[name] = destination;
emit AddressImported(name, destination);
}
}
/* ========= PUBLIC FUNCTIONS ========== */
function rebuildCaches(MixinResolver[] calldata destinations) external {
for (uint i = 0; i < destinations.length; i++) {
destinations[i].rebuildCache();
}
}
/* ========== VIEWS ========== */
function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) {
for (uint i = 0; i < names.length; i++) {
if (repository[names[i]] != destinations[i]) {
return false;
}
}
return true;
}
function getAddress(bytes32 name) external view returns (address) {
return repository[name];
}
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) {
address _foundAddress = repository[name];
require(_foundAddress != address(0), reason);
return _foundAddress;
}
function getSynth(bytes32 key) external view returns (address) {
IIssuer issuer = IIssuer(repository["Issuer"]);
require(address(issuer) != address(0), "Cannot find Issuer address");
return address(issuer.synths(key));
}
/* ========== EVENTS ========== */
event AddressImported(bytes32 name, address destination);
}
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/mixinresolver
contract MixinResolver {
AddressResolver public resolver;
mapping(bytes32 => address) private addressCache;
constructor(address _resolver) internal {
resolver = AddressResolver(_resolver);
}
/* ========== INTERNAL FUNCTIONS ========== */
function combineArrays(bytes32[] memory first, bytes32[] memory second)
internal
pure
returns (bytes32[] memory combination)
{
combination = new bytes32[](first.length + second.length);
for (uint i = 0; i < first.length; i++) {
combination[i] = first[i];
}
for (uint j = 0; j < second.length; j++) {
combination[first.length + j] = second[j];
}
}
/* ========== PUBLIC FUNCTIONS ========== */
// Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {}
function rebuildCache() public {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
// The resolver must call this function whenver it updates its state
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
// Note: can only be invoked once the resolver has all the targets needed added
address destination =
resolver.requireAndGetAddress(name, string(abi.encodePacked("Resolver missing target: ", name)));
addressCache[name] = destination;
emit CacheUpdated(name, destination);
}
}
/* ========== VIEWS ========== */
function isResolverCached() external view returns (bool) {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
// false if our cache is invalid or if the resolver doesn't have the required address
if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) {
return false;
}
}
return true;
}
/* ========== INTERNAL FUNCTIONS ========== */
function requireAndGetAddress(bytes32 name) internal view returns (address) {
address _foundAddress = addressCache[name];
require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name)));
return _foundAddress;
}
/* ========== EVENTS ========== */
event CacheUpdated(bytes32 name, address destination);
}
// https://docs.synthetix.io/contracts/source/interfaces/iflexiblestorage
interface IFlexibleStorage {
// Views
function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint);
function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory);
function getIntValue(bytes32 contractName, bytes32 record) external view returns (int);
function getIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (int[] memory);
function getAddressValue(bytes32 contractName, bytes32 record) external view returns (address);
function getAddressValues(bytes32 contractName, bytes32[] calldata records) external view returns (address[] memory);
function getBoolValue(bytes32 contractName, bytes32 record) external view returns (bool);
function getBoolValues(bytes32 contractName, bytes32[] calldata records) external view returns (bool[] memory);
function getBytes32Value(bytes32 contractName, bytes32 record) external view returns (bytes32);
function getBytes32Values(bytes32 contractName, bytes32[] calldata records) external view returns (bytes32[] memory);
// Mutative functions
function deleteUIntValue(bytes32 contractName, bytes32 record) external;
function deleteIntValue(bytes32 contractName, bytes32 record) external;
function deleteAddressValue(bytes32 contractName, bytes32 record) external;
function deleteBoolValue(bytes32 contractName, bytes32 record) external;
function deleteBytes32Value(bytes32 contractName, bytes32 record) external;
function setUIntValue(
bytes32 contractName,
bytes32 record,
uint value
) external;
function setUIntValues(
bytes32 contractName,
bytes32[] calldata records,
uint[] calldata values
) external;
function setIntValue(
bytes32 contractName,
bytes32 record,
int value
) external;
function setIntValues(
bytes32 contractName,
bytes32[] calldata records,
int[] calldata values
) external;
function setAddressValue(
bytes32 contractName,
bytes32 record,
address value
) external;
function setAddressValues(
bytes32 contractName,
bytes32[] calldata records,
address[] calldata values
) external;
function setBoolValue(
bytes32 contractName,
bytes32 record,
bool value
) external;
function setBoolValues(
bytes32 contractName,
bytes32[] calldata records,
bool[] calldata values
) external;
function setBytes32Value(
bytes32 contractName,
bytes32 record,
bytes32 value
) external;
function setBytes32Values(
bytes32 contractName,
bytes32[] calldata records,
bytes32[] calldata values
) external;
}
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/mixinsystemsettings
contract MixinSystemSettings is MixinResolver {
// must match the one defined SystemSettingsLib, defined in both places due to sol v0.5 limitations
bytes32 internal constant SETTING_CONTRACT_NAME = "SystemSettings";
bytes32 internal constant SETTING_WAITING_PERIOD_SECS = "waitingPeriodSecs";
bytes32 internal constant SETTING_PRICE_DEVIATION_THRESHOLD_FACTOR = "priceDeviationThresholdFactor";
bytes32 internal constant SETTING_ISSUANCE_RATIO = "issuanceRatio";
bytes32 internal constant SETTING_FEE_PERIOD_DURATION = "feePeriodDuration";
bytes32 internal constant SETTING_TARGET_THRESHOLD = "targetThreshold";
bytes32 internal constant SETTING_LIQUIDATION_DELAY = "liquidationDelay";
bytes32 internal constant SETTING_LIQUIDATION_RATIO = "liquidationRatio";
bytes32 internal constant SETTING_LIQUIDATION_ESCROW_DURATION = "liquidationEscrowDuration";
bytes32 internal constant SETTING_LIQUIDATION_PENALTY = "liquidationPenalty";
bytes32 internal constant SETTING_SNX_LIQUIDATION_PENALTY = "snxLiquidationPenalty";
bytes32 internal constant SETTING_SELF_LIQUIDATION_PENALTY = "selfLiquidationPenalty";
bytes32 internal constant SETTING_FLAG_REWARD = "flagReward";
bytes32 internal constant SETTING_LIQUIDATE_REWARD = "liquidateReward";
bytes32 internal constant SETTING_RATE_STALE_PERIOD = "rateStalePeriod";
/* ========== Exchange Fees Related ========== */
bytes32 internal constant SETTING_EXCHANGE_FEE_RATE = "exchangeFeeRate";
bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD = "exchangeDynamicFeeThreshold";
bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY = "exchangeDynamicFeeWeightDecay";
bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS = "exchangeDynamicFeeRounds";
bytes32 internal constant SETTING_EXCHANGE_MAX_DYNAMIC_FEE = "exchangeMaxDynamicFee";
/* ========== End Exchange Fees Related ========== */
bytes32 internal constant SETTING_MINIMUM_STAKE_TIME = "minimumStakeTime";
bytes32 internal constant SETTING_AGGREGATOR_WARNING_FLAGS = "aggregatorWarningFlags";
bytes32 internal constant SETTING_TRADING_REWARDS_ENABLED = "tradingRewardsEnabled";
bytes32 internal constant SETTING_DEBT_SNAPSHOT_STALE_TIME = "debtSnapshotStaleTime";
bytes32 internal constant SETTING_CROSS_DOMAIN_DEPOSIT_GAS_LIMIT = "crossDomainDepositGasLimit";
bytes32 internal constant SETTING_CROSS_DOMAIN_ESCROW_GAS_LIMIT = "crossDomainEscrowGasLimit";
bytes32 internal constant SETTING_CROSS_DOMAIN_REWARD_GAS_LIMIT = "crossDomainRewardGasLimit";
bytes32 internal constant SETTING_CROSS_DOMAIN_WITHDRAWAL_GAS_LIMIT = "crossDomainWithdrawalGasLimit";
bytes32 internal constant SETTING_CROSS_DOMAIN_FEE_PERIOD_CLOSE_GAS_LIMIT = "crossDomainCloseGasLimit";
bytes32 internal constant SETTING_CROSS_DOMAIN_RELAY_GAS_LIMIT = "crossDomainRelayGasLimit";
bytes32 internal constant SETTING_ETHER_WRAPPER_MAX_ETH = "etherWrapperMaxETH";
bytes32 internal constant SETTING_ETHER_WRAPPER_MINT_FEE_RATE = "etherWrapperMintFeeRate";
bytes32 internal constant SETTING_ETHER_WRAPPER_BURN_FEE_RATE = "etherWrapperBurnFeeRate";
bytes32 internal constant SETTING_WRAPPER_MAX_TOKEN_AMOUNT = "wrapperMaxTokens";
bytes32 internal constant SETTING_WRAPPER_MINT_FEE_RATE = "wrapperMintFeeRate";
bytes32 internal constant SETTING_WRAPPER_BURN_FEE_RATE = "wrapperBurnFeeRate";
bytes32 internal constant SETTING_INTERACTION_DELAY = "interactionDelay";
bytes32 internal constant SETTING_COLLAPSE_FEE_RATE = "collapseFeeRate";
bytes32 internal constant SETTING_ATOMIC_MAX_VOLUME_PER_BLOCK = "atomicMaxVolumePerBlock";
bytes32 internal constant SETTING_ATOMIC_TWAP_WINDOW = "atomicTwapWindow";
bytes32 internal constant SETTING_ATOMIC_EQUIVALENT_FOR_DEX_PRICING = "atomicEquivalentForDexPricing";
bytes32 internal constant SETTING_ATOMIC_EXCHANGE_FEE_RATE = "atomicExchangeFeeRate";
bytes32 internal constant SETTING_ATOMIC_VOLATILITY_CONSIDERATION_WINDOW = "atomicVolConsiderationWindow";
bytes32 internal constant SETTING_ATOMIC_VOLATILITY_UPDATE_THRESHOLD = "atomicVolUpdateThreshold";
bytes32 internal constant SETTING_PURE_CHAINLINK_PRICE_FOR_ATOMIC_SWAPS_ENABLED = "pureChainlinkForAtomicsEnabled";
bytes32 internal constant SETTING_CROSS_SYNTH_TRANSFER_ENABLED = "crossChainSynthTransferEnabled";
bytes32 internal constant CONTRACT_FLEXIBLESTORAGE = "FlexibleStorage";
enum CrossDomainMessageGasLimits {Deposit, Escrow, Reward, Withdrawal, CloseFeePeriod, Relay}
struct DynamicFeeConfig {
uint threshold;
uint weightDecay;
uint rounds;
uint maxFee;
}
constructor(address _resolver) internal MixinResolver(_resolver) {}
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
addresses = new bytes32[](1);
addresses[0] = CONTRACT_FLEXIBLESTORAGE;
}
function flexibleStorage() internal view returns (IFlexibleStorage) {
return IFlexibleStorage(requireAndGetAddress(CONTRACT_FLEXIBLESTORAGE));
}
function _getGasLimitSetting(CrossDomainMessageGasLimits gasLimitType) internal pure returns (bytes32) {
if (gasLimitType == CrossDomainMessageGasLimits.Deposit) {
return SETTING_CROSS_DOMAIN_DEPOSIT_GAS_LIMIT;
} else if (gasLimitType == CrossDomainMessageGasLimits.Escrow) {
return SETTING_CROSS_DOMAIN_ESCROW_GAS_LIMIT;
} else if (gasLimitType == CrossDomainMessageGasLimits.Reward) {
return SETTING_CROSS_DOMAIN_REWARD_GAS_LIMIT;
} else if (gasLimitType == CrossDomainMessageGasLimits.Withdrawal) {
return SETTING_CROSS_DOMAIN_WITHDRAWAL_GAS_LIMIT;
} else if (gasLimitType == CrossDomainMessageGasLimits.Relay) {
return SETTING_CROSS_DOMAIN_RELAY_GAS_LIMIT;
} else if (gasLimitType == CrossDomainMessageGasLimits.CloseFeePeriod) {
return SETTING_CROSS_DOMAIN_FEE_PERIOD_CLOSE_GAS_LIMIT;
} else {
revert("Unknown gas limit type");
}
}
function getCrossDomainMessageGasLimit(CrossDomainMessageGasLimits gasLimitType) internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, _getGasLimitSetting(gasLimitType));
}
function getTradingRewardsEnabled() internal view returns (bool) {
return flexibleStorage().getBoolValue(SETTING_CONTRACT_NAME, SETTING_TRADING_REWARDS_ENABLED);
}
function getWaitingPeriodSecs() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_WAITING_PERIOD_SECS);
}
function getPriceDeviationThresholdFactor() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_PRICE_DEVIATION_THRESHOLD_FACTOR);
}
function getIssuanceRatio() internal view returns (uint) {
// lookup on flexible storage directly for gas savings (rather than via SystemSettings)
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ISSUANCE_RATIO);
}
function getFeePeriodDuration() internal view returns (uint) {
// lookup on flexible storage directly for gas savings (rather than via SystemSettings)
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_FEE_PERIOD_DURATION);
}
function getTargetThreshold() internal view returns (uint) {
// lookup on flexible storage directly for gas savings (rather than via SystemSettings)
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_TARGET_THRESHOLD);
}
function getLiquidationDelay() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_DELAY);
}
function getLiquidationRatio() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_RATIO);
}
function getLiquidationEscrowDuration() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_ESCROW_DURATION);
}
function getLiquidationPenalty() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_PENALTY);
}
function getSnxLiquidationPenalty() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_SNX_LIQUIDATION_PENALTY);
}
function getSelfLiquidationPenalty() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_SELF_LIQUIDATION_PENALTY);
}
function getFlagReward() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_FLAG_REWARD);
}
function getLiquidateReward() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATE_REWARD);
}
function getRateStalePeriod() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_RATE_STALE_PERIOD);
}
/* ========== Exchange Related Fees ========== */
function getExchangeFeeRate(bytes32 currencyKey) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_EXCHANGE_FEE_RATE, currencyKey))
);
}
/// @notice Get exchange dynamic fee related keys
/// @return threshold, weight decay, rounds, and max fee
function getExchangeDynamicFeeConfig() internal view returns (DynamicFeeConfig memory) {
bytes32[] memory keys = new bytes32[](4);
keys[0] = SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD;
keys[1] = SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY;
keys[2] = SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS;
keys[3] = SETTING_EXCHANGE_MAX_DYNAMIC_FEE;
uint[] memory values = flexibleStorage().getUIntValues(SETTING_CONTRACT_NAME, keys);
return DynamicFeeConfig({threshold: values[0], weightDecay: values[1], rounds: values[2], maxFee: values[3]});
}
/* ========== End Exchange Related Fees ========== */
function getMinimumStakeTime() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_MINIMUM_STAKE_TIME);
}
function getAggregatorWarningFlags() internal view returns (address) {
return flexibleStorage().getAddressValue(SETTING_CONTRACT_NAME, SETTING_AGGREGATOR_WARNING_FLAGS);
}
function getDebtSnapshotStaleTime() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_DEBT_SNAPSHOT_STALE_TIME);
}
function getEtherWrapperMaxETH() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ETHER_WRAPPER_MAX_ETH);
}
function getEtherWrapperMintFeeRate() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ETHER_WRAPPER_MINT_FEE_RATE);
}
function getEtherWrapperBurnFeeRate() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ETHER_WRAPPER_BURN_FEE_RATE);
}
function getWrapperMaxTokenAmount(address wrapper) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_WRAPPER_MAX_TOKEN_AMOUNT, wrapper))
);
}
function getWrapperMintFeeRate(address wrapper) internal view returns (int) {
return
flexibleStorage().getIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_WRAPPER_MINT_FEE_RATE, wrapper))
);
}
function getWrapperBurnFeeRate(address wrapper) internal view returns (int) {
return
flexibleStorage().getIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_WRAPPER_BURN_FEE_RATE, wrapper))
);
}
function getInteractionDelay(address collateral) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_INTERACTION_DELAY, collateral))
);
}
function getCollapseFeeRate(address collateral) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_COLLAPSE_FEE_RATE, collateral))
);
}
function getAtomicMaxVolumePerBlock() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ATOMIC_MAX_VOLUME_PER_BLOCK);
}
function getAtomicTwapWindow() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ATOMIC_TWAP_WINDOW);
}
function getAtomicEquivalentForDexPricing(bytes32 currencyKey) internal view returns (address) {
return
flexibleStorage().getAddressValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_ATOMIC_EQUIVALENT_FOR_DEX_PRICING, currencyKey))
);
}
function getAtomicExchangeFeeRate(bytes32 currencyKey) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_ATOMIC_EXCHANGE_FEE_RATE, currencyKey))
);
}
function getAtomicVolatilityConsiderationWindow(bytes32 currencyKey) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_ATOMIC_VOLATILITY_CONSIDERATION_WINDOW, currencyKey))
);
}
function getAtomicVolatilityUpdateThreshold(bytes32 currencyKey) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_ATOMIC_VOLATILITY_UPDATE_THRESHOLD, currencyKey))
);
}
function getPureChainlinkPriceForAtomicSwapsEnabled(bytes32 currencyKey) internal view returns (bool) {
return
flexibleStorage().getBoolValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_PURE_CHAINLINK_PRICE_FOR_ATOMIC_SWAPS_ENABLED, currencyKey))
);
}
function getCrossChainSynthTransferEnabled(bytes32 currencyKey) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_CROSS_SYNTH_TRANSFER_ENABLED, currencyKey))
);
}
function getExchangeMaxDynamicFee() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_EXCHANGE_MAX_DYNAMIC_FEE);
}
function getExchangeDynamicFeeRounds() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS);
}
function getExchangeDynamicFeeThreshold() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD);
}
function getExchangeDynamicFeeWeightDecay() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY);
}
}
// SPDX-License-Identifier: MIT
/**
* @dev Wrappers over Solidity's uintXX casting operators with added overflow
* checks.
*
* Downcasting from uint256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such 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.
*
* Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn't fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn't fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn't fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn't fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn't fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
require(value < 2**255, "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}
/**
* @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) {
require(b <= a, "SafeMath: subtraction overflow");
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-solidity/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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
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) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
// Libraries
// https://docs.synthetix.io/contracts/source/libraries/safedecimalmath
library SafeDecimalMath {
using SafeMath for uint;
/* Number of decimal places in the representations. */
uint8 public constant decimals = 18;
uint8 public constant highPrecisionDecimals = 27;
/* The number representing 1.0. */
uint public constant UNIT = 10**uint(decimals);
/* The number representing 1.0 for higher fidelity numbers. */
uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals);
uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals);
/**
* @return Provides an interface to UNIT.
*/
function unit() external pure returns (uint) {
return UNIT;
}
/**
* @return Provides an interface to PRECISE_UNIT.
*/
function preciseUnit() external pure returns (uint) {
return PRECISE_UNIT;
}
/**
* @return The result of multiplying x and y, interpreting the operands as fixed-point
* decimals.
*
* @dev A unit factor is divided out after the product of x and y is evaluated,
* so that product must be less than 2**256. As this is an integer division,
* the internal division always rounds down. This helps save on gas. Rounding
* is more expensive on gas.
*/
function multiplyDecimal(uint x, uint y) internal pure returns (uint) {
/* Divide by UNIT to remove the extra factor introduced by the product. */
return x.mul(y) / UNIT;
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of the specified precision unit.
*
* @dev The operands should be in the form of a the specified unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function _multiplyDecimalRound(
uint x,
uint y,
uint precisionUnit
) private pure returns (uint) {
/* Divide by UNIT to remove the extra factor introduced by the product. */
uint quotientTimesTen = x.mul(y) / (precisionUnit / 10);
if (quotientTimesTen % 10 >= 5) {
quotientTimesTen += 10;
}
return quotientTimesTen / 10;
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of a precise unit.
*
* @dev The operands should be in the precise unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, PRECISE_UNIT);
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of a standard unit.
*
* @dev The operands should be in the standard unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, UNIT);
}
/**
* @return The result of safely dividing x and y. The return value is a high
* precision decimal.
*
* @dev y is divided after the product of x and the standard precision unit
* is evaluated, so the product of x and UNIT must be less than 2**256. As
* this is an integer division, the result is always rounded down.
* This helps save on gas. Rounding is more expensive on gas.
*/
function divideDecimal(uint x, uint y) internal pure returns (uint) {
/* Reintroduce the UNIT factor that will be divided out by y. */
return x.mul(UNIT).div(y);
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* decimal in the precision unit specified in the parameter.
*
* @dev y is divided after the product of x and the specified precision unit
* is evaluated, so the product of x and the specified precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function _divideDecimalRound(
uint x,
uint y,
uint precisionUnit
) private pure returns (uint) {
uint resultTimesTen = x.mul(precisionUnit * 10).div(y);
if (resultTimesTen % 10 >= 5) {
resultTimesTen += 10;
}
return resultTimesTen / 10;
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* standard precision decimal.
*
* @dev y is divided after the product of x and the standard precision unit
* is evaluated, so the product of x and the standard precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function divideDecimalRound(uint x, uint y) internal pure returns (uint) {
return _divideDecimalRound(x, y, UNIT);
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* high precision decimal.
*
* @dev y is divided after the product of x and the high precision unit
* is evaluated, so the product of x and the high precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _divideDecimalRound(x, y, PRECISE_UNIT);
}
/**
* @dev Convert a standard decimal representation to a high precision one.
*/
function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
}
/**
* @dev Convert a high precision decimal to a standard decimal representation.
*/
function preciseDecimalToDecimal(uint i) internal pure returns (uint) {
uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);
if (quotientTimesTen % 10 >= 5) {
quotientTimesTen += 10;
}
return quotientTimesTen / 10;
}
// Computes `a - b`, setting the value to 0 if b > a.
function floorsub(uint a, uint b) internal pure returns (uint) {
return b >= a ? 0 : a - b;
}
/* ---------- Utilities ---------- */
/*
* Absolute value of the input, returned as a signed number.
*/
function signedAbs(int x) internal pure returns (int) {
return x < 0 ? -x : x;
}
/*
* Absolute value of the input, returned as an unsigned number.
*/
function abs(int x) internal pure returns (uint) {
return uint(signedAbs(x));
}
}
// https://docs.synthetix.io/contracts/source/interfaces/isynthetixdebtshare
interface ISynthetixDebtShare {
// Views
function currentPeriodId() external view returns (uint128);
function allowance(address account, address spender) external view returns (uint);
function balanceOf(address account) external view returns (uint);
function balanceOfOnPeriod(address account, uint periodId) external view returns (uint);
function totalSupply() external view returns (uint);
function sharePercent(address account) external view returns (uint);
function sharePercentOnPeriod(address account, uint periodId) external view returns (uint);
// Mutative functions
function takeSnapshot(uint128 id) external;
function mintShare(address account, uint256 amount) external;
function burnShare(address account, uint256 amount) external;
function approve(address, uint256) external pure returns (bool);
function transfer(address to, uint256 amount) external pure returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
function addAuthorizedBroker(address target) external;
function removeAuthorizedBroker(address target) external;
function addAuthorizedToSnapshot(address target) external;
function removeAuthorizedToSnapshot(address target) external;
}
interface IVirtualSynth {
// Views
function balanceOfUnderlying(address account) external view returns (uint);
function rate() external view returns (uint);
function readyToSettle() external view returns (bool);
function secsLeftInWaitingPeriod() external view returns (uint);
function settled() external view returns (bool);
function synth() external view returns (ISynth);
// Mutative functions
function settle(address account) external;
}
pragma experimental ABIEncoderV2;
// https://docs.synthetix.io/contracts/source/interfaces/iexchanger
interface IExchanger {
struct ExchangeEntrySettlement {
bytes32 src;
uint amount;
bytes32 dest;
uint reclaim;
uint rebate;
uint srcRoundIdAtPeriodEnd;
uint destRoundIdAtPeriodEnd;
uint timestamp;
}
struct ExchangeEntry {
uint sourceRate;
uint destinationRate;
uint destinationAmount;
uint exchangeFeeRate;
uint exchangeDynamicFeeRate;
uint roundIdForSrc;
uint roundIdForDest;
uint sourceAmountAfterSettlement;
}
// Views
function calculateAmountAfterSettlement(
address from,
bytes32 currencyKey,
uint amount,
uint refunded
) external view returns (uint amountAfterSettlement);
function isSynthRateInvalid(bytes32 currencyKey) external view returns (bool);
function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) external view returns (uint);
function settlementOwing(address account, bytes32 currencyKey)
external
view
returns (
uint reclaimAmount,
uint rebateAmount,
uint numEntries
);
function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool);
function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view returns (uint);
function dynamicFeeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
external
view
returns (uint feeRate, bool tooVolatile);
function getAmountsForExchange(
uint sourceAmount,
bytes32 sourceCurrencyKey,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint amountReceived,
uint fee,
uint exchangeFeeRate
);
function priceDeviationThresholdFactor() external view returns (uint);
function waitingPeriodSecs() external view returns (uint);
function lastExchangeRate(bytes32 currencyKey) external view returns (uint);
// Mutative functions
function exchange(
address exchangeForAddress,
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
bool virtualSynth,
address rewardAddress,
bytes32 trackingCode
) external returns (uint amountReceived, IVirtualSynth vSynth);
function exchangeAtomically(
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
bytes32 trackingCode,
uint minAmount
) external returns (uint amountReceived);
function settle(address from, bytes32 currencyKey)
external
returns (
uint reclaimed,
uint refunded,
uint numEntries
);
}
// Used to have strongly-typed access to internal mutative functions in Synthetix
interface ISynthetixInternal {
function emitExchangeTracking(
bytes32 trackingCode,
bytes32 toCurrencyKey,
uint256 toAmount,
uint256 fee
) external;
function emitSynthExchange(
address account,
bytes32 fromCurrencyKey,
uint fromAmount,
bytes32 toCurrencyKey,
uint toAmount,
address toAddress
) external;
function emitAtomicSynthExchange(
address account,
bytes32 fromCurrencyKey,
uint fromAmount,
bytes32 toCurrencyKey,
uint toAmount,
address toAddress
) external;
function emitExchangeReclaim(
address account,
bytes32 currencyKey,
uint amount
) external;
function emitExchangeRebate(
address account,
bytes32 currencyKey,
uint amount
) external;
}
interface IExchangerInternalDebtCache {
function updateCachedSynthDebtsWithRates(bytes32[] calldata currencyKeys, uint[] calldata currencyRates) external;
function updateCachedSynthDebts(bytes32[] calldata currencyKeys) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/idelegateapprovals
interface IDelegateApprovals {
// Views
function canBurnFor(address authoriser, address delegate) external view returns (bool);
function canIssueFor(address authoriser, address delegate) external view returns (bool);
function canClaimFor(address authoriser, address delegate) external view returns (bool);
function canExchangeFor(address authoriser, address delegate) external view returns (bool);
// Mutative
function approveAllDelegatePowers(address delegate) external;
function removeAllDelegatePowers(address delegate) external;
function approveBurnOnBehalf(address delegate) external;
function removeBurnOnBehalf(address delegate) external;
function approveIssueOnBehalf(address delegate) external;
function removeIssueOnBehalf(address delegate) external;
function approveClaimOnBehalf(address delegate) external;
function removeClaimOnBehalf(address delegate) external;
function approveExchangeOnBehalf(address delegate) external;
function removeExchangeOnBehalf(address delegate) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/IDirectIntegration
interface IDirectIntegrationManager {
struct ParameterIntegrationSettings {
bytes32 currencyKey;
address dexPriceAggregator;
address atomicEquivalentForDexPricing;
uint atomicExchangeFeeRate;
uint atomicTwapWindow;
uint atomicMaxVolumePerBlock;
uint atomicVolatilityConsiderationWindow;
uint atomicVolatilityUpdateThreshold;
uint exchangeFeeRate;
uint exchangeMaxDynamicFee;
uint exchangeDynamicFeeRounds;
uint exchangeDynamicFeeThreshold;
uint exchangeDynamicFeeWeightDecay;
}
function getExchangeParameters(address integration, bytes32 key)
external
view
returns (ParameterIntegrationSettings memory settings);
function setExchangeParameters(
address integration,
bytes32[] calldata currencyKeys,
ParameterIntegrationSettings calldata params
) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/iexchangerates
interface IExchangeRates {
// Structs
struct RateAndUpdatedTime {
uint216 rate;
uint40 time;
}
// Views
function aggregators(bytes32 currencyKey) external view returns (address);
function aggregatorWarningFlags() external view returns (address);
function anyRateIsInvalid(bytes32[] calldata currencyKeys) external view returns (bool);
function anyRateIsInvalidAtRound(bytes32[] calldata currencyKeys, uint[] calldata roundIds) external view returns (bool);
function currenciesUsingAggregator(address aggregator) external view returns (bytes32[] memory);
function effectiveValue(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
) external view returns (uint value);
function effectiveValueAndRates(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint value,
uint sourceRate,
uint destinationRate
);
function effectiveValueAndRatesAtRound(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
uint roundIdForSrc,
uint roundIdForDest
)
external
view
returns (
uint value,
uint sourceRate,
uint destinationRate
);
function effectiveAtomicValueAndRates(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint value,
uint systemValue,
uint systemSourceRate,
uint systemDestinationRate
);
function effectiveAtomicValueAndRates(
IDirectIntegrationManager.ParameterIntegrationSettings calldata sourceSettings,
uint sourceAmount,
IDirectIntegrationManager.ParameterIntegrationSettings calldata destinationSettings,
IDirectIntegrationManager.ParameterIntegrationSettings calldata usdSettings
)
external
view
returns (
uint value,
uint systemValue,
uint systemSourceRate,
uint systemDestinationRate
);
function getCurrentRoundId(bytes32 currencyKey) external view returns (uint);
function getLastRoundIdBeforeElapsedSecs(
bytes32 currencyKey,
uint startingRoundId,
uint startingTimestamp,
uint timediff
) external view returns (uint);
function lastRateUpdateTimes(bytes32 currencyKey) external view returns (uint256);
function rateAndTimestampAtRound(bytes32 currencyKey, uint roundId) external view returns (uint rate, uint time);
function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time);
function rateAndInvalid(bytes32 currencyKey) external view returns (uint rate, bool isInvalid);
function rateForCurrency(bytes32 currencyKey) external view returns (uint);
function rateIsFlagged(bytes32 currencyKey) external view returns (bool);
function rateIsInvalid(bytes32 currencyKey) external view returns (bool);
function rateIsStale(bytes32 currencyKey) external view returns (bool);
function rateStalePeriod() external view returns (uint);
function ratesAndUpdatedTimeForCurrencyLastNRounds(
bytes32 currencyKey,
uint numRounds,
uint roundId
) external view returns (uint[] memory rates, uint[] memory times);
function ratesAndInvalidForCurrencies(bytes32[] calldata currencyKeys)
external
view
returns (uint[] memory rates, bool anyRateInvalid);
function ratesForCurrencies(bytes32[] calldata currencyKeys) external view returns (uint[] memory);
function synthTooVolatileForAtomicExchange(bytes32 currencyKey) external view returns (bool);
function synthTooVolatileForAtomicExchange(IDirectIntegrationManager.ParameterIntegrationSettings calldata settings)
external
view
returns (bool);
function rateWithSafetyChecks(bytes32 currencyKey)
external
returns (
uint rate,
bool broken,
bool invalid
);
}
// https://docs.synthetix.io/contracts/source/interfaces/ICircuitBreaker
interface ICircuitBreaker {
// Views
function isInvalid(address oracleAddress, uint value) external view returns (bool);
function priceDeviationThresholdFactor() external view returns (uint);
function isDeviationAboveThreshold(uint base, uint comparison) external view returns (bool);
function lastValue(address oracleAddress) external view returns (uint);
function circuitBroken(address oracleAddress) external view returns (bool);
// Mutative functions
function resetLastValue(address[] calldata oracleAddresses, uint[] calldata values) external;
function probeCircuitBreaker(address oracleAddress, uint value) external returns (bool circuitBroken);
}
// https://docs.synthetix.io/contracts/source/interfaces/ihasbalance
interface IHasBalance {
// Views
function balanceOf(address account) external view returns (uint);
}
// https://docs.synthetix.io/contracts/source/interfaces/ierc20
interface IERC20 {
// ERC20 Optional Views
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
// Views
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
// Mutative functions
function transfer(address to, uint value) external returns (bool);
function approve(address spender, uint value) external returns (bool);
function transferFrom(
address from,
address to,
uint value
) external returns (bool);
// Events
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
interface ILiquidator {
// Views
function issuanceRatio() external view returns (uint);
function liquidationDelay() external view returns (uint);
function liquidationRatio() external view returns (uint);
function liquidationEscrowDuration() external view returns (uint);
function liquidationPenalty() external view returns (uint);
function selfLiquidationPenalty() external view returns (uint);
function liquidateReward() external view returns (uint);
function flagReward() external view returns (uint);
function liquidationCollateralRatio() external view returns (uint);
function getLiquidationDeadlineForAccount(address account) external view returns (uint);
function getLiquidationCallerForAccount(address account) external view returns (address);
function isLiquidationOpen(address account, bool isSelfLiquidation) external view returns (bool);
function isLiquidationDeadlinePassed(address account) external view returns (bool);
function calculateAmountToFixCollateral(
uint debtBalance,
uint collateral,
uint penalty
) external view returns (uint);
function liquidationAmounts(address account, bool isSelfLiquidation)
external
view
returns (
uint totalRedeemed,
uint debtToRemove,
uint escrowToLiquidate,
uint initialDebtBalance
);
// Mutative Functions
function flagAccountForLiquidation(address account) external;
// Restricted: used internally to Synthetix contracts
function removeAccountInLiquidation(address account) external;
function checkAndRemoveAccountInLiquidation(address account) external;
}
interface ILiquidatorRewards {
// Views
function earned(address account) external view returns (uint256);
// Mutative
function getReward(address account) external;
function notifyRewardAmount(uint256 reward) external;
function updateEntry(address account) external;
}
interface ISynthRedeemer {
// Rate of redemption - 0 for none
function redemptions(address synthProxy) external view returns (uint redeemRate);
// sUSD balance of deprecated token holder
function balanceOf(IERC20 synthProxy, address account) external view returns (uint balanceOfInsUSD);
// Full sUSD supply of token
function totalSupply(IERC20 synthProxy) external view returns (uint totalSupplyInsUSD);
function redeem(IERC20 synthProxy) external;
function redeemAll(IERC20[] calldata synthProxies) external;
function redeemPartial(IERC20 synthProxy, uint amountOfSynth) external;
// Restricted to Issuer
function deprecate(IERC20 synthProxy, uint rateToRedeem) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/isystemstatus
interface ISystemStatus {
struct Status {
bool canSuspend;
bool canResume;
}
struct Suspension {
bool suspended;
// reason is an integer code,
// 0 => no reason, 1 => upgrading, 2+ => defined by system usage
uint248 reason;
}
// Views
function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume);
function requireSystemActive() external view;
function systemSuspended() external view returns (bool);
function requireIssuanceActive() external view;
function requireExchangeActive() external view;
function requireFuturesActive() external view;
function requireFuturesMarketActive(bytes32 marketKey) external view;
function requireExchangeBetweenSynthsAllowed(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view;
function requireSynthActive(bytes32 currencyKey) external view;
function synthSuspended(bytes32 currencyKey) external view returns (bool);
function requireSynthsActive(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view;
function systemSuspension() external view returns (bool suspended, uint248 reason);
function issuanceSuspension() external view returns (bool suspended, uint248 reason);
function exchangeSuspension() external view returns (bool suspended, uint248 reason);
function futuresSuspension() external view returns (bool suspended, uint248 reason);
function synthExchangeSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);
function synthSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);
function futuresMarketSuspension(bytes32 marketKey) external view returns (bool suspended, uint248 reason);
function getSynthExchangeSuspensions(bytes32[] calldata synths)
external
view
returns (bool[] memory exchangeSuspensions, uint256[] memory reasons);
function getSynthSuspensions(bytes32[] calldata synths)
external
view
returns (bool[] memory suspensions, uint256[] memory reasons);
function getFuturesMarketSuspensions(bytes32[] calldata marketKeys)
external
view
returns (bool[] memory suspensions, uint256[] memory reasons);
// Restricted functions
function suspendIssuance(uint256 reason) external;
function suspendSynth(bytes32 currencyKey, uint256 reason) external;
function suspendFuturesMarket(bytes32 marketKey, uint256 reason) external;
function updateAccessControl(
bytes32 section,
address account,
bool canSuspend,
bool canResume
) external;
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/proxy
contract Proxy is Owned {
Proxyable public target;
constructor(address _owner) public Owned(_owner) {}
function setTarget(Proxyable _target) external onlyOwner {
target = _target;
emit TargetUpdated(_target);
}
function _emit(
bytes calldata callData,
uint numTopics,
bytes32 topic1,
bytes32 topic2,
bytes32 topic3,
bytes32 topic4
) external onlyTarget {
uint size = callData.length;
bytes memory _callData = callData;
assembly {
/* The first 32 bytes of callData contain its length (as specified by the abi).
* Length is assumed to be a uint256 and therefore maximum of 32 bytes
* in length. It is also leftpadded to be a multiple of 32 bytes.
* This means moving call_data across 32 bytes guarantees we correctly access
* the data itself. */
switch numTopics
case 0 {
log0(add(_callData, 32), size)
}
case 1 {
log1(add(_callData, 32), size, topic1)
}
case 2 {
log2(add(_callData, 32), size, topic1, topic2)
}
case 3 {
log3(add(_callData, 32), size, topic1, topic2, topic3)
}
case 4 {
log4(add(_callData, 32), size, topic1, topic2, topic3, topic4)
}
}
}
// solhint-disable no-complex-fallback
function() external payable {
// Mutable call setting Proxyable.messageSender as this is using call not delegatecall
target.setMessageSender(msg.sender);
assembly {
let free_ptr := mload(0x40)
calldatacopy(free_ptr, 0, calldatasize)
/* We must explicitly forward ether to the underlying contract as well. */
let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0)
returndatacopy(free_ptr, 0, returndatasize)
if iszero(result) {
revert(free_ptr, returndatasize)
}
return(free_ptr, returndatasize)
}
}
modifier onlyTarget {
require(Proxyable(msg.sender) == target, "Must be proxy target");
_;
}
event TargetUpdated(Proxyable newTarget);
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/proxyable
contract Proxyable is Owned {
// This contract should be treated like an abstract contract
/* The proxy this contract exists behind. */
Proxy public proxy;
/* The caller of the proxy, passed through to this contract.
* Note that every function using this member must apply the onlyProxy or
* optionalProxy modifiers, otherwise their invocations can use stale values. */
address public messageSender;
constructor(address payable _proxy) internal {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setProxy(address payable _proxy) external onlyOwner {
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setMessageSender(address sender) external onlyProxy {
messageSender = sender;
}
modifier onlyProxy {
_onlyProxy();
_;
}
function _onlyProxy() private view {
require(Proxy(msg.sender) == proxy, "Only the proxy can call");
}
modifier optionalProxy {
_optionalProxy();
_;
}
function _optionalProxy() private {
if (Proxy(msg.sender) != proxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
}
modifier optionalProxy_onlyOwner {
_optionalProxy_onlyOwner();
_;
}
// solhint-disable-next-line func-name-mixedcase
function _optionalProxy_onlyOwner() private {
if (Proxy(msg.sender) != proxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
require(messageSender == owner, "Owner only function");
}
event ProxyUpdated(address proxyAddress);
}
interface AggregatorInterface {
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp);
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
/**
* @title The V2 & V3 Aggregator Interface
* @notice Solidity V0.5 does not allow interfaces to inherit from other
* interfaces so this contract is a combination of v0.5 AggregatorInterface.sol
* and v0.5 AggregatorV3Interface.sol.
*/
interface AggregatorV2V3Interface {
//
// V2 Interface:
//
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp);
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
//
// V3 Interface:
//
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
// Inheritance
// Libraries
// Internal references
interface IProxy {
function target() external view returns (address);
}
interface IIssuerInternalDebtCache {
function updateCachedSynthDebtWithRate(bytes32 currencyKey, uint currencyRate) external;
function updateCachedSynthDebtsWithRates(bytes32[] calldata currencyKeys, uint[] calldata currencyRates) external;
function updateDebtCacheValidity(bool currentlyInvalid) external;
function totalNonSnxBackedDebt() external view returns (uint excludedDebt, bool isInvalid);
function cacheInfo()
external
view
returns (
uint cachedDebt,
uint timestamp,
bool isInvalid,
bool isStale
);
function updateCachedsUSDDebt(int amount) external;
}
// https://docs.synthetix.io/contracts/source/contracts/issuer
contract Issuer is Owned, MixinSystemSettings, IIssuer {
using SafeMath for uint;
using SafeDecimalMath for uint;
bytes32 public constant CONTRACT_NAME = "Issuer";
// Available Synths which can be used with the system
ISynth[] public availableSynths;
mapping(bytes32 => ISynth) public synths;
mapping(address => bytes32) public synthsByAddress;
/* ========== ENCODED NAMES ========== */
bytes32 internal constant sUSD = "sUSD";
bytes32 internal constant SNX = "SNX";
// Flexible storage names
bytes32 internal constant LAST_ISSUE_EVENT = "lastIssueEvent";
/* ========== ADDRESS RESOLVER CONFIGURATION ========== */
bytes32 private constant CONTRACT_SYNTHETIX = "Synthetix";
bytes32 private constant CONTRACT_EXCHANGER = "Exchanger";
bytes32 private constant CONTRACT_EXRATES = "ExchangeRates";
bytes32 private constant CONTRACT_CIRCUIT_BREAKER = "CircuitBreaker";
bytes32 private constant CONTRACT_SYNTHETIXDEBTSHARE = "SynthetixDebtShare";
bytes32 private constant CONTRACT_FEEPOOL = "FeePool";
bytes32 private constant CONTRACT_DELEGATEAPPROVALS = "DelegateApprovals";
bytes32 private constant CONTRACT_REWARDESCROW_V2 = "RewardEscrowV2";
bytes32 private constant CONTRACT_LIQUIDATOR = "Liquidator";
bytes32 private constant CONTRACT_LIQUIDATOR_REWARDS = "LiquidatorRewards";
bytes32 private constant CONTRACT_DEBTCACHE = "DebtCache";
bytes32 private constant CONTRACT_DYNAMICSYNTHREDEEMER = "DynamicSynthRedeemer";
bytes32 private constant CONTRACT_SYNTHREDEEMER = "SynthRedeemer";
bytes32 private constant CONTRACT_SYNTHETIXBRIDGETOOPTIMISM = "SynthetixBridgeToOptimism";
bytes32 private constant CONTRACT_SYNTHETIXBRIDGETOBASE = "SynthetixBridgeToBase";
bytes32 private constant CONTRACT_DEBT_MIGRATOR_ON_ETHEREUM = "DebtMigratorOnEthereum";
bytes32 private constant CONTRACT_DEBT_MIGRATOR_ON_OPTIMISM = "DebtMigratorOnOptimism";
bytes32 private constant CONTRACT_EXT_AGGREGATOR_ISSUED_SYNTHS = "ext:AggregatorIssuedSynths";
bytes32 private constant CONTRACT_EXT_AGGREGATOR_DEBT_RATIO = "ext:AggregatorDebtRatio";
constructor(address _owner, address _resolver) public Owned(_owner) MixinSystemSettings(_resolver) {}
/* ========== VIEWS ========== */
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired();
bytes32[] memory newAddresses = new bytes32[](15);
newAddresses[0] = CONTRACT_SYNTHETIX;
newAddresses[1] = CONTRACT_EXCHANGER;
newAddresses[2] = CONTRACT_EXRATES;
newAddresses[3] = CONTRACT_CIRCUIT_BREAKER;
newAddresses[4] = CONTRACT_SYNTHETIXDEBTSHARE;
newAddresses[5] = CONTRACT_FEEPOOL;
newAddresses[6] = CONTRACT_DELEGATEAPPROVALS;
newAddresses[7] = CONTRACT_REWARDESCROW_V2;
newAddresses[8] = CONTRACT_LIQUIDATOR;
newAddresses[9] = CONTRACT_LIQUIDATOR_REWARDS;
newAddresses[10] = CONTRACT_DEBTCACHE;
newAddresses[11] = CONTRACT_SYNTHREDEEMER;
newAddresses[12] = CONTRACT_DYNAMICSYNTHREDEEMER;
newAddresses[13] = CONTRACT_EXT_AGGREGATOR_ISSUED_SYNTHS;
newAddresses[14] = CONTRACT_EXT_AGGREGATOR_DEBT_RATIO;
return combineArrays(existingAddresses, newAddresses);
}
function synthetixERC20() internal view returns (IERC20) {
return IERC20(requireAndGetAddress(CONTRACT_SYNTHETIX));
}
function exchanger() internal view returns (IExchanger) {
return IExchanger(requireAndGetAddress(CONTRACT_EXCHANGER));
}
function exchangeRates() internal view returns (IExchangeRates) {
return IExchangeRates(requireAndGetAddress(CONTRACT_EXRATES));
}
function circuitBreaker() internal view returns (ICircuitBreaker) {
return ICircuitBreaker(requireAndGetAddress(CONTRACT_CIRCUIT_BREAKER));
}
function synthetixDebtShare() internal view returns (ISynthetixDebtShare) {
return ISynthetixDebtShare(requireAndGetAddress(CONTRACT_SYNTHETIXDEBTSHARE));
}
function liquidator() internal view returns (ILiquidator) {
return ILiquidator(requireAndGetAddress(CONTRACT_LIQUIDATOR));
}
function liquidatorRewards() internal view returns (ILiquidatorRewards) {
return ILiquidatorRewards(requireAndGetAddress(CONTRACT_LIQUIDATOR_REWARDS));
}
function delegateApprovals() internal view returns (IDelegateApprovals) {
return IDelegateApprovals(requireAndGetAddress(CONTRACT_DELEGATEAPPROVALS));
}
function rewardEscrowV2() internal view returns (IHasBalance) {
return IHasBalance(requireAndGetAddress(CONTRACT_REWARDESCROW_V2));
}
function debtCache() internal view returns (IIssuerInternalDebtCache) {
return IIssuerInternalDebtCache(requireAndGetAddress(CONTRACT_DEBTCACHE));
}
function synthRedeemer() internal view returns (ISynthRedeemer) {
return ISynthRedeemer(requireAndGetAddress(CONTRACT_SYNTHREDEEMER));
}
function allNetworksDebtInfo()
public
view
returns (
uint256 debt,
uint256 sharesSupply,
bool isStale
)
{
(, int256 rawIssuedSynths, , uint issuedSynthsUpdatedAt, ) =
_latestRoundData(requireAndGetAddress(CONTRACT_EXT_AGGREGATOR_ISSUED_SYNTHS));
(uint rawRatio, uint ratioUpdatedAt) = _rawDebtRatioAndUpdatedAt();
debt = uint(rawIssuedSynths);
sharesSupply = rawRatio == 0 ? 0 : debt.divideDecimalRoundPrecise(uint(rawRatio));
uint stalePeriod = getRateStalePeriod();
isStale =
stalePeriod < block.timestamp &&
(block.timestamp - stalePeriod > issuedSynthsUpdatedAt || block.timestamp - stalePeriod > ratioUpdatedAt);
}
function issuanceRatio() external view returns (uint) {
return getIssuanceRatio();
}
function _rateAndInvalid(bytes32 currencyKey) internal view returns (uint, bool) {
return exchangeRates().rateAndInvalid(currencyKey);
}
function _latestRoundData(address aggregator)
internal
view
returns (
uint80,
int256,
uint256,
uint256,
uint80
)
{
return AggregatorV2V3Interface(aggregator).latestRoundData();
}
function _rawDebtRatioAndUpdatedAt() internal view returns (uint, uint) {
(, int256 rawRatioInt, , uint ratioUpdatedAt, ) =
_latestRoundData(requireAndGetAddress(CONTRACT_EXT_AGGREGATOR_DEBT_RATIO));
return (uint(rawRatioInt), ratioUpdatedAt);
}
function _sharesForDebt(uint debtAmount) internal view returns (uint) {
(uint rawRatio, ) = _rawDebtRatioAndUpdatedAt();
return rawRatio == 0 ? 0 : debtAmount.divideDecimalRoundPrecise(rawRatio);
}
function _debtForShares(uint sharesAmount) internal view returns (uint) {
(uint rawRatio, ) = _rawDebtRatioAndUpdatedAt();
return sharesAmount.multiplyDecimalRoundPrecise(rawRatio);
}
function _debtShareBalanceOf(address account) internal view returns (uint) {
return synthetixDebtShare().balanceOf(account);
}
function _snxBalanceOf(address account) internal view returns (uint) {
return synthetixERC20().balanceOf(account);
}
function _rewardEscrowBalanceOf(address account) internal view returns (uint) {
return rewardEscrowV2().balanceOf(account);
}
function _availableCurrencyKeysWithOptionalSNX(bool withSNX) internal view returns (bytes32[] memory) {
bytes32[] memory currencyKeys = new bytes32[](availableSynths.length + (withSNX ? 1 : 0));
for (uint i = 0; i < availableSynths.length; i++) {
currencyKeys[i] = synthsByAddress[address(availableSynths[i])];
}
if (withSNX) {
currencyKeys[availableSynths.length] = SNX;
}
return currencyKeys;
}
// Returns the total value of the debt pool in currency specified by `currencyKey`.
// To return only the SNX-backed debt, set `excludeCollateral` to true.
function _totalIssuedSynths(bytes32 currencyKey, bool excludeCollateral)
internal
view
returns (uint totalIssued, bool anyRateIsInvalid)
{
(uint debt, , bool cacheIsInvalid, bool cacheIsStale) = debtCache().cacheInfo();
anyRateIsInvalid = cacheIsInvalid || cacheIsStale;
// Add total issued synths from non snx collateral back into the total if not excluded
if (!excludeCollateral) {
(uint nonSnxDebt, bool invalid) = debtCache().totalNonSnxBackedDebt();
debt = debt.add(nonSnxDebt);
anyRateIsInvalid = anyRateIsInvalid || invalid;
}
if (currencyKey == sUSD) {
return (debt, anyRateIsInvalid);
}
(uint currencyRate, bool currencyRateInvalid) = _rateAndInvalid(currencyKey);
return (debt.divideDecimalRound(currencyRate), anyRateIsInvalid || currencyRateInvalid);
}
function _debtBalanceOfAndTotalDebt(uint debtShareBalance, bytes32 currencyKey)
internal
view
returns (
uint debtBalance,
uint totalSystemValue,
bool anyRateIsInvalid
)
{
// What's the total value of the system excluding ETH backed synths in their requested currency?
(uint snxBackedAmount, , bool debtInfoStale) = allNetworksDebtInfo();
if (debtShareBalance == 0) {
return (0, snxBackedAmount, debtInfoStale);
}
// existing functionality requires for us to convert into the exchange rate specified by `currencyKey`
(uint currencyRate, bool currencyRateInvalid) = _rateAndInvalid(currencyKey);
debtBalance = _debtForShares(debtShareBalance).divideDecimalRound(currencyRate);
totalSystemValue = snxBackedAmount;
anyRateIsInvalid = currencyRateInvalid || debtInfoStale;
}
function _canBurnSynths(address account) internal view returns (bool) {
return now >= _lastIssueEvent(account).add(getMinimumStakeTime());
}
function _lastIssueEvent(address account) internal view returns (uint) {
// Get the timestamp of the last issue this account made
return flexibleStorage().getUIntValue(CONTRACT_NAME, keccak256(abi.encodePacked(LAST_ISSUE_EVENT, account)));
}
function _remainingIssuableSynths(address _issuer)
internal
view
returns (
uint maxIssuable,
uint alreadyIssued,
uint totalSystemDebt,
bool anyRateIsInvalid
)
{
(alreadyIssued, totalSystemDebt, anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_debtShareBalanceOf(_issuer), sUSD);
(uint issuable, bool isInvalid) = _maxIssuableSynths(_issuer);
maxIssuable = issuable;
anyRateIsInvalid = anyRateIsInvalid || isInvalid;
if (alreadyIssued >= maxIssuable) {
maxIssuable = 0;
} else {
maxIssuable = maxIssuable.sub(alreadyIssued);
}
}
function _snxToUSD(uint amount, uint snxRate) internal pure returns (uint) {
return amount.multiplyDecimalRound(snxRate);
}
function _usdToSnx(uint amount, uint snxRate) internal pure returns (uint) {
return amount.divideDecimalRound(snxRate);
}
function _maxIssuableSynths(address _issuer) internal view returns (uint, bool) {
// What is the value of their SNX balance in sUSD
(uint snxRate, bool isInvalid) = _rateAndInvalid(SNX);
uint destinationValue = _snxToUSD(_collateral(_issuer), snxRate);
// They're allowed to issue up to issuanceRatio of that value
return (destinationValue.multiplyDecimal(getIssuanceRatio()), isInvalid);
}
function _collateralisationRatio(address _issuer) internal view returns (uint, bool) {
uint totalOwnedSynthetix = _collateral(_issuer);
(uint debtBalance, , bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_debtShareBalanceOf(_issuer), SNX);
// it's more gas intensive to put this check here if they have 0 SNX, but it complies with the interface
if (totalOwnedSynthetix == 0) return (0, anyRateIsInvalid);
return (debtBalance.divideDecimalRound(totalOwnedSynthetix), anyRateIsInvalid);
}
function _collateral(address account) internal view returns (uint) {
return _snxBalanceOf(account).add(_rewardEscrowBalanceOf(account)).add(liquidatorRewards().earned(account));
}
function minimumStakeTime() external view returns (uint) {
return getMinimumStakeTime();
}
function canBurnSynths(address account) external view returns (bool) {
return _canBurnSynths(account);
}
function availableCurrencyKeys() external view returns (bytes32[] memory) {
return _availableCurrencyKeysWithOptionalSNX(false);
}
function availableSynthCount() external view returns (uint) {
return availableSynths.length;
}
function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid) {
(, anyRateInvalid) = exchangeRates().ratesAndInvalidForCurrencies(_availableCurrencyKeysWithOptionalSNX(true));
}
function totalIssuedSynths(bytes32 currencyKey, bool excludeOtherCollateral) external view returns (uint totalIssued) {
(totalIssued, ) = _totalIssuedSynths(currencyKey, excludeOtherCollateral);
}
function lastIssueEvent(address account) external view returns (uint) {
return _lastIssueEvent(account);
}
function collateralisationRatio(address _issuer) external view returns (uint cratio) {
(cratio, ) = _collateralisationRatio(_issuer);
}
function collateralisationRatioAndAnyRatesInvalid(address _issuer)
external
view
returns (uint cratio, bool anyRateIsInvalid)
{
return _collateralisationRatio(_issuer);
}
function collateral(address account) external view returns (uint) {
return _collateral(account);
}
function debtBalanceOf(address _issuer, bytes32 currencyKey) external view returns (uint debtBalance) {
// What was their initial debt ownership?
uint debtShareBalance = _debtShareBalanceOf(_issuer);
// If it's zero, they haven't issued, and they have no debt.
if (debtShareBalance == 0) return 0;
(debtBalance, , ) = _debtBalanceOfAndTotalDebt(debtShareBalance, currencyKey);
}
function remainingIssuableSynths(address _issuer)
external
view
returns (
uint maxIssuable,
uint alreadyIssued,
uint totalSystemDebt
)
{
(maxIssuable, alreadyIssued, totalSystemDebt, ) = _remainingIssuableSynths(_issuer);
}
function maxIssuableSynths(address _issuer) external view returns (uint) {
(uint maxIssuable, ) = _maxIssuableSynths(_issuer);
return maxIssuable;
}
function transferableSynthetixAndAnyRateIsInvalid(address account, uint balance)
external
view
returns (uint transferable, bool anyRateIsInvalid)
{
// How many SNX do they have, excluding escrow?
// Note: We're excluding escrow here because we're interested in their transferable amount
// and escrowed SNX are not transferable.
// How many of those will be locked by the amount they've issued?
// Assuming issuance ratio is 20%, then issuing 20 SNX of value would require
// 100 SNX to be locked in their wallet to maintain their collateralisation ratio
// The locked synthetix value can exceed their balance.
uint debtBalance;
(debtBalance, , anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_debtShareBalanceOf(account), SNX);
uint lockedSynthetixValue = debtBalance.divideDecimalRound(getIssuanceRatio());
// If we exceed the balance, no SNX are transferable, otherwise the difference is.
if (lockedSynthetixValue >= balance) {
transferable = 0;
} else {
transferable = balance.sub(lockedSynthetixValue);
}
}
function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory) {
uint numKeys = currencyKeys.length;
ISynth[] memory addresses = new ISynth[](numKeys);
for (uint i = 0; i < numKeys; i++) {
addresses[i] = synths[currencyKeys[i]];
}
return addresses;
}
/// @notice Provide the results that would be returned by the mutative liquidateAccount() method (that's reserved to Synthetix)
/// @param account The account to be liquidated
/// @param isSelfLiquidation boolean to determine if this is a forced or self-invoked liquidation
/// @return totalRedeemed the total amount of collateral (SNX) to redeem (liquid and escrow)
/// @return debtToRemove the amount of debt (sUSD) to burn in order to fix the account's c-ratio
/// @return escrowToLiquidate the amount of escrow SNX that will be revoked during liquidation
/// @return initialDebtBalance the amount of initial (sUSD) debt the account has
function liquidationAmounts(address account, bool isSelfLiquidation)
external
view
returns (
uint totalRedeemed,
uint debtToRemove,
uint escrowToLiquidate,
uint initialDebtBalance
)
{
return _liquidationAmounts(account, isSelfLiquidation);
}
/* ========== MUTATIVE FUNCTIONS ========== */
function _addSynth(ISynth synth) internal {
bytes32 currencyKey = synth.currencyKey();
require(synths[currencyKey] == ISynth(0), "Synth exists");
require(synthsByAddress[address(synth)] == bytes32(0), "Synth address already exists");
availableSynths.push(synth);
synths[currencyKey] = synth;
synthsByAddress[address(synth)] = currencyKey;
emit SynthAdded(currencyKey, address(synth));
}
function addSynth(ISynth synth) external onlyOwner {
_addSynth(synth);
// Invalidate the cache to force a snapshot to be recomputed. If a synth were to be added
// back to the system and it still somehow had cached debt, this would force the value to be
// updated.
debtCache().updateDebtCacheValidity(true);
}
function addSynths(ISynth[] calldata synthsToAdd) external onlyOwner {
uint numSynths = synthsToAdd.length;
for (uint i = 0; i < numSynths; i++) {
_addSynth(synthsToAdd[i]);
}
// Invalidate the cache to force a snapshot to be recomputed.
debtCache().updateDebtCacheValidity(true);
}
function _removeSynth(bytes32 currencyKey) internal {
address synthToRemove = address(synths[currencyKey]);
require(synthToRemove != address(0), "Synth does not exist");
require(currencyKey != sUSD, "Cannot remove synth");
uint synthSupply = IERC20(synthToRemove).totalSupply();
if (synthSupply > 0) {
(uint amountOfsUSD, uint rateToRedeem, ) =
exchangeRates().effectiveValueAndRates(currencyKey, synthSupply, "sUSD");
require(rateToRedeem > 0, "Cannot remove without rate");
ISynthRedeemer _synthRedeemer = synthRedeemer();
synths[sUSD].issue(address(_synthRedeemer), amountOfsUSD);
// ensure the debt cache is aware of the new sUSD issued
debtCache().updateCachedsUSDDebt(SafeCast.toInt256(amountOfsUSD));
_synthRedeemer.deprecate(IERC20(address(Proxyable(synthToRemove).proxy())), rateToRedeem);
}
// Remove the synth from the availableSynths array.
for (uint i = 0; i < availableSynths.length; i++) {
if (address(availableSynths[i]) == synthToRemove) {
delete availableSynths[i];
// Copy the last synth into the place of the one we just deleted
// If there's only one synth, this is synths[0] = synths[0].
// If we're deleting the last one, it's also a NOOP in the same way.
availableSynths[i] = availableSynths[availableSynths.length - 1];
// Decrease the size of the array by one.
availableSynths.length--;
break;
}
}
// And remove it from the synths mapping
delete synthsByAddress[synthToRemove];
delete synths[currencyKey];
emit SynthRemoved(currencyKey, synthToRemove);
}
function removeSynth(bytes32 currencyKey) external onlyOwner {
// Remove its contribution from the debt pool snapshot, and
// invalidate the cache to force a new snapshot.
IIssuerInternalDebtCache cache = debtCache();
cache.updateCachedSynthDebtWithRate(currencyKey, 0);
cache.updateDebtCacheValidity(true);
_removeSynth(currencyKey);
}
function removeSynths(bytes32[] calldata currencyKeys) external onlyOwner {
uint numKeys = currencyKeys.length;
// Remove their contributions from the debt pool snapshot, and
// invalidate the cache to force a new snapshot.
IIssuerInternalDebtCache cache = debtCache();
uint[] memory zeroRates = new uint[](numKeys);
cache.updateCachedSynthDebtsWithRates(currencyKeys, zeroRates);
cache.updateDebtCacheValidity(true);
for (uint i = 0; i < numKeys; i++) {
_removeSynth(currencyKeys[i]);
}
}
function issueSynthsWithoutDebt(
bytes32 currencyKey,
address to,
uint amount
) external onlyTrustedMinters returns (bool rateInvalid) {
require(address(synths[currencyKey]) != address(0), "synth doesn't exist");
require(amount > 0, "cannot issue 0 synths");
// record issue timestamp
_setLastIssueEvent(to);
// Create their synths
synths[currencyKey].issue(to, amount);
// Account for the issued debt in the cache
(uint rate, bool rateInvalid) = _rateAndInvalid(currencyKey);
debtCache().updateCachedsUSDDebt(SafeCast.toInt256(amount.multiplyDecimal(rate)));
// returned so that the caller can decide what to do if the rate is invalid
return rateInvalid;
}
function burnSynthsWithoutDebt(
bytes32 currencyKey,
address from,
uint amount
) external onlyTrustedMinters returns (bool rateInvalid) {
require(address(synths[currencyKey]) != address(0), "synth doesn't exist");
require(amount > 0, "cannot issue 0 synths");
exchanger().settle(from, currencyKey);
// Burn some synths
synths[currencyKey].burn(from, amount);
// Account for the burnt debt in the cache. If rate is invalid, the user won't be able to exchange
(uint rate, bool rateInvalid) = _rateAndInvalid(currencyKey);
debtCache().updateCachedsUSDDebt(-SafeCast.toInt256(amount.multiplyDecimal(rate)));
// returned so that the caller can decide what to do if the rate is invalid
return rateInvalid;
}
/**
* SIP-2059: Dynamic Redemption
* Function used to burn spot synths and issue the equivalent in sUSD at chainlink price * discount rate
* @param account The address of the account that is redeeming
* @param currencyKey The synth to be redeemed
* @param amountOfSynth The amount of redeeming synth to burn
* @param amountInsUSD The amount of sUSD to issue
*/
function burnAndIssueSynthsWithoutDebtCache(
address account,
bytes32 currencyKey,
uint amountOfSynth,
uint amountInsUSD
) external onlySynthRedeemer {
exchanger().settle(account, currencyKey);
// Burn their redeemed synths
synths[currencyKey].burn(account, amountOfSynth);
// record issue timestamp
_setLastIssueEvent(account);
// Issuer their sUSD equivalent
synths[sUSD].issue(account, amountInsUSD);
}
/**
* SIP-237: Debt Migration
* Function used for the one-way migration of all debt and liquid + escrowed SNX from L1 -> L2
* @param account The address of the account that is being migrated
* @param amount The amount of debt shares moving across layers
*/
function modifyDebtSharesForMigration(address account, uint amount) external onlyTrustedMigrators {
ISynthetixDebtShare sds = synthetixDebtShare();
if (msg.sender == resolver.getAddress(CONTRACT_DEBT_MIGRATOR_ON_ETHEREUM)) {
sds.burnShare(account, amount);
} else if (msg.sender == resolver.getAddress(CONTRACT_DEBT_MIGRATOR_ON_OPTIMISM)) {
sds.mintShare(account, amount);
}
}
function issueSynths(address from, uint amount) external onlySynthetix {
require(amount > 0, "cannot issue 0 synths");
_issueSynths(from, amount, false);
}
function issueMaxSynths(address from) external onlySynthetix {
_issueSynths(from, 0, true);
}
function issueSynthsOnBehalf(
address issueForAddress,
address from,
uint amount
) external onlySynthetix {
_requireCanIssueOnBehalf(issueForAddress, from);
_issueSynths(issueForAddress, amount, false);
}
function issueMaxSynthsOnBehalf(address issueForAddress, address from) external onlySynthetix {
_requireCanIssueOnBehalf(issueForAddress, from);
_issueSynths(issueForAddress, 0, true);
}
function burnSynths(address from, uint amount) external onlySynthetix {
_voluntaryBurnSynths(from, amount, false);
}
function burnSynthsOnBehalf(
address burnForAddress,
address from,
uint amount
) external onlySynthetix {
_requireCanBurnOnBehalf(burnForAddress, from);
_voluntaryBurnSynths(burnForAddress, amount, false);
}
function burnSynthsToTarget(address from) external onlySynthetix {
_voluntaryBurnSynths(from, 0, true);
}
function burnSynthsToTargetOnBehalf(address burnForAddress, address from) external onlySynthetix {
_requireCanBurnOnBehalf(burnForAddress, from);
_voluntaryBurnSynths(burnForAddress, 0, true);
}
function burnForRedemption(
address deprecatedSynthProxy,
address account,
uint balance
) external onlySynthRedeemer {
ISynth(IProxy(deprecatedSynthProxy).target()).burn(account, balance);
}
// SIP-148: Upgraded Liquidation Mechanism
/// @notice This is where the core internal liquidation logic resides. This function can only be invoked by Synthetix.
/// Reverts if liquidator().isLiquidationOpen() returns false (e.g. c-ratio is too high, delay hasn't passed,
/// account wasn't flagged etc)
/// @param account The account to be liquidated
/// @param isSelfLiquidation boolean to determine if this is a forced or self-invoked liquidation
/// @return totalRedeemed the total amount of collateral (SNX) to redeem (liquid and escrow)
/// @return debtRemoved the amount of debt (sUSD) to burn in order to fix the account's c-ratio
/// @return escrowToLiquidate the amount of escrow SNX that will be revoked during liquidation
function liquidateAccount(address account, bool isSelfLiquidation)
external
onlySynthetix
returns (
uint totalRedeemed,
uint debtRemoved,
uint escrowToLiquidate
)
{
require(liquidator().isLiquidationOpen(account, isSelfLiquidation), "Not open for liquidation");
// liquidationAmounts checks isLiquidationOpen for the account
uint initialDebtBalance;
(totalRedeemed, debtRemoved, escrowToLiquidate, initialDebtBalance) = _liquidationAmounts(
account,
isSelfLiquidation
);
// Reduce debt shares by amount to liquidate.
_removeFromDebtRegister(account, debtRemoved, initialDebtBalance);
if (!isSelfLiquidation) {
// In case of forced liquidation only, remove the liquidation flag.
liquidator().removeAccountInLiquidation(account);
}
// Note: To remove the flag after self liquidation, burn to target and then call Liquidator.checkAndRemoveAccountInLiquidation(account).
}
function _liquidationAmounts(address account, bool isSelfLiquidation)
internal
view
returns (
uint totalRedeemed,
uint debtToRemove,
uint escrowToLiquidate,
uint debtBalance
)
{
// Get the account's debt balance
bool anyRateIsInvalid;
(debtBalance, , anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_debtShareBalanceOf(account), sUSD);
// Get the SNX rate
(uint snxRate, bool snxRateInvalid) = _rateAndInvalid(SNX);
_requireRatesNotInvalid(anyRateIsInvalid || snxRateInvalid);
uint penalty;
if (isSelfLiquidation) {
// Get self liquidation penalty
penalty = getSelfLiquidationPenalty();
// Calculate the amount of debt to remove and SNX to redeem for a self liquidation
debtToRemove = liquidator().calculateAmountToFixCollateral(
debtBalance,
_snxToUSD(_collateral(account), snxRate),
penalty
);
// Get the minimum values for both totalRedeemed and debtToRemove
totalRedeemed = _getMinValue(
_usdToSnx(debtToRemove, snxRate).multiplyDecimal(SafeDecimalMath.unit().add(penalty)),
_snxBalanceOf(account)
);
debtToRemove = _getMinValue(
_snxToUSD(totalRedeemed, snxRate).divideDecimal(SafeDecimalMath.unit().add(penalty)),
debtToRemove
);
// Return escrow as zero since it cannot be self liquidated
return (totalRedeemed, debtToRemove, 0, debtBalance);
} else {
// In the case of forced Liquidation
// Get the forced liquidation penalty and sum of the flag and liquidate rewards.
penalty = getSnxLiquidationPenalty();
uint rewardsSum = getLiquidateReward().add(getFlagReward());
// Get the total USD value of their SNX collateral (including escrow and rewards minus the flag and liquidate rewards)
uint collateralForAccountUSD = _snxToUSD(_collateral(account).sub(rewardsSum), snxRate);
// Calculate the amount of debt to remove and the sUSD value of the SNX required to liquidate.
debtToRemove = liquidator().calculateAmountToFixCollateral(debtBalance, collateralForAccountUSD, penalty);
uint redeemTarget = _usdToSnx(debtToRemove, snxRate).multiplyDecimal(SafeDecimalMath.unit().add(penalty));
if (redeemTarget.add(rewardsSum) >= _collateral(account)) {
// need to wipe out the account
debtToRemove = debtBalance;
totalRedeemed = _collateral(account).sub(rewardsSum);
escrowToLiquidate = _rewardEscrowBalanceOf(account);
return (totalRedeemed, debtToRemove, escrowToLiquidate, debtBalance);
} else {
// normal forced liquidation
(totalRedeemed, escrowToLiquidate) = _redeemableCollateralForTarget(account, redeemTarget, rewardsSum);
return (totalRedeemed, debtToRemove, escrowToLiquidate, debtBalance);
}
}
}
// SIP-252
// calculates the amount of SNX that can be force liquidated (redeemed)
// for the various cases of transferrable & escrowed collateral
function _redeemableCollateralForTarget(
address account,
uint redeemTarget,
uint rewardsSum
) internal view returns (uint totalRedeemed, uint escrowToLiquidate) {
// The balanceOf here can be considered "transferable" since it's not escrowed,
// and it is the only SNX that can potentially be transfered if unstaked.
uint transferable = _snxBalanceOf(account);
if (redeemTarget.add(rewardsSum) <= transferable) {
// transferable is enough
return (redeemTarget, 0);
} else {
// if transferable is not enough
// need only part of the escrow, add the needed part to redeemed
escrowToLiquidate = redeemTarget.add(rewardsSum).sub(transferable);
return (redeemTarget, escrowToLiquidate);
}
}
function _getMinValue(uint x, uint y) internal pure returns (uint) {
return x < y ? x : y;
}
function setCurrentPeriodId(uint128 periodId) external {
require(msg.sender == requireAndGetAddress(CONTRACT_FEEPOOL), "Must be fee pool");
ISynthetixDebtShare sds = synthetixDebtShare();
if (sds.currentPeriodId() < periodId) {
sds.takeSnapshot(periodId);
}
}
/* ========== INTERNAL FUNCTIONS ========== */
function _requireRatesNotInvalid(bool anyRateIsInvalid) internal pure {
require(!anyRateIsInvalid, "A synth or SNX rate is invalid");
}
function _requireCanIssueOnBehalf(address issueForAddress, address from) internal view {
require(delegateApprovals().canIssueFor(issueForAddress, from), "Not approved to act on behalf");
}
function _requireCanBurnOnBehalf(address burnForAddress, address from) internal view {
require(delegateApprovals().canBurnFor(burnForAddress, from), "Not approved to act on behalf");
}
function _issueSynths(
address from,
uint amount,
bool issueMax
) internal {
if (_verifyCircuitBreakers()) {
return;
}
(uint maxIssuable, , , bool anyRateIsInvalid) = _remainingIssuableSynths(from);
_requireRatesNotInvalid(anyRateIsInvalid);
if (!issueMax) {
require(amount <= maxIssuable, "Amount too large");
} else {
amount = maxIssuable;
}
// Keep track of the debt they're about to create
_addToDebtRegister(from, amount);
// record issue timestamp
_setLastIssueEvent(from);
// Create their synths
synths[sUSD].issue(from, amount);
// Account for the issued debt in the cache
debtCache().updateCachedsUSDDebt(SafeCast.toInt256(amount));
}
function _burnSynths(
address debtAccount,
address burnAccount,
uint amount,
uint existingDebt
) internal returns (uint amountBurnt) {
if (_verifyCircuitBreakers()) {
return 0;
}
// liquidation requires sUSD to be already settled / not in waiting period
// If they're trying to burn more debt than they actually owe, rather than fail the transaction, let's just
// clear their debt and leave them be.
amountBurnt = existingDebt < amount ? existingDebt : amount;
// Remove liquidated debt from the ledger
_removeFromDebtRegister(debtAccount, amountBurnt, existingDebt);
// synth.burn does a safe subtraction on balance (so it will revert if there are not enough synths).
synths[sUSD].burn(burnAccount, amountBurnt);
// Account for the burnt debt in the cache.
debtCache().updateCachedsUSDDebt(-SafeCast.toInt256(amountBurnt));
}
// If burning to target, `amount` is ignored, and the correct quantity of sUSD is burnt to reach the target
// c-ratio, allowing fees to be claimed. In this case, pending settlements will be skipped as the user
// will still have debt remaining after reaching their target.
function _voluntaryBurnSynths(
address from,
uint amount,
bool burnToTarget
) internal {
if (_verifyCircuitBreakers()) {
return;
}
if (!burnToTarget) {
// If not burning to target, then burning requires that the minimum stake time has elapsed.
require(_canBurnSynths(from), "Minimum stake time not reached");
// First settle anything pending into sUSD as burning or issuing impacts the size of the debt pool
(, uint refunded, uint numEntriesSettled) = exchanger().settle(from, sUSD);
if (numEntriesSettled > 0) {
amount = exchanger().calculateAmountAfterSettlement(from, sUSD, amount, refunded);
}
}
(uint existingDebt, , bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_debtShareBalanceOf(from), sUSD);
(uint maxIssuableSynthsForAccount, bool snxRateInvalid) = _maxIssuableSynths(from);
_requireRatesNotInvalid(anyRateIsInvalid || snxRateInvalid);
require(existingDebt > 0, "No debt to forgive");
if (burnToTarget) {
amount = existingDebt.sub(maxIssuableSynthsForAccount);
}
uint amountBurnt = _burnSynths(from, from, amount, existingDebt);
// Check and remove liquidation if existingDebt after burning is <= maxIssuableSynths
// Issuance ratio is fixed so should remove any liquidations
if (existingDebt.sub(amountBurnt) <= maxIssuableSynthsForAccount) {
liquidator().removeAccountInLiquidation(from);
}
}
function _setLastIssueEvent(address account) internal {
// Set the timestamp of the last issueSynths
flexibleStorage().setUIntValue(
CONTRACT_NAME,
keccak256(abi.encodePacked(LAST_ISSUE_EVENT, account)),
block.timestamp
);
}
function _addToDebtRegister(address from, uint amount) internal {
// important: this has to happen before any updates to user's debt shares
liquidatorRewards().updateEntry(from);
ISynthetixDebtShare sds = synthetixDebtShare();
// it is possible (eg in tests, system initialized with extra debt) to have issued debt without any shares issued
// in which case, the first account to mint gets the debt. yw.
uint debtShares = _sharesForDebt(amount);
if (debtShares == 0) {
sds.mintShare(from, amount);
} else {
sds.mintShare(from, debtShares);
}
}
function _removeFromDebtRegister(
address from,
uint debtToRemove,
uint existingDebt
) internal {
// important: this has to happen before any updates to user's debt shares
liquidatorRewards().updateEntry(from);
ISynthetixDebtShare sds = synthetixDebtShare();
uint currentDebtShare = _debtShareBalanceOf(from);
if (debtToRemove == existingDebt) {
sds.burnShare(from, currentDebtShare);
} else {
uint sharesToRemove = _sharesForDebt(debtToRemove);
sds.burnShare(from, sharesToRemove < currentDebtShare ? sharesToRemove : currentDebtShare);
}
}
// trips the breaker and returns boolean, where true means the breaker has tripped state
function _verifyCircuitBreakers() internal returns (bool) {
address debtRatioAggregator = requireAndGetAddress(CONTRACT_EXT_AGGREGATOR_DEBT_RATIO);
(, int256 rawRatio, , , ) = AggregatorV2V3Interface(debtRatioAggregator).latestRoundData();
(, bool broken, ) = exchangeRates().rateWithSafetyChecks(SNX);
return circuitBreaker().probeCircuitBreaker(debtRatioAggregator, uint(rawRatio)) || broken;
}
/* ========== MODIFIERS ========== */
modifier onlySynthetix() {
require(msg.sender == address(synthetixERC20()), "Only Synthetix");
_;
}
modifier onlyTrustedMinters() {
address bridgeL1 = resolver.getAddress(CONTRACT_SYNTHETIXBRIDGETOOPTIMISM);
address bridgeL2 = resolver.getAddress(CONTRACT_SYNTHETIXBRIDGETOBASE);
address feePool = resolver.getAddress(CONTRACT_FEEPOOL);
require(msg.sender == bridgeL1 || msg.sender == bridgeL2 || msg.sender == feePool, "only trusted minters");
_;
}
modifier onlyTrustedMigrators() {
address migratorL1 = resolver.getAddress(CONTRACT_DEBT_MIGRATOR_ON_ETHEREUM);
address migratorL2 = resolver.getAddress(CONTRACT_DEBT_MIGRATOR_ON_OPTIMISM);
require(msg.sender == migratorL1 || msg.sender == migratorL2, "only trusted migrators");
require(migratorL1 == address(0) || migratorL2 == address(0), "one migrator must be 0x0");
_;
}
function _onlySynthRedeemer() internal view {
require(
msg.sender == address(synthRedeemer()) || msg.sender == resolver.getAddress(CONTRACT_DYNAMICSYNTHREDEEMER),
"Only SynthRedeemer"
);
}
modifier onlySynthRedeemer() {
_onlySynthRedeemer();
_;
}
/* ========== EVENTS ========== */
event SynthAdded(bytes32 currencyKey, address synth);
event SynthRemoved(bytes32 currencyKey, address synth);
}Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_resolver","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"CacheUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"synth","type":"address"}],"name":"SynthAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"synth","type":"address"}],"name":"SynthRemoved","type":"event"},{"constant":true,"inputs":[],"name":"CONTRACT_NAME","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ISynth","name":"synth","type":"address"}],"name":"addSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ISynth[]","name":"synthsToAdd","type":"address[]"}],"name":"addSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"allNetworksDebtInfo","outputs":[{"internalType":"uint256","name":"debt","type":"uint256"},{"internalType":"uint256","name":"sharesSupply","type":"uint256"},{"internalType":"bool","name":"isStale","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"anySynthOrSNXRateIsInvalid","outputs":[{"internalType":"bool","name":"anyRateInvalid","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"availableCurrencyKeys","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"availableSynthCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"availableSynths","outputs":[{"internalType":"contract ISynth","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"uint256","name":"amountOfSynth","type":"uint256"},{"internalType":"uint256","name":"amountInsUSD","type":"uint256"}],"name":"burnAndIssueSynthsWithoutDebtCache","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"deprecatedSynthProxy","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"burnForRedemption","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"burnForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"burnSynthsToTarget","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"burnForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"}],"name":"burnSynthsToTargetOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnSynthsWithoutDebt","outputs":[{"internalType":"bool","name":"rateInvalid","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"canBurnSynths","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"collateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"collateralisationRatio","outputs":[{"internalType":"uint256","name":"cratio","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"collateralisationRatioAndAnyRatesInvalid","outputs":[{"internalType":"uint256","name":"cratio","type":"uint256"},{"internalType":"bool","name":"anyRateIsInvalid","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"debtBalanceOf","outputs":[{"internalType":"uint256","name":"debtBalance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32[]","name":"currencyKeys","type":"bytes32[]"}],"name":"getSynths","outputs":[{"internalType":"contract ISynth[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isResolverCached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"issuanceRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"issueMaxSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"issueForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"}],"name":"issueMaxSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issueSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"issueForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issueSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issueSynthsWithoutDebt","outputs":[{"internalType":"bool","name":"rateInvalid","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"lastIssueEvent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"isSelfLiquidation","type":"bool"}],"name":"liquidateAccount","outputs":[{"internalType":"uint256","name":"totalRedeemed","type":"uint256"},{"internalType":"uint256","name":"debtRemoved","type":"uint256"},{"internalType":"uint256","name":"escrowToLiquidate","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"isSelfLiquidation","type":"bool"}],"name":"liquidationAmounts","outputs":[{"internalType":"uint256","name":"totalRedeemed","type":"uint256"},{"internalType":"uint256","name":"debtToRemove","type":"uint256"},{"internalType":"uint256","name":"escrowToLiquidate","type":"uint256"},{"internalType":"uint256","name":"initialDebtBalance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"maxIssuableSynths","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minimumStakeTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"modifyDebtSharesForMigration","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebuildCache","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"remainingIssuableSynths","outputs":[{"internalType":"uint256","name":"maxIssuable","type":"uint256"},{"internalType":"uint256","name":"alreadyIssued","type":"uint256"},{"internalType":"uint256","name":"totalSystemDebt","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"removeSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32[]","name":"currencyKeys","type":"bytes32[]"}],"name":"removeSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"resolver","outputs":[{"internalType":"contract AddressResolver","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"resolverAddressesRequired","outputs":[{"internalType":"bytes32[]","name":"addresses","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint128","name":"periodId","type":"uint128"}],"name":"setCurrentPeriodId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"synths","outputs":[{"internalType":"contract ISynth","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"synthsByAddress","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"bool","name":"excludeOtherCollateral","type":"bool"}],"name":"totalIssuedSynths","outputs":[{"internalType":"uint256","name":"totalIssued","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"transferableSynthetixAndAnyRateIsInvalid","outputs":[{"internalType":"uint256","name":"transferable","type":"uint256"},{"internalType":"bool","name":"anyRateIsInvalid","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b50604051620060d7380380620060d78339810160408190526200003491620000fc565b8080836001600160a01b038116620000695760405162461bcd60e51b81526004016200006090620001b8565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0383161781556040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91620000b691849062000192565b60405180910390a150600280546001600160a01b0319166001600160a01b03929092169190911790555062000213915050565b8051620000f681620001f9565b92915050565b600080604083850312156200011057600080fd5b60006200011e8585620000e9565b92505060206200013185828601620000e9565b9150509250929050565b6200014681620001e5565b82525050565b6200014681620001d3565b600062000166601983620001ca565b7f4f776e657220616464726573732063616e6e6f74206265203000000000000000815260200192915050565b60408101620001a282856200013b565b620001b160208301846200014c565b9392505050565b60208082528101620000f68162000157565b90815260200190565b60006001600160a01b038216620000f6565b6000620000f6826000620000f682620001d3565b6200020481620001d3565b81146200021057600080fd5b50565b615eb480620002236000396000f3fe608060405234801561001057600080fd5b50600436106102bb5760003560e01c806372c6581611610182578063a311c7c2116100e9578063c81ff8fa116100a2578063d686c06c1161007c578063d686c06c1461061d578063dbf6334014610630578063dd3d2b2e14610638578063fd864ccf1461064b576102bb565b8063c81ff8fa146105e4578063c8977132146105f7578063d37c4d8b1461060a576102bb565b8063a311c7c21461057d578063a5fdc5de14610590578063ae3bbbbb146105a3578063b06e8c65146105b6578063b410a034146105c9578063bff4fdfc146105d1576102bb565b8063835e119c1161013b578063835e119c14610521578063849cf58814610534578063890235d414610547578063899ffef41461055a5780638da5cb5b146105625780639a5154b41461056a576102bb565b806372c65816146104c357806372cb051f146104d657806374185360146104eb57806379ba5097146104f35780637b1001b7146104fb57806380aa6a911461050e576102bb565b806331e6da5a116102265780634e99bda9116101df5780634e99bda91461044757806353a47bb71461044f5780635e887fe914610464578063614d08f8146104875780636bed04151461048f5780637168d2c2146104b0576102bb565b806331e6da5a146103c857806332608039146103db5780633b6afe40146103ee57806344ec6b621461040e57806347a9b6db14610421578063497d704a14610434576102bb565b80631313e6ca116102785780631313e6ca1461035b5780631627540c1461037257806316b2213f14610385578063242df9e1146103985780632af64bd3146103a05780632b3f41aa146103b5576102bb565b8063042e0688146102c057806304f3bcec146102d557806305b3c1c9146102f35780630b887dae146103135780630d969cf5146103265780631137aedf14610339575b600080fd5b6102d36102ce366004614d6c565b61065e565b005b6102dd6106cf565b6040516102ea9190615aeb565b60405180910390f35b610306610301366004614c79565b6106de565b6040516102ea9190615a37565b6102d3610321366004614ea4565b6106f2565b6102d3610334366004614d9c565b6107d0565b61034c610347366004614c79565b610963565b6040516102ea93929190615a61565b61036361097f565b6040516102ea93929190615cd4565b6102d3610380366004614c79565b610a26565b610306610393366004614c79565b610a84565b610306610a96565b6103a8610aa6565b6040516102ea9190615a29565b6102d36103c3366004614cb5565b610bbd565b6102d36103d6366004614f5c565b610c0c565b6102dd6103e9366004614ea4565b610d47565b6104016103fc366004614dfd565b610d62565b6040516102ea9190615a18565b6102d361041c366004614cef565b610e10565b6102d361042f366004614dfd565b610e63565b6102d3610442366004614c79565b610f14565b6103a8610f5c565b610457610fee565b6040516102ea9190615944565b610477610472366004614d3c565b610ffd565b6040516102ea9493929190615cfc565b61030661101f565b6104a261049d366004614d6c565b61102c565b6040516102ea929190615cc6565b6102d36104be366004614dfd565b611098565b61034c6104d1366004614d3c565b6111cd565b6104de61133f565b6040516102ea9190615a07565b6102d361134b565b6102d361149d565b610306610509366004614f01565b611539565b6102d361051c366004614d6c565b611545565b6102dd61052f366004614ea4565b611930565b6102d3610542366004614f20565b611957565b6103a8610555366004614ee0565b6119ca565b6104de611d50565b610457612026565b6102d3610578366004614cef565b612035565b61030661058b366004614c79565b612083565b61030661059e366004614c79565b612095565b6104a26105b1366004614c79565b6120a0565b6102d36105c4366004614d6c565b6120b6565b6103066120fa565b6103a86105df366004614c79565b612104565b6103a86105f2366004614ee0565b61210f565b6102d3610605366004614c79565b6124d5565b610306610618366004614d6c565b61251a565b6102d361062b366004614cef565b61254c565b6103066125f2565b610306610646366004614c79565b6125f8565b6102d3610659366004614cb5565b612603565b610666612652565b6001600160a01b0316336001600160a01b03161461069f5760405162461bcd60e51b815260040161069690615b98565b60405180910390fd5b600081116106bf5760405162461bcd60e51b815260040161069690615c58565b6106cb82826000612669565b5050565b6002546001600160a01b031681565b6000806106ea83612793565b509392505050565b6106fa6127e6565b6000610704612812565b604051636b42ba1d60e11b81529091506001600160a01b0382169063d685743a90610736908590600090600401615a89565b600060405180830381600087803b15801561075057600080fd5b505af1158015610764573d6000803e3d6000fd5b50506040516304bd11e560e01b81526001600160a01b03841692506304bd11e5915061079590600190600401615a29565b600060405180830381600087803b1580156107af57600080fd5b505af11580156107c3573d6000803e3d6000fd5b505050506106cb82612829565b6107d8612cd7565b6107e0612dc1565b6001600160a01b0316631b16802c85856040518363ffffffff1660e01b815260040161080d929190615988565b606060405180830381600087803b15801561082757600080fd5b505af115801561083b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061085f919081019061504f565b50505060008381526005602052604090819020549051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906108a19087908690600401615988565b600060405180830381600087803b1580156108bb57600080fd5b505af11580156108cf573d6000803e3d6000fd5b505050506108dc84612dd8565b631cd554d160e21b6000526005602052600080516020615e528339815191525460405163219e412d60e21b81526001600160a01b039091169063867904b49061092b9087908590600401615988565b600060405180830381600087803b15801561094557600080fd5b505af1158015610959573d6000803e3d6000fd5b5050505050505050565b600080600061097184612e51565b509196909550909350915050565b60008060008060006109b86109b37f6578743a41676772656761746f7249737375656453796e746873000000000000612ec1565b612f1e565b509350509250506000806109ca612fa9565b91509150839650816000146109ee576109e9878363ffffffff612fe416565b6109f1565b60005b955060006109fd613004565b90504281108015610a1a5750838142031180610a1a575081814203115b95505050505050909192565b610a2e6127e6565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290610a79908390615944565b60405180910390a150565b60066020526000908152604090205481565b6000610aa06130ae565b90505b90565b60006060610ab2611d50565b905060005b8151811015610bb4576000828281518110610ace57fe5b602090810291909101810151600081815260039092526040918290205460025492516321f8a72160e01b81529193506001600160a01b039081169216906321f8a72190610b1f908590600401615a37565b60206040518083038186803b158015610b3757600080fd5b505afa158015610b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b6f9190810190614c97565b6001600160a01b0316141580610b9a57506000818152600360205260409020546001600160a01b0316155b15610bab5760009350505050610aa3565b50600101610ab7565b50600191505090565b610bc5612652565b6001600160a01b0316336001600160a01b031614610bf55760405162461bcd60e51b815260040161069690615b98565b610bff8282613109565b6106cb82600060016131aa565b610c1f66119959541bdbdb60ca1b612ec1565b6001600160a01b0316336001600160a01b031614610c4f5760405162461bcd60e51b815260040161069690615bb8565b6000610c5961341c565b9050816001600160801b0316816001600160a01b031663988e65956040518163ffffffff1660e01b815260040160206040518083038186803b158015610c9e57600080fd5b505afa158015610cb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610cd69190810190614f7a565b6001600160801b031610156106cb5760405163abb6de9560e01b81526001600160a01b0382169063abb6de9590610d11908590600401615cb8565b600060405180830381600087803b158015610d2b57600080fd5b505af1158015610d3f573d6000803e3d6000fd5b505050505050565b6005602052600090815260409020546001600160a01b031681565b60408051828152602080840282010190915260609082908290828015610d92578160200160208202803883390190505b50905060005b82811015610e055760056000878784818110610db057fe5b90506020020135815260200190815260200160002060009054906101000a90046001600160a01b0316828281518110610de557fe5b6001600160a01b0390921660209283029190910190910152600101610d98565b509150505b92915050565b610e18612652565b6001600160a01b0316336001600160a01b031614610e485760405162461bcd60e51b815260040161069690615b98565b610e52838361343c565b610e5e83826000612669565b505050565b610e6b6127e6565b8060005b81811015610ea857610ea0848483818110610e8657fe5b9050602002016020610e9b9190810190614f20565b613471565b600101610e6f565b50610eb1612812565b6001600160a01b03166304bd11e560016040518263ffffffff1660e01b8152600401610edd9190615a29565b600060405180830381600087803b158015610ef757600080fd5b505af1158015610f0b573d6000803e3d6000fd5b50505050505050565b610f1c612652565b6001600160a01b0316336001600160a01b031614610f4c5760405162461bcd60e51b815260040161069690615b98565b610f5981600060016131aa565b50565b6000610f66613602565b6001600160a01b031663c8e5bbd5610f7e600161361d565b6040518263ffffffff1660e01b8152600401610f9a9190615a07565b60006040518083038186803b158015610fb257600080fd5b505afa158015610fc6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e0a9190810190614e3f565b6001546001600160a01b031681565b60008060008061100d86866136f9565b93509350935093505b92959194509250565b6524b9b9bab2b960d11b81565b600080600061104961103d86613aa7565b620a69cb60eb1b613b2c565b93509091506000905061106a61105d613b9d565b839063ffffffff613bf516565b905084811061107c576000935061108f565b61108c858263ffffffff613c0a16565b93505b50509250929050565b6110a06127e6565b8060006110ab612812565b90506060826040519080825280602002602001820160405280156110d9578160200160208202803883390190505b506040516305ece36d60e21b81529091506001600160a01b038316906317b38db49061110d908890889086906004016159e1565b600060405180830381600087803b15801561112757600080fd5b505af115801561113b573d6000803e3d6000fd5b50506040516304bd11e560e01b81526001600160a01b03851692506304bd11e5915061116c90600190600401615a29565b600060405180830381600087803b15801561118657600080fd5b505af115801561119a573d6000803e3d6000fd5b506000925050505b83811015610d3f576111c58686838181106111b957fe5b90506020020135612829565b6001016111a2565b60008060006111da612652565b6001600160a01b0316336001600160a01b03161461120a5760405162461bcd60e51b815260040161069690615b98565b611212613c32565b6001600160a01b031663952225f386866040518363ffffffff1660e01b815260040161123f92919061596d565b60206040518083038186803b15801561125757600080fd5b505afa15801561126b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061128f9190810190614e86565b6112ab5760405162461bcd60e51b815260040161069690615bf8565b60006112b786866136f9565b929650909450925090506112cc868483613c4a565b84611337576112d9613c32565b6001600160a01b031663974e9e7f876040518263ffffffff1660e01b81526004016113049190615944565b600060405180830381600087803b15801561131e57600080fd5b505af1158015611332573d6000803e3d6000fd5b505050505b509250925092565b6060610aa0600061361d565b6060611355611d50565b905060005b81518110156106cb57600082828151811061137157fe5b602002602001015190506000600260009054906101000a90046001600160a01b03166001600160a01b031663dacb2d0183846040516020016113b39190615939565b6040516020818303038152906040526040518363ffffffff1660e01b81526004016113df929190615aa4565b60206040518083038186803b1580156113f757600080fd5b505afa15801561140b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061142f9190810190614c97565b6000838152600360205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa689061148b9084908490615a45565b60405180910390a1505060010161135a565b6001546001600160a01b031633146114c75760405162461bcd60e51b815260040161069690615b28565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9261150a926001600160a01b0391821692911690615952565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60006106ea8383613d81565b6002546040516321f8a72160e01b81526000916001600160a01b0316906321f8a7219061158f9075446562744d69677261746f724f6e457468657265756d60501b90600401615a37565b60206040518083038186803b1580156115a757600080fd5b505afa1580156115bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115df9190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a7219061162e9075446562744d69677261746f724f6e4f7074696d69736d60501b90600401615a37565b60206040518083038186803b15801561164657600080fd5b505afa15801561165a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061167e9190810190614c97565b9050336001600160a01b038316148061169f5750336001600160a01b038216145b6116bb5760405162461bcd60e51b815260040161069690615c68565b6001600160a01b03821615806116d857506001600160a01b038116155b6116f45760405162461bcd60e51b815260040161069690615b18565b60006116fe61341c565b6002546040516321f8a72160e01b81529192506001600160a01b0316906321f8a721906117489075446562744d69677261746f724f6e457468657265756d60501b90600401615a37565b60206040518083038186803b15801561176057600080fd5b505afa158015611774573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506117989190810190614c97565b6001600160a01b0316336001600160a01b0316141561181657604051631a378f0d60e01b81526001600160a01b03821690631a378f0d906117df9088908890600401615988565b600060405180830381600087803b1580156117f957600080fd5b505af115801561180d573d6000803e3d6000fd5b50505050611929565b6002546040516321f8a72160e01b81526001600160a01b03909116906321f8a7219061185f9075446562744d69677261746f724f6e4f7074696d69736d60501b90600401615a37565b60206040518083038186803b15801561187757600080fd5b505afa15801561188b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118af9190810190614c97565b6001600160a01b0316336001600160a01b0316141561192957604051636178258560e11b81526001600160a01b0382169063c2f04b0a906118f69088908890600401615988565b600060405180830381600087803b15801561191057600080fd5b505af1158015611924573d6000803e3d6000fd5b505050505b5050505050565b6004818154811061193d57fe5b6000918252602090912001546001600160a01b0316905081565b61195f6127e6565b61196881613471565b611970612812565b6001600160a01b03166304bd11e560016040518263ffffffff1660e01b815260040161199c9190615a29565b600060405180830381600087803b1580156119b657600080fd5b505af1158015611929573d6000803e3d6000fd5b6002546040516321f8a72160e01b815260009182916001600160a01b03909116906321f8a72190611a1b907853796e746865746978427269646765546f4f7074696d69736d60381b90600401615a37565b60206040518083038186803b158015611a3357600080fd5b505afa158015611a47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611a6b9190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a72190611ab9907453796e746865746978427269646765546f4261736560581b90600401615a37565b60206040518083038186803b158015611ad157600080fd5b505afa158015611ae5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b099190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a72190611b499066119959541bdbdb60ca1b90600401615a37565b60206040518083038186803b158015611b6157600080fd5b505afa158015611b75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b999190810190614c97565b9050336001600160a01b0384161480611bba5750336001600160a01b038316145b80611bcd5750336001600160a01b038216145b611be95760405162461bcd60e51b815260040161069690615b38565b6000878152600560205260409020546001600160a01b0316611c1d5760405162461bcd60e51b815260040161069690615bd8565b60008511611c3d5760405162461bcd60e51b815260040161069690615c58565b611c4686612dd8565b6000878152600560205260409081902054905163219e412d60e21b81526001600160a01b039091169063867904b490611c859089908990600401615988565b600060405180830381600087803b158015611c9f57600080fd5b505af1158015611cb3573d6000803e3d6000fd5b50505050600080611cc389613f0c565b91509150611ccf612812565b6001600160a01b03166342c7b819611cf5611cf08a8663ffffffff613f9116565b613fbb565b6040518263ffffffff1660e01b8152600401611d119190615a37565b600060405180830381600087803b158015611d2b57600080fd5b505af1158015611d3f573d6000803e3d6000fd5b50929b9a5050505050505050505050565b606080611d5b613fe4565b60408051600f808252610200820190925291925060609190602082016101e080388339019050509050680a6f2dce8d0cae8d2f60bb1b81600081518110611d9e57fe5b6020026020010181815250506822bc31b430b733b2b960b91b81600181518110611dc457fe5b6020026020010181815250506c45786368616e6765526174657360981b81600281518110611dee57fe5b6020026020010181815250506d21b4b931bab4ba213932b0b5b2b960911b81600381518110611e1957fe5b6020026020010181815250507153796e74686574697844656274536861726560701b81600481518110611e4857fe5b60200260200101818152505066119959541bdbdb60ca1b81600581518110611e6c57fe5b6020026020010181815250507044656c6567617465417070726f76616c7360781b81600681518110611e9a57fe5b6020026020010181815250506d2932bbb0b93222b9b1b937bbab1960911b81600781518110611ec557fe5b602002602001018181525050692634b8bab4b230ba37b960b11b81600881518110611eec57fe5b602002602001018181525050704c697175696461746f725265776172647360781b81600981518110611f1a57fe5b6020026020010181815250506844656274436163686560b81b81600a81518110611f4057fe5b6020026020010181815250506c29bcb73a342932b232b2b6b2b960991b81600b81518110611f6a57fe5b60200260200101818152505073223cb730b6b4b1a9bcb73a342932b232b2b6b2b960611b81600c81518110611f9b57fe5b6020026020010181815250507f6578743a41676772656761746f7249737375656453796e74687300000000000081600d81518110611fd557fe5b602002602001018181525050766578743a41676772656761746f7244656274526174696f60481b81600e8151811061200957fe5b60200260200101818152505061201f8282614035565b9250505090565b6000546001600160a01b031681565b61203d612652565b6001600160a01b0316336001600160a01b03161461206d5760405162461bcd60e51b815260040161069690615b98565b6120778383613109565b610e5e838260006131aa565b600061208e826140ea565b5092915050565b6000610e0a82614140565b6000806120ac836140ea565b915091505b915091565b6120be612652565b6001600160a01b0316336001600160a01b0316146120ee5760405162461bcd60e51b815260040161069690615b98565b6106cb828260006131aa565b6000610aa0613b9d565b6000610e0a826141dc565b6002546040516321f8a72160e01b815260009182916001600160a01b03909116906321f8a72190612160907853796e746865746978427269646765546f4f7074696d69736d60381b90600401615a37565b60206040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121b09190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a721906121fe907453796e746865746978427269646765546f4261736560581b90600401615a37565b60206040518083038186803b15801561221657600080fd5b505afa15801561222a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061224e9190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a7219061228e9066119959541bdbdb60ca1b90600401615a37565b60206040518083038186803b1580156122a657600080fd5b505afa1580156122ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506122de9190810190614c97565b9050336001600160a01b03841614806122ff5750336001600160a01b038316145b806123125750336001600160a01b038216145b61232e5760405162461bcd60e51b815260040161069690615b38565b6000878152600560205260409020546001600160a01b03166123625760405162461bcd60e51b815260040161069690615bd8565b600085116123825760405162461bcd60e51b815260040161069690615c58565b61238a612dc1565b6001600160a01b0316631b16802c87896040518363ffffffff1660e01b81526004016123b7929190615988565b606060405180830381600087803b1580156123d157600080fd5b505af11580156123e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612409919081019061504f565b50505060008781526005602052604090819020549051632770a7eb60e21b81526001600160a01b0390911690639dc29fac9061244b9089908990600401615988565b600060405180830381600087803b15801561246557600080fd5b505af1158015612479573d6000803e3d6000fd5b5050505060008061248989613f0c565b91509150612495612812565b6001600160a01b03166342c7b8196124b6611cf08a8663ffffffff613f9116565b6000036040518263ffffffff1660e01b8152600401611d119190615a37565b6124dd612652565b6001600160a01b0316336001600160a01b03161461250d5760405162461bcd60e51b815260040161069690615b98565b610f598160006001612669565b60008061252684613aa7565b905080612537576000915050610e0a565b6125418184613b2c565b509095945050505050565b612554612cd7565b826001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b15801561258d57600080fd5b505afa1580156125a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506125c59190810190614c97565b6001600160a01b0316639dc29fac83836040518363ffffffff1660e01b8152600401610edd929190615988565b60045490565b6000610e0a826141fb565b61260b612652565b6001600160a01b0316336001600160a01b03161461263b5760405162461bcd60e51b815260040161069690615b98565b612645828261343c565b6106cb8260006001612669565b6000610aa0680a6f2dce8d0cae8d2f60bb1b612ec1565b612671614274565b1561267b57610e5e565b60008061268785612e51565b9350505091506126968161443d565b826126c057818411156126bb5760405162461bcd60e51b815260040161069690615b78565b6126c4565b8193505b6126ce858561445b565b6126d785612dd8565b631cd554d160e21b6000526005602052600080516020615e528339815191525460405163219e412d60e21b81526001600160a01b039091169063867904b4906127269088908890600401615988565b600060405180830381600087803b15801561274057600080fd5b505af1158015612754573d6000803e3d6000fd5b50505050612760612812565b6001600160a01b03166342c7b81961277786613fbb565b6040518263ffffffff1660e01b81526004016118f69190615a37565b6000806000806127a8620a69cb60eb1b613f0c565b9150915060006127c06127ba87614140565b84614577565b90506127da6127cd613b9d565b829063ffffffff613f9116565b94509092505050915091565b6000546001600160a01b031633146128105760405162461bcd60e51b815260040161069690615c08565b565b6000610aa06844656274436163686560b81b612ec1565b6000818152600560205260409020546001600160a01b03168061285e5760405162461bcd60e51b815260040161069690615be8565b631cd554d160e21b8214156128855760405162461bcd60e51b815260040161069690615c38565b6000816001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156128c057600080fd5b505afa1580156128d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128f89190810190614ec2565b90508015612b7a5760008061290b613602565b6001600160a01b0316638295016a86856040518363ffffffff1660e01b8152600401612938929190615ac4565b60606040518083038186803b15801561295057600080fd5b505afa158015612964573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612988919081019061504f565b5091509150600081116129ad5760405162461bcd60e51b815260040161069690615ca8565b60006129b7614589565b631cd554d160e21b6000526005602052600080516020615e528339815191525460405163219e412d60e21b81529192506001600160a01b03169063867904b490612a079084908790600401615988565b600060405180830381600087803b158015612a2157600080fd5b505af1158015612a35573d6000803e3d6000fd5b50505050612a41612812565b6001600160a01b03166342c7b819612a5885613fbb565b6040518263ffffffff1660e01b8152600401612a749190615a37565b600060405180830381600087803b158015612a8e57600080fd5b505af1158015612aa2573d6000803e3d6000fd5b50505050806001600160a01b0316633a70599c866001600160a01b031663ec5568896040518163ffffffff1660e01b815260040160206040518083038186803b158015612aee57600080fd5b505afa158015612b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612b269190810190614f3e565b846040518363ffffffff1660e01b8152600401612b44929190615af9565b600060405180830381600087803b158015612b5e57600080fd5b505af1158015612b72573d6000803e3d6000fd5b505050505050505b60005b600454811015612c6157826001600160a01b031660048281548110612b9e57fe5b6000918252602090912001546001600160a01b03161415612c595760048181548110612bc657fe5b600091825260209091200180546001600160a01b0319169055600480546000198101908110612bf157fe5b600091825260209091200154600480546001600160a01b039092169183908110612c1757fe5b600091825260209091200180546001600160a01b0319166001600160a01b03929092169190911790556004805490612c53906000198301614b06565b50612c61565b600101612b7d565b506001600160a01b038216600090815260066020908152604080832083905585835260059091529081902080546001600160a01b0319169055517f6166f5c475cc1cd535c6cdf14a6d5edb811e34117031fc2863392a136eb655d090612cca9085908590615a45565b60405180910390a1505050565b612cdf614589565b6001600160a01b0316336001600160a01b03161480612da557506002546040516321f8a72160e01b81526001600160a01b03909116906321f8a72190612d409073223cb730b6b4b1a9bcb73a342932b232b2b6b2b960611b90600401615a37565b60206040518083038186803b158015612d5857600080fd5b505afa158015612d6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612d909190810190614c97565b6001600160a01b0316336001600160a01b0316145b6128105760405162461bcd60e51b815260040161069690615c48565b6000610aa06822bc31b430b733b2b960b91b612ec1565b612de06145a4565b6001600160a01b0316631d5b277f6524b9b9bab2b960d11b6d1b185cdd125cdcdd59515d995b9d60921b84604051602001612e1c9291906158f3565b60405160208183030381529060405280519060200120426040518463ffffffff1660e01b815260040161199c93929190615a61565b600080600080612e70612e6386613aa7565b631cd554d160e21b613b2c565b91945092509050600080612e8387612793565b915091508195508280612e935750805b9250858510612ea55760009550612eb8565b612eb5868663ffffffff613c0a16565b95505b50509193509193565b60008181526003602090815260408083205490516001600160a01b039091169182151591612ef191869101615919565b6040516020818303038152906040529061208e5760405162461bcd60e51b81526004016106969190615b07565b6000806000806000856001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015612f5f57600080fd5b505afa158015612f73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612f979190810190615092565b939a9299509097509550909350915050565b600080600080612fd56109b3766578743a41676772656761746f7244656274526174696f60481b612ec1565b50919650909450505050509091565b6000612ffd83836b033b2e3c9fd0803ce80000006145c1565b9392505050565b600061300e6145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6e1c985d1954dd185b1954195c9a5bd9608a1b6040518363ffffffff1660e01b815260040161305e929190615a53565b60206040518083038186803b15801561307657600080fd5b505afa15801561308a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610aa09190810190614ec2565b60006130b86145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6f6d696e696d756d5374616b6554696d6560801b6040518363ffffffff1660e01b815260040161305e929190615a53565b613111614605565b6001600160a01b0316637d3f0ba283836040518363ffffffff1660e01b815260040161313e929190615952565b60206040518083038186803b15801561315657600080fd5b505afa15801561316a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061318e9190810190614e86565b6106cb5760405162461bcd60e51b815260040161069690615b48565b6131b2614274565b156131bc57610e5e565b80613319576131ca836141dc565b6131e65760405162461bcd60e51b815260040161069690615c88565b6000806131f1612dc1565b6001600160a01b0316631b16802c86631cd554d160e21b6040518363ffffffff1660e01b8152600401613225929190615988565b606060405180830381600087803b15801561323f57600080fd5b505af1158015613253573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613277919081019061504f565b90935091505080156133165761328b612dc1565b6001600160a01b0316634c268fc886631cd554d160e21b87866040518563ffffffff1660e01b81526004016132c394939291906159a3565b60206040518083038186803b1580156132db57600080fd5b505afa1580156132ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506133139190810190614ec2565b93505b50505b600080613328612e6386613aa7565b925050915060008061333987612793565b9150915061334e83806133495750815b61443d565b6000841161336e5760405162461bcd60e51b815260040161069690615b68565b841561338757613384848363ffffffff613c0a16565b95505b600061339588898988614624565b9050826133a8868363ffffffff613c0a16565b11610959576133b5613c32565b6001600160a01b031663974e9e7f896040518263ffffffff1660e01b81526004016133e09190615944565b600060405180830381600087803b1580156133fa57600080fd5b505af115801561340e573d6000803e3d6000fd5b505050505050505050505050565b6000610aa07153796e74686574697844656274536861726560701b612ec1565b613444614605565b6001600160a01b0316630487261783836040518363ffffffff1660e01b815260040161313e929190615952565b6000816001600160a01b031663dbd06c856040518163ffffffff1660e01b815260040160206040518083038186803b1580156134ac57600080fd5b505afa1580156134c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506134e49190810190614ec2565b6000818152600560205260409020549091506001600160a01b03161561351c5760405162461bcd60e51b815260040161069690615c78565b6001600160a01b038216600090815260066020526040902054156135525760405162461bcd60e51b815260040161069690615c18565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0384166001600160a01b03199182168117909255600083815260056020908152604080832080549094168517909355928152600690925290819020829055517f0a2b6ebf143b3e9fcd67e17748ad315174746100c27228468b2c98c302c62884906135f69083908590615a45565b60405180910390a15050565b6000610aa06c45786368616e6765526174657360981b612ec1565b6060808261362c57600061362f565b60015b60ff1660048054905001604051908082528060200260200182016040528015613662578160200160208202803883390190505b50905060005b6004548110156136c957600660006004838154811061368357fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205482518390839081106136b657fe5b6020908102919091010152600101613668565b508215610e0a576004548151620a69cb60eb1b91839181106136e757fe5b60200260200101818152505092915050565b600080600080600061370d612e6388613aa7565b9193509091506000905080613727620a69cb60eb1b613f0c565b9150915061373b838061334957508161443d565b600088156139195761374b614751565b9050613755613c32565b6001600160a01b031663f557f73c866137766137708e614140565b87614577565b846040518463ffffffff1660e01b815260040161379593929190615a61565b60206040518083038186803b1580156137ad57600080fd5b505afa1580156137c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506137e59190810190614ec2565b965061389d61388f61387983732ad7ccaac0eeb396c3a5fc2b73a885435688c0d563907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801561383557600080fd5b505af4158015613849573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061386d9190810190614ec2565b9063ffffffff6147b216565b6138838a876147d7565b9063ffffffff613f9116565b6138988c6147e9565b6147f3565b97506139096139036138ed83732ad7ccaac0eeb396c3a5fc2b73a885435688c0d563907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801561383557600080fd5b6138f78b87614577565b9063ffffffff61480916565b886147f3565b9650600095506110169350505050565b613921614827565b90506000613938613930614887565b61386d6148dc565b9050600061395e6139588361394c8f614140565b9063ffffffff613c0a16565b86614577565b9050613968613c32565b6001600160a01b031663f557f73c8883866040518463ffffffff1660e01b815260040161399793929190615a61565b60206040518083038186803b1580156139af57600080fd5b505afa1580156139c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506139e79190810190614ec2565b98506000613a40613a3685732ad7ccaac0eeb396c3a5fc2b73a885435688c0d563907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801561383557600080fd5b6138838c896147d7565b9050613a4b8d614140565b613a5b828563ffffffff6147b216565b10613a8a57879950613a708361394c8f614140565b9a50613a7b8d614936565b98506110169650505050505050565b613a958d8285614940565b909b5098506110169650505050505050565b6000613ab161341c565b6001600160a01b03166370a08231836040518263ffffffff1660e01b8152600401613adc9190615944565b60206040518083038186803b158015613af457600080fd5b505afa158015613b08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e0a9190810190614ec2565b6000806000806000613b3c61097f565b92505091508660001415613b5857600094509092509050613b96565b600080613b6488613f0c565b91509150613b8182613b758b61499b565b9063ffffffff613bf516565b96508395508080613b8f5750825b9450505050505b9250925092565b6000613ba76145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6c69737375616e6365526174696f60981b6040518363ffffffff1660e01b815260040161305e929190615a53565b6000612ffd8383670de0b6b3a76400006145c1565b600082821115613c2c5760405162461bcd60e51b815260040161069690615b88565b50900390565b6000610aa0692634b8bab4b230ba37b960b11b612ec1565b613c526149b9565b6001600160a01b031663270fb338846040518263ffffffff1660e01b8152600401613c7d9190615944565b600060405180830381600087803b158015613c9757600080fd5b505af1158015613cab573d6000803e3d6000fd5b505050506000613cb961341c565b90506000613cc685613aa7565b905082841415613cfe57604051631a378f0d60e01b81526001600160a01b03831690631a378f0d906117df9088908590600401615988565b6000613d09856149d8565b9050826001600160a01b0316631a378f0d87848410613d285784613d2a565b835b6040518363ffffffff1660e01b8152600401613d47929190615988565b600060405180830381600087803b158015613d6157600080fd5b505af1158015613d75573d6000803e3d6000fd5b50505050505050505050565b6000806000806000613d91612812565b6001600160a01b0316633a900a2e6040518163ffffffff1660e01b815260040160806040518083038186803b158015613dc957600080fd5b505afa158015613ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613e019190810190614ffa565b935093505092508180613e115750805b935085613eb757600080613e23612812565b6001600160a01b0316632992dba26040518163ffffffff1660e01b8152600401604080518083038186803b158015613e5a57600080fd5b505afa158015613e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613e929190810190614f98565b9092509050613ea7858363ffffffff6147b216565b94508580613eb25750805b955050505b631cd554d160e21b871415613ed15750909250613f059050565b600080613edd89613f0c565b9092509050613ef2858363ffffffff613bf516565b8680613efb5750815b9650965050505050505b9250929050565b600080613f17613602565b6001600160a01b0316630c71cd23846040518263ffffffff1660e01b8152600401613f429190615a37565b604080518083038186803b158015613f5957600080fd5b505afa158015613f6d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506120ac9190810190614f98565b6000670de0b6b3a7640000613fac848463ffffffff614a0a16565b81613fb357fe5b049392505050565b6000600160ff1b8210613fe05760405162461bcd60e51b815260040161069690615c98565b5090565b604080516001808252818301909252606091602080830190803883390190505090506e466c657869626c6553746f7261676560881b8160008151811061402657fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015614065578160200160208202803883390190505b50905060005b83518110156140a75783818151811061408057fe5b602002602001015182828151811061409457fe5b602090810291909101015260010161406b565b5060005b825181101561208e578281815181106140c057fe5b60200260200101518282865101815181106140d757fe5b60209081029190910101526001016140ab565b60008060006140f884614140565b905060008061410961103d87613aa7565b92505091508260001415614125576000945092506120b1915050565b614135828463ffffffff613bf516565b945092505050915091565b6000610e0a61414d6149b9565b6001600160a01b0316628cc262846040518263ffffffff1660e01b81526004016141779190615944565b60206040518083038186803b15801561418f57600080fd5b505afa1580156141a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506141c79190810190614ec2565b61386d6141d385614936565b61386d866147e9565b60006141f26141e96130ae565b61386d846141fb565b42101592915050565b60006142056145a4565b6001600160a01b03166323257c2b6524b9b9bab2b960d11b6d1b185cdd125cdcdd59515d995b9d60921b856040516020016142419291906158f3565b604051602081830303815290604052805190602001206040518363ffffffff1660e01b8152600401613adc929190615a53565b60008061429a766578743a41676772656761746f7244656274526174696f60481b612ec1565b90506000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156142d757600080fd5b505afa1580156142eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061430f9190810190615092565b505050915050600061431f613602565b6001600160a01b031663045056f8620a69cb60eb1b6040518263ffffffff1660e01b81526004016143509190615a37565b606060405180830381600087803b15801561436a57600080fd5b505af115801561437e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506143a29190810190614fb7565b509150506143ae614a44565b6001600160a01b031663413caeb584846040518363ffffffff1660e01b81526004016143db929190615988565b602060405180830381600087803b1580156143f557600080fd5b505af1158015614409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061442d9190810190614e86565b806144355750805b935050505090565b8015610f595760405162461bcd60e51b815260040161069690615bc8565b6144636149b9565b6001600160a01b031663270fb338836040518263ffffffff1660e01b815260040161448e9190615944565b600060405180830381600087803b1580156144a857600080fd5b505af11580156144bc573d6000803e3d6000fd5b5050505060006144ca61341c565b905060006144d7836149d8565b90508061454357604051636178258560e11b81526001600160a01b0383169063c2f04b0a9061450c9087908790600401615988565b600060405180830381600087803b15801561452657600080fd5b505af115801561453a573d6000803e3d6000fd5b50505050614571565b604051636178258560e11b81526001600160a01b0383169063c2f04b0a9061092b9087908590600401615988565b50505050565b6000612ffd838363ffffffff614a6016565b6000610aa06c29bcb73a342932b232b2b6b2b960991b612ec1565b6000610aa06e466c657869626c6553746f7261676560881b612ec1565b6000806145e7846145db87600a870263ffffffff614a0a16565b9063ffffffff614a7516565b90506005600a825b06106145f957600a015b600a9004949350505050565b6000610aa07044656c6567617465417070726f76616c7360781b612ec1565b600061462e614274565b1561463b57506000614749565b828210614648578261464a565b815b9050614657858284613c4a565b631cd554d160e21b6000526005602052600080516020615e5283398151915254604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906146a69087908590600401615988565b600060405180830381600087803b1580156146c057600080fd5b505af11580156146d4573d6000803e3d6000fd5b505050506146e0612812565b6001600160a01b03166342c7b8196146f783613fbb565b6000036040518263ffffffff1660e01b81526004016147169190615a37565b600060405180830381600087803b15801561473057600080fd5b505af1158015614744573d6000803e3d6000fd5b505050505b949350505050565b600061475b6145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7573656c664c69717569646174696f6e50656e616c747960501b6040518363ffffffff1660e01b815260040161305e929190615a53565b600082820183811015612ffd5760405162461bcd60e51b815260040161069690615b58565b6000612ffd838363ffffffff613bf516565b6000613ab1612652565b60008183106148025781612ffd565b5090919050565b6000612ffd826145db85670de0b6b3a764000063ffffffff614a0a16565b60006148316145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b74736e784c69717569646174696f6e50656e616c747960581b6040518363ffffffff1660e01b815260040161305e929190615a53565b60006148916145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b69199b1859d4995dd85c9960b21b6040518363ffffffff1660e01b815260040161305e929190615a53565b60006148e66145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6e1b1a5c5d5a59185d1954995dd85c99608a1b6040518363ffffffff1660e01b815260040161305e929190615a53565b6000613ab1614aaa565b600080600061494e866147e9565b905080614961868663ffffffff6147b216565b11614973575083915060009050614993565b6149878161394c878763ffffffff6147b216565b85935091506149939050565b935093915050565b6000806149a6612fa9565b509050612ffd838263ffffffff614ac616565b6000610aa0704c697175696461746f725265776172647360781b612ec1565b6000806149e3612fa9565b5090508015614a01576149fc838263ffffffff612fe416565b612ffd565b50600092915050565b600082614a1957506000610e0a565b82820282848281614a2657fe5b0414612ffd5760405162461bcd60e51b815260040161069690615c28565b6000610aa06d21b4b931bab4ba213932b0b5b2b960911b612ec1565b6000612ffd8383670de0b6b3a7640000614adb565b6000808211614a965760405162461bcd60e51b815260040161069690615ba8565b6000828481614aa157fe5b04949350505050565b6000610aa06d2932bbb0b93222b9b1b937bbab1960911b612ec1565b6000612ffd83836b033b2e3c9fd0803ce80000005b600080600a8304614af2868663ffffffff614a0a16565b81614af957fe5b0490506005600a826145ef565b815481835581811115610e5e57600083815260209020610e5e918101908301610aa391905b80821115613fe05760008155600101614b2b565b8035610e0a81615e10565b8051610e0a81615e10565b60008083601f840112614b6757600080fd5b50813567ffffffffffffffff811115614b7f57600080fd5b602083019150836020820283011115613f0557600080fd5b600082601f830112614ba857600080fd5b8151614bbb614bb682615d31565b615d0a565b91508181835260208401935060208101905083856020840282011115614be057600080fd5b60005b83811015614c0c5781614bf68882614c37565b8452506020928301929190910190600101614be3565b5050505092915050565b8035610e0a81615e24565b8051610e0a81615e24565b8035610e0a81615e2d565b8051610e0a81615e2d565b8035610e0a81615e36565b8051610e0a81615e36565b8035610e0a81615e3f565b8051610e0a81615e3f565b8051610e0a81615e48565b600060208284031215614c8b57600080fd5b60006147498484614b3f565b600060208284031215614ca957600080fd5b60006147498484614b4a565b60008060408385031215614cc857600080fd5b6000614cd48585614b3f565b9250506020614ce585828601614b3f565b9150509250929050565b600080600060608486031215614d0457600080fd5b6000614d108686614b3f565b9350506020614d2186828701614b3f565b9250506040614d3286828701614c2c565b9150509250925092565b60008060408385031215614d4f57600080fd5b6000614d5b8585614b3f565b9250506020614ce585828601614c16565b60008060408385031215614d7f57600080fd5b6000614d8b8585614b3f565b9250506020614ce585828601614c2c565b60008060008060808587031215614db257600080fd5b6000614dbe8787614b3f565b9450506020614dcf87828801614c2c565b9350506040614de087828801614c2c565b9250506060614df187828801614c2c565b91505092959194509250565b60008060208385031215614e1057600080fd5b823567ffffffffffffffff811115614e2757600080fd5b614e3385828601614b55565b92509250509250929050565b60008060408385031215614e5257600080fd5b825167ffffffffffffffff811115614e6957600080fd5b614e7585828601614b97565b9250506020614ce585828601614c21565b600060208284031215614e9857600080fd5b60006147498484614c21565b600060208284031215614eb657600080fd5b60006147498484614c2c565b600060208284031215614ed457600080fd5b60006147498484614c37565b600080600060608486031215614ef557600080fd5b6000614d108686614c2c565b60008060408385031215614f1457600080fd5b6000614d5b8585614c2c565b600060208284031215614f3257600080fd5b60006147498484614c42565b600060208284031215614f5057600080fd5b60006147498484614c4d565b600060208284031215614f6e57600080fd5b60006147498484614c58565b600060208284031215614f8c57600080fd5b60006147498484614c63565b60008060408385031215614fab57600080fd5b6000614e758585614c37565b600080600060608486031215614fcc57600080fd5b6000614fd88686614c37565b9350506020614fe986828701614c21565b9250506040614d3286828701614c21565b6000806000806080858703121561501057600080fd5b600061501c8787614c37565b945050602061502d87828801614c37565b935050604061503e87828801614c21565b9250506060614df187828801614c21565b60008060006060848603121561506457600080fd5b60006150708686614c37565b935050602061508186828701614c37565b9250506040614d3286828701614c37565b600080600080600060a086880312156150aa57600080fd5b60006150b68888614c6e565b95505060206150c788828901614c37565b94505060406150d888828901614c37565b93505060606150e988828901614c37565b92505060806150fa88828901614c6e565b9150509295509295909350565b6000615113838361527e565b505060200190565b60006151138383615298565b61513081615d6a565b82525050565b61513061514282615d6a565b615def565b60006151538385615d5c565b93506001600160fb1b0383111561516957600080fd5b60208302925061517a838584615db7565b50500190565b600061518b82615d58565b6151958185615d5c565b93506151a083615d52565b8060005b838110156151ce5781516151b88882615107565b97506151c383615d52565b9250506001016151a4565b509495945050505050565b60006151e482615d58565b6151ee8185615d5c565b93506151f983615d52565b8060005b838110156151ce578151615211888261511b565b975061521c83615d52565b9250506001016151fd565b600061523282615d58565b61523c8185615d5c565b935061524783615d52565b8060005b838110156151ce57815161525f8882615107565b975061526a83615d52565b92505060010161524b565b61513081615d75565b61513081610aa3565b61513061529382610aa3565b610aa3565b61513081615d7a565b61513081615dac565b60006152b582615d58565b6152bf8185615d5c565b93506152cf818560208601615dc3565b6152d881615e00565b9093019392505050565b60006152ef601883615d5c565b7f6f6e65206d69677261746f72206d757374206265203078300000000000000000815260200192915050565b6000615328603583615d5c565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b600061537f601483615d5c565b736f6e6c792074727573746564206d696e7465727360601b815260200192915050565b60006153af601d83615d5c565b7f4e6f7420617070726f76656420746f20616374206f6e20626568616c66000000815260200192915050565b60006153e8601b83615d5c565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000615421601283615d5c565b714e6f206465627420746f20666f726769766560701b815260200192915050565b600061544f601083615d5c565b6f416d6f756e7420746f6f206c6172676560801b815260200192915050565b600061547b601e83615d5c565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b60006154b4600e83615d5c565b6d09edcd8f240a6f2dce8d0cae8d2f60931b815260200192915050565b60006154de601a83615d5c565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000815260200192915050565b6000615517601183615d65565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b6000615544601083615d5c565b6f135d5cdd08189948199959481c1bdbdb60821b815260200192915050565b6000615570601e83615d5c565b7f412073796e7468206f7220534e58207261746520697320696e76616c69640000815260200192915050565b60006155a9601383615d5c565b721cde5b9d1a08191bd95cdb89dd08195e1a5cdd606a1b815260200192915050565b60006155d8601483615d5c565b7314de5b9d1a08191bd95cc81b9bdd08195e1a5cdd60621b815260200192915050565b6000615608601883615d5c565b7f4e6f74206f70656e20666f72206c69717569646174696f6e0000000000000000815260200192915050565b6000615641602f83615d5c565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b631cd554d160e21b9052565b600061569e601c83615d5c565b7f53796e7468206164647265737320616c72656164792065786973747300000000815260200192915050565b60006156d7602183615d5c565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b600061571a601383615d5c565b72086c2dcdcdee840e4cadadeecca40e6f2dce8d606b1b815260200192915050565b6000615749601283615d5c565b7127b7363c9029bcb73a342932b232b2b6b2b960711b815260200192915050565b6000615777601583615d5c565b7463616e6e6f7420697373756520302073796e74687360581b815260200192915050565b60006157a8601983615d65565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b60006157e1601683615d5c565b756f6e6c792074727573746564206d69677261746f727360501b815260200192915050565b6000615813600c83615d5c565b6b53796e74682065786973747360a01b815260200192915050565b600061583b601e83615d5c565b7f4d696e696d756d207374616b652074696d65206e6f7420726561636865640000815260200192915050565b6000615874602883615d5c565b7f53616665436173743a2076616c756520646f65736e27742066697420696e2061815267371034b73a191a9b60c11b602082015260400192915050565b60006158be601a83615d5c565b7f43616e6e6f742072656d6f766520776974686f75742072617465000000000000815260200192915050565b61513081615d85565b60006158ff8285615287565b60208201915061590f8284615136565b5060140192915050565b60006159248261550a565b91506159308284615287565b50602001919050565b60006159248261579b565b60208101610e0a8284615127565b604081016159608285615127565b612ffd6020830184615127565b6040810161597b8285615127565b612ffd6020830184615275565b604081016159968285615127565b612ffd602083018461527e565b608081016159b18287615127565b6159be602083018661527e565b6159cb604083018561527e565b6159d8606083018461527e565b95945050505050565b604080825281016159f3818587615147565b905081810360208301526159d88184615227565b60208082528101612ffd8184615180565b60208082528101612ffd81846151d9565b60208101610e0a8284615275565b60208101610e0a828461527e565b60408101615960828561527e565b60408101615996828561527e565b60608101615a6f828661527e565b615a7c602083018561527e565b614749604083018461527e565b60408101615a97828561527e565b612ffd60208301846152a1565b60408101615ab2828561527e565b818103602083015261474981846152aa565b60608101615ad2828561527e565b615adf602083018461527e565b612ffd60408301615685565b60208101610e0a8284615298565b604081016159968285615298565b60208082528101612ffd81846152aa565b60208082528101610e0a816152e2565b60208082528101610e0a8161531b565b60208082528101610e0a81615372565b60208082528101610e0a816153a2565b60208082528101610e0a816153db565b60208082528101610e0a81615414565b60208082528101610e0a81615442565b60208082528101610e0a8161546e565b60208082528101610e0a816154a7565b60208082528101610e0a816154d1565b60208082528101610e0a81615537565b60208082528101610e0a81615563565b60208082528101610e0a8161559c565b60208082528101610e0a816155cb565b60208082528101610e0a816155fb565b60208082528101610e0a81615634565b60208082528101610e0a81615691565b60208082528101610e0a816156ca565b60208082528101610e0a8161570d565b60208082528101610e0a8161573c565b60208082528101610e0a8161576a565b60208082528101610e0a816157d4565b60208082528101610e0a81615806565b60208082528101610e0a8161582e565b60208082528101610e0a81615867565b60208082528101610e0a816158b1565b60208101610e0a82846158ea565b6040810161597b828561527e565b60608101615ce2828661527e565b615cef602083018561527e565b6147496040830184615275565b608081016159b1828761527e565b60405181810167ffffffffffffffff81118282101715615d2957600080fd5b604052919050565b600067ffffffffffffffff821115615d4857600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b919050565b6000610e0a82615d91565b151590565b6000610e0a82615d6a565b6001600160801b031690565b6001600160a01b031690565b69ffffffffffffffffffff1690565b6000610e0a82610aa3565b82818337506000910152565b60005b83811015615dde578181015183820152602001615dc6565b838111156145715750506000910152565b6000610e0a826000610e0a82615e0a565b601f01601f191690565b60601b90565b615e1981615d6a565b8114610f5957600080fd5b615e1981615d75565b615e1981610aa3565b615e1981615d7a565b615e1981615d85565b615e1981615d9d56fe74c62d09fbc50aefae0794a9a068f786a692826fbdfe63828ec23a875865823fa365627a7a72315820160805ca78bb540916fefaeb9c5060d6b370e423bfb95c7cb75099eaad4f23326c6578706572696d656e74616cf564736f6c6343000510004000000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee9000000000000000000000000529c553ef2d0370279dc8abf19702b98b166d252
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102bb5760003560e01c806372c6581611610182578063a311c7c2116100e9578063c81ff8fa116100a2578063d686c06c1161007c578063d686c06c1461061d578063dbf6334014610630578063dd3d2b2e14610638578063fd864ccf1461064b576102bb565b8063c81ff8fa146105e4578063c8977132146105f7578063d37c4d8b1461060a576102bb565b8063a311c7c21461057d578063a5fdc5de14610590578063ae3bbbbb146105a3578063b06e8c65146105b6578063b410a034146105c9578063bff4fdfc146105d1576102bb565b8063835e119c1161013b578063835e119c14610521578063849cf58814610534578063890235d414610547578063899ffef41461055a5780638da5cb5b146105625780639a5154b41461056a576102bb565b806372c65816146104c357806372cb051f146104d657806374185360146104eb57806379ba5097146104f35780637b1001b7146104fb57806380aa6a911461050e576102bb565b806331e6da5a116102265780634e99bda9116101df5780634e99bda91461044757806353a47bb71461044f5780635e887fe914610464578063614d08f8146104875780636bed04151461048f5780637168d2c2146104b0576102bb565b806331e6da5a146103c857806332608039146103db5780633b6afe40146103ee57806344ec6b621461040e57806347a9b6db14610421578063497d704a14610434576102bb565b80631313e6ca116102785780631313e6ca1461035b5780631627540c1461037257806316b2213f14610385578063242df9e1146103985780632af64bd3146103a05780632b3f41aa146103b5576102bb565b8063042e0688146102c057806304f3bcec146102d557806305b3c1c9146102f35780630b887dae146103135780630d969cf5146103265780631137aedf14610339575b600080fd5b6102d36102ce366004614d6c565b61065e565b005b6102dd6106cf565b6040516102ea9190615aeb565b60405180910390f35b610306610301366004614c79565b6106de565b6040516102ea9190615a37565b6102d3610321366004614ea4565b6106f2565b6102d3610334366004614d9c565b6107d0565b61034c610347366004614c79565b610963565b6040516102ea93929190615a61565b61036361097f565b6040516102ea93929190615cd4565b6102d3610380366004614c79565b610a26565b610306610393366004614c79565b610a84565b610306610a96565b6103a8610aa6565b6040516102ea9190615a29565b6102d36103c3366004614cb5565b610bbd565b6102d36103d6366004614f5c565b610c0c565b6102dd6103e9366004614ea4565b610d47565b6104016103fc366004614dfd565b610d62565b6040516102ea9190615a18565b6102d361041c366004614cef565b610e10565b6102d361042f366004614dfd565b610e63565b6102d3610442366004614c79565b610f14565b6103a8610f5c565b610457610fee565b6040516102ea9190615944565b610477610472366004614d3c565b610ffd565b6040516102ea9493929190615cfc565b61030661101f565b6104a261049d366004614d6c565b61102c565b6040516102ea929190615cc6565b6102d36104be366004614dfd565b611098565b61034c6104d1366004614d3c565b6111cd565b6104de61133f565b6040516102ea9190615a07565b6102d361134b565b6102d361149d565b610306610509366004614f01565b611539565b6102d361051c366004614d6c565b611545565b6102dd61052f366004614ea4565b611930565b6102d3610542366004614f20565b611957565b6103a8610555366004614ee0565b6119ca565b6104de611d50565b610457612026565b6102d3610578366004614cef565b612035565b61030661058b366004614c79565b612083565b61030661059e366004614c79565b612095565b6104a26105b1366004614c79565b6120a0565b6102d36105c4366004614d6c565b6120b6565b6103066120fa565b6103a86105df366004614c79565b612104565b6103a86105f2366004614ee0565b61210f565b6102d3610605366004614c79565b6124d5565b610306610618366004614d6c565b61251a565b6102d361062b366004614cef565b61254c565b6103066125f2565b610306610646366004614c79565b6125f8565b6102d3610659366004614cb5565b612603565b610666612652565b6001600160a01b0316336001600160a01b03161461069f5760405162461bcd60e51b815260040161069690615b98565b60405180910390fd5b600081116106bf5760405162461bcd60e51b815260040161069690615c58565b6106cb82826000612669565b5050565b6002546001600160a01b031681565b6000806106ea83612793565b509392505050565b6106fa6127e6565b6000610704612812565b604051636b42ba1d60e11b81529091506001600160a01b0382169063d685743a90610736908590600090600401615a89565b600060405180830381600087803b15801561075057600080fd5b505af1158015610764573d6000803e3d6000fd5b50506040516304bd11e560e01b81526001600160a01b03841692506304bd11e5915061079590600190600401615a29565b600060405180830381600087803b1580156107af57600080fd5b505af11580156107c3573d6000803e3d6000fd5b505050506106cb82612829565b6107d8612cd7565b6107e0612dc1565b6001600160a01b0316631b16802c85856040518363ffffffff1660e01b815260040161080d929190615988565b606060405180830381600087803b15801561082757600080fd5b505af115801561083b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061085f919081019061504f565b50505060008381526005602052604090819020549051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906108a19087908690600401615988565b600060405180830381600087803b1580156108bb57600080fd5b505af11580156108cf573d6000803e3d6000fd5b505050506108dc84612dd8565b631cd554d160e21b6000526005602052600080516020615e528339815191525460405163219e412d60e21b81526001600160a01b039091169063867904b49061092b9087908590600401615988565b600060405180830381600087803b15801561094557600080fd5b505af1158015610959573d6000803e3d6000fd5b5050505050505050565b600080600061097184612e51565b509196909550909350915050565b60008060008060006109b86109b37f6578743a41676772656761746f7249737375656453796e746873000000000000612ec1565b612f1e565b509350509250506000806109ca612fa9565b91509150839650816000146109ee576109e9878363ffffffff612fe416565b6109f1565b60005b955060006109fd613004565b90504281108015610a1a5750838142031180610a1a575081814203115b95505050505050909192565b610a2e6127e6565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290610a79908390615944565b60405180910390a150565b60066020526000908152604090205481565b6000610aa06130ae565b90505b90565b60006060610ab2611d50565b905060005b8151811015610bb4576000828281518110610ace57fe5b602090810291909101810151600081815260039092526040918290205460025492516321f8a72160e01b81529193506001600160a01b039081169216906321f8a72190610b1f908590600401615a37565b60206040518083038186803b158015610b3757600080fd5b505afa158015610b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b6f9190810190614c97565b6001600160a01b0316141580610b9a57506000818152600360205260409020546001600160a01b0316155b15610bab5760009350505050610aa3565b50600101610ab7565b50600191505090565b610bc5612652565b6001600160a01b0316336001600160a01b031614610bf55760405162461bcd60e51b815260040161069690615b98565b610bff8282613109565b6106cb82600060016131aa565b610c1f66119959541bdbdb60ca1b612ec1565b6001600160a01b0316336001600160a01b031614610c4f5760405162461bcd60e51b815260040161069690615bb8565b6000610c5961341c565b9050816001600160801b0316816001600160a01b031663988e65956040518163ffffffff1660e01b815260040160206040518083038186803b158015610c9e57600080fd5b505afa158015610cb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610cd69190810190614f7a565b6001600160801b031610156106cb5760405163abb6de9560e01b81526001600160a01b0382169063abb6de9590610d11908590600401615cb8565b600060405180830381600087803b158015610d2b57600080fd5b505af1158015610d3f573d6000803e3d6000fd5b505050505050565b6005602052600090815260409020546001600160a01b031681565b60408051828152602080840282010190915260609082908290828015610d92578160200160208202803883390190505b50905060005b82811015610e055760056000878784818110610db057fe5b90506020020135815260200190815260200160002060009054906101000a90046001600160a01b0316828281518110610de557fe5b6001600160a01b0390921660209283029190910190910152600101610d98565b509150505b92915050565b610e18612652565b6001600160a01b0316336001600160a01b031614610e485760405162461bcd60e51b815260040161069690615b98565b610e52838361343c565b610e5e83826000612669565b505050565b610e6b6127e6565b8060005b81811015610ea857610ea0848483818110610e8657fe5b9050602002016020610e9b9190810190614f20565b613471565b600101610e6f565b50610eb1612812565b6001600160a01b03166304bd11e560016040518263ffffffff1660e01b8152600401610edd9190615a29565b600060405180830381600087803b158015610ef757600080fd5b505af1158015610f0b573d6000803e3d6000fd5b50505050505050565b610f1c612652565b6001600160a01b0316336001600160a01b031614610f4c5760405162461bcd60e51b815260040161069690615b98565b610f5981600060016131aa565b50565b6000610f66613602565b6001600160a01b031663c8e5bbd5610f7e600161361d565b6040518263ffffffff1660e01b8152600401610f9a9190615a07565b60006040518083038186803b158015610fb257600080fd5b505afa158015610fc6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e0a9190810190614e3f565b6001546001600160a01b031681565b60008060008061100d86866136f9565b93509350935093505b92959194509250565b6524b9b9bab2b960d11b81565b600080600061104961103d86613aa7565b620a69cb60eb1b613b2c565b93509091506000905061106a61105d613b9d565b839063ffffffff613bf516565b905084811061107c576000935061108f565b61108c858263ffffffff613c0a16565b93505b50509250929050565b6110a06127e6565b8060006110ab612812565b90506060826040519080825280602002602001820160405280156110d9578160200160208202803883390190505b506040516305ece36d60e21b81529091506001600160a01b038316906317b38db49061110d908890889086906004016159e1565b600060405180830381600087803b15801561112757600080fd5b505af115801561113b573d6000803e3d6000fd5b50506040516304bd11e560e01b81526001600160a01b03851692506304bd11e5915061116c90600190600401615a29565b600060405180830381600087803b15801561118657600080fd5b505af115801561119a573d6000803e3d6000fd5b506000925050505b83811015610d3f576111c58686838181106111b957fe5b90506020020135612829565b6001016111a2565b60008060006111da612652565b6001600160a01b0316336001600160a01b03161461120a5760405162461bcd60e51b815260040161069690615b98565b611212613c32565b6001600160a01b031663952225f386866040518363ffffffff1660e01b815260040161123f92919061596d565b60206040518083038186803b15801561125757600080fd5b505afa15801561126b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061128f9190810190614e86565b6112ab5760405162461bcd60e51b815260040161069690615bf8565b60006112b786866136f9565b929650909450925090506112cc868483613c4a565b84611337576112d9613c32565b6001600160a01b031663974e9e7f876040518263ffffffff1660e01b81526004016113049190615944565b600060405180830381600087803b15801561131e57600080fd5b505af1158015611332573d6000803e3d6000fd5b505050505b509250925092565b6060610aa0600061361d565b6060611355611d50565b905060005b81518110156106cb57600082828151811061137157fe5b602002602001015190506000600260009054906101000a90046001600160a01b03166001600160a01b031663dacb2d0183846040516020016113b39190615939565b6040516020818303038152906040526040518363ffffffff1660e01b81526004016113df929190615aa4565b60206040518083038186803b1580156113f757600080fd5b505afa15801561140b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061142f9190810190614c97565b6000838152600360205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa689061148b9084908490615a45565b60405180910390a1505060010161135a565b6001546001600160a01b031633146114c75760405162461bcd60e51b815260040161069690615b28565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9261150a926001600160a01b0391821692911690615952565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60006106ea8383613d81565b6002546040516321f8a72160e01b81526000916001600160a01b0316906321f8a7219061158f9075446562744d69677261746f724f6e457468657265756d60501b90600401615a37565b60206040518083038186803b1580156115a757600080fd5b505afa1580156115bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115df9190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a7219061162e9075446562744d69677261746f724f6e4f7074696d69736d60501b90600401615a37565b60206040518083038186803b15801561164657600080fd5b505afa15801561165a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061167e9190810190614c97565b9050336001600160a01b038316148061169f5750336001600160a01b038216145b6116bb5760405162461bcd60e51b815260040161069690615c68565b6001600160a01b03821615806116d857506001600160a01b038116155b6116f45760405162461bcd60e51b815260040161069690615b18565b60006116fe61341c565b6002546040516321f8a72160e01b81529192506001600160a01b0316906321f8a721906117489075446562744d69677261746f724f6e457468657265756d60501b90600401615a37565b60206040518083038186803b15801561176057600080fd5b505afa158015611774573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506117989190810190614c97565b6001600160a01b0316336001600160a01b0316141561181657604051631a378f0d60e01b81526001600160a01b03821690631a378f0d906117df9088908890600401615988565b600060405180830381600087803b1580156117f957600080fd5b505af115801561180d573d6000803e3d6000fd5b50505050611929565b6002546040516321f8a72160e01b81526001600160a01b03909116906321f8a7219061185f9075446562744d69677261746f724f6e4f7074696d69736d60501b90600401615a37565b60206040518083038186803b15801561187757600080fd5b505afa15801561188b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118af9190810190614c97565b6001600160a01b0316336001600160a01b0316141561192957604051636178258560e11b81526001600160a01b0382169063c2f04b0a906118f69088908890600401615988565b600060405180830381600087803b15801561191057600080fd5b505af1158015611924573d6000803e3d6000fd5b505050505b5050505050565b6004818154811061193d57fe5b6000918252602090912001546001600160a01b0316905081565b61195f6127e6565b61196881613471565b611970612812565b6001600160a01b03166304bd11e560016040518263ffffffff1660e01b815260040161199c9190615a29565b600060405180830381600087803b1580156119b657600080fd5b505af1158015611929573d6000803e3d6000fd5b6002546040516321f8a72160e01b815260009182916001600160a01b03909116906321f8a72190611a1b907853796e746865746978427269646765546f4f7074696d69736d60381b90600401615a37565b60206040518083038186803b158015611a3357600080fd5b505afa158015611a47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611a6b9190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a72190611ab9907453796e746865746978427269646765546f4261736560581b90600401615a37565b60206040518083038186803b158015611ad157600080fd5b505afa158015611ae5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b099190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a72190611b499066119959541bdbdb60ca1b90600401615a37565b60206040518083038186803b158015611b6157600080fd5b505afa158015611b75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b999190810190614c97565b9050336001600160a01b0384161480611bba5750336001600160a01b038316145b80611bcd5750336001600160a01b038216145b611be95760405162461bcd60e51b815260040161069690615b38565b6000878152600560205260409020546001600160a01b0316611c1d5760405162461bcd60e51b815260040161069690615bd8565b60008511611c3d5760405162461bcd60e51b815260040161069690615c58565b611c4686612dd8565b6000878152600560205260409081902054905163219e412d60e21b81526001600160a01b039091169063867904b490611c859089908990600401615988565b600060405180830381600087803b158015611c9f57600080fd5b505af1158015611cb3573d6000803e3d6000fd5b50505050600080611cc389613f0c565b91509150611ccf612812565b6001600160a01b03166342c7b819611cf5611cf08a8663ffffffff613f9116565b613fbb565b6040518263ffffffff1660e01b8152600401611d119190615a37565b600060405180830381600087803b158015611d2b57600080fd5b505af1158015611d3f573d6000803e3d6000fd5b50929b9a5050505050505050505050565b606080611d5b613fe4565b60408051600f808252610200820190925291925060609190602082016101e080388339019050509050680a6f2dce8d0cae8d2f60bb1b81600081518110611d9e57fe5b6020026020010181815250506822bc31b430b733b2b960b91b81600181518110611dc457fe5b6020026020010181815250506c45786368616e6765526174657360981b81600281518110611dee57fe5b6020026020010181815250506d21b4b931bab4ba213932b0b5b2b960911b81600381518110611e1957fe5b6020026020010181815250507153796e74686574697844656274536861726560701b81600481518110611e4857fe5b60200260200101818152505066119959541bdbdb60ca1b81600581518110611e6c57fe5b6020026020010181815250507044656c6567617465417070726f76616c7360781b81600681518110611e9a57fe5b6020026020010181815250506d2932bbb0b93222b9b1b937bbab1960911b81600781518110611ec557fe5b602002602001018181525050692634b8bab4b230ba37b960b11b81600881518110611eec57fe5b602002602001018181525050704c697175696461746f725265776172647360781b81600981518110611f1a57fe5b6020026020010181815250506844656274436163686560b81b81600a81518110611f4057fe5b6020026020010181815250506c29bcb73a342932b232b2b6b2b960991b81600b81518110611f6a57fe5b60200260200101818152505073223cb730b6b4b1a9bcb73a342932b232b2b6b2b960611b81600c81518110611f9b57fe5b6020026020010181815250507f6578743a41676772656761746f7249737375656453796e74687300000000000081600d81518110611fd557fe5b602002602001018181525050766578743a41676772656761746f7244656274526174696f60481b81600e8151811061200957fe5b60200260200101818152505061201f8282614035565b9250505090565b6000546001600160a01b031681565b61203d612652565b6001600160a01b0316336001600160a01b03161461206d5760405162461bcd60e51b815260040161069690615b98565b6120778383613109565b610e5e838260006131aa565b600061208e826140ea565b5092915050565b6000610e0a82614140565b6000806120ac836140ea565b915091505b915091565b6120be612652565b6001600160a01b0316336001600160a01b0316146120ee5760405162461bcd60e51b815260040161069690615b98565b6106cb828260006131aa565b6000610aa0613b9d565b6000610e0a826141dc565b6002546040516321f8a72160e01b815260009182916001600160a01b03909116906321f8a72190612160907853796e746865746978427269646765546f4f7074696d69736d60381b90600401615a37565b60206040518083038186803b15801561217857600080fd5b505afa15801561218c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121b09190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a721906121fe907453796e746865746978427269646765546f4261736560581b90600401615a37565b60206040518083038186803b15801561221657600080fd5b505afa15801561222a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061224e9190810190614c97565b6002546040516321f8a72160e01b81529192506000916001600160a01b03909116906321f8a7219061228e9066119959541bdbdb60ca1b90600401615a37565b60206040518083038186803b1580156122a657600080fd5b505afa1580156122ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506122de9190810190614c97565b9050336001600160a01b03841614806122ff5750336001600160a01b038316145b806123125750336001600160a01b038216145b61232e5760405162461bcd60e51b815260040161069690615b38565b6000878152600560205260409020546001600160a01b03166123625760405162461bcd60e51b815260040161069690615bd8565b600085116123825760405162461bcd60e51b815260040161069690615c58565b61238a612dc1565b6001600160a01b0316631b16802c87896040518363ffffffff1660e01b81526004016123b7929190615988565b606060405180830381600087803b1580156123d157600080fd5b505af11580156123e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612409919081019061504f565b50505060008781526005602052604090819020549051632770a7eb60e21b81526001600160a01b0390911690639dc29fac9061244b9089908990600401615988565b600060405180830381600087803b15801561246557600080fd5b505af1158015612479573d6000803e3d6000fd5b5050505060008061248989613f0c565b91509150612495612812565b6001600160a01b03166342c7b8196124b6611cf08a8663ffffffff613f9116565b6000036040518263ffffffff1660e01b8152600401611d119190615a37565b6124dd612652565b6001600160a01b0316336001600160a01b03161461250d5760405162461bcd60e51b815260040161069690615b98565b610f598160006001612669565b60008061252684613aa7565b905080612537576000915050610e0a565b6125418184613b2c565b509095945050505050565b612554612cd7565b826001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b15801561258d57600080fd5b505afa1580156125a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506125c59190810190614c97565b6001600160a01b0316639dc29fac83836040518363ffffffff1660e01b8152600401610edd929190615988565b60045490565b6000610e0a826141fb565b61260b612652565b6001600160a01b0316336001600160a01b03161461263b5760405162461bcd60e51b815260040161069690615b98565b612645828261343c565b6106cb8260006001612669565b6000610aa0680a6f2dce8d0cae8d2f60bb1b612ec1565b612671614274565b1561267b57610e5e565b60008061268785612e51565b9350505091506126968161443d565b826126c057818411156126bb5760405162461bcd60e51b815260040161069690615b78565b6126c4565b8193505b6126ce858561445b565b6126d785612dd8565b631cd554d160e21b6000526005602052600080516020615e528339815191525460405163219e412d60e21b81526001600160a01b039091169063867904b4906127269088908890600401615988565b600060405180830381600087803b15801561274057600080fd5b505af1158015612754573d6000803e3d6000fd5b50505050612760612812565b6001600160a01b03166342c7b81961277786613fbb565b6040518263ffffffff1660e01b81526004016118f69190615a37565b6000806000806127a8620a69cb60eb1b613f0c565b9150915060006127c06127ba87614140565b84614577565b90506127da6127cd613b9d565b829063ffffffff613f9116565b94509092505050915091565b6000546001600160a01b031633146128105760405162461bcd60e51b815260040161069690615c08565b565b6000610aa06844656274436163686560b81b612ec1565b6000818152600560205260409020546001600160a01b03168061285e5760405162461bcd60e51b815260040161069690615be8565b631cd554d160e21b8214156128855760405162461bcd60e51b815260040161069690615c38565b6000816001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156128c057600080fd5b505afa1580156128d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128f89190810190614ec2565b90508015612b7a5760008061290b613602565b6001600160a01b0316638295016a86856040518363ffffffff1660e01b8152600401612938929190615ac4565b60606040518083038186803b15801561295057600080fd5b505afa158015612964573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612988919081019061504f565b5091509150600081116129ad5760405162461bcd60e51b815260040161069690615ca8565b60006129b7614589565b631cd554d160e21b6000526005602052600080516020615e528339815191525460405163219e412d60e21b81529192506001600160a01b03169063867904b490612a079084908790600401615988565b600060405180830381600087803b158015612a2157600080fd5b505af1158015612a35573d6000803e3d6000fd5b50505050612a41612812565b6001600160a01b03166342c7b819612a5885613fbb565b6040518263ffffffff1660e01b8152600401612a749190615a37565b600060405180830381600087803b158015612a8e57600080fd5b505af1158015612aa2573d6000803e3d6000fd5b50505050806001600160a01b0316633a70599c866001600160a01b031663ec5568896040518163ffffffff1660e01b815260040160206040518083038186803b158015612aee57600080fd5b505afa158015612b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612b269190810190614f3e565b846040518363ffffffff1660e01b8152600401612b44929190615af9565b600060405180830381600087803b158015612b5e57600080fd5b505af1158015612b72573d6000803e3d6000fd5b505050505050505b60005b600454811015612c6157826001600160a01b031660048281548110612b9e57fe5b6000918252602090912001546001600160a01b03161415612c595760048181548110612bc657fe5b600091825260209091200180546001600160a01b0319169055600480546000198101908110612bf157fe5b600091825260209091200154600480546001600160a01b039092169183908110612c1757fe5b600091825260209091200180546001600160a01b0319166001600160a01b03929092169190911790556004805490612c53906000198301614b06565b50612c61565b600101612b7d565b506001600160a01b038216600090815260066020908152604080832083905585835260059091529081902080546001600160a01b0319169055517f6166f5c475cc1cd535c6cdf14a6d5edb811e34117031fc2863392a136eb655d090612cca9085908590615a45565b60405180910390a1505050565b612cdf614589565b6001600160a01b0316336001600160a01b03161480612da557506002546040516321f8a72160e01b81526001600160a01b03909116906321f8a72190612d409073223cb730b6b4b1a9bcb73a342932b232b2b6b2b960611b90600401615a37565b60206040518083038186803b158015612d5857600080fd5b505afa158015612d6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612d909190810190614c97565b6001600160a01b0316336001600160a01b0316145b6128105760405162461bcd60e51b815260040161069690615c48565b6000610aa06822bc31b430b733b2b960b91b612ec1565b612de06145a4565b6001600160a01b0316631d5b277f6524b9b9bab2b960d11b6d1b185cdd125cdcdd59515d995b9d60921b84604051602001612e1c9291906158f3565b60405160208183030381529060405280519060200120426040518463ffffffff1660e01b815260040161199c93929190615a61565b600080600080612e70612e6386613aa7565b631cd554d160e21b613b2c565b91945092509050600080612e8387612793565b915091508195508280612e935750805b9250858510612ea55760009550612eb8565b612eb5868663ffffffff613c0a16565b95505b50509193509193565b60008181526003602090815260408083205490516001600160a01b039091169182151591612ef191869101615919565b6040516020818303038152906040529061208e5760405162461bcd60e51b81526004016106969190615b07565b6000806000806000856001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015612f5f57600080fd5b505afa158015612f73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612f979190810190615092565b939a9299509097509550909350915050565b600080600080612fd56109b3766578743a41676772656761746f7244656274526174696f60481b612ec1565b50919650909450505050509091565b6000612ffd83836b033b2e3c9fd0803ce80000006145c1565b9392505050565b600061300e6145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6e1c985d1954dd185b1954195c9a5bd9608a1b6040518363ffffffff1660e01b815260040161305e929190615a53565b60206040518083038186803b15801561307657600080fd5b505afa15801561308a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610aa09190810190614ec2565b60006130b86145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6f6d696e696d756d5374616b6554696d6560801b6040518363ffffffff1660e01b815260040161305e929190615a53565b613111614605565b6001600160a01b0316637d3f0ba283836040518363ffffffff1660e01b815260040161313e929190615952565b60206040518083038186803b15801561315657600080fd5b505afa15801561316a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061318e9190810190614e86565b6106cb5760405162461bcd60e51b815260040161069690615b48565b6131b2614274565b156131bc57610e5e565b80613319576131ca836141dc565b6131e65760405162461bcd60e51b815260040161069690615c88565b6000806131f1612dc1565b6001600160a01b0316631b16802c86631cd554d160e21b6040518363ffffffff1660e01b8152600401613225929190615988565b606060405180830381600087803b15801561323f57600080fd5b505af1158015613253573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613277919081019061504f565b90935091505080156133165761328b612dc1565b6001600160a01b0316634c268fc886631cd554d160e21b87866040518563ffffffff1660e01b81526004016132c394939291906159a3565b60206040518083038186803b1580156132db57600080fd5b505afa1580156132ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506133139190810190614ec2565b93505b50505b600080613328612e6386613aa7565b925050915060008061333987612793565b9150915061334e83806133495750815b61443d565b6000841161336e5760405162461bcd60e51b815260040161069690615b68565b841561338757613384848363ffffffff613c0a16565b95505b600061339588898988614624565b9050826133a8868363ffffffff613c0a16565b11610959576133b5613c32565b6001600160a01b031663974e9e7f896040518263ffffffff1660e01b81526004016133e09190615944565b600060405180830381600087803b1580156133fa57600080fd5b505af115801561340e573d6000803e3d6000fd5b505050505050505050505050565b6000610aa07153796e74686574697844656274536861726560701b612ec1565b613444614605565b6001600160a01b0316630487261783836040518363ffffffff1660e01b815260040161313e929190615952565b6000816001600160a01b031663dbd06c856040518163ffffffff1660e01b815260040160206040518083038186803b1580156134ac57600080fd5b505afa1580156134c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506134e49190810190614ec2565b6000818152600560205260409020549091506001600160a01b03161561351c5760405162461bcd60e51b815260040161069690615c78565b6001600160a01b038216600090815260066020526040902054156135525760405162461bcd60e51b815260040161069690615c18565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0384166001600160a01b03199182168117909255600083815260056020908152604080832080549094168517909355928152600690925290819020829055517f0a2b6ebf143b3e9fcd67e17748ad315174746100c27228468b2c98c302c62884906135f69083908590615a45565b60405180910390a15050565b6000610aa06c45786368616e6765526174657360981b612ec1565b6060808261362c57600061362f565b60015b60ff1660048054905001604051908082528060200260200182016040528015613662578160200160208202803883390190505b50905060005b6004548110156136c957600660006004838154811061368357fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205482518390839081106136b657fe5b6020908102919091010152600101613668565b508215610e0a576004548151620a69cb60eb1b91839181106136e757fe5b60200260200101818152505092915050565b600080600080600061370d612e6388613aa7565b9193509091506000905080613727620a69cb60eb1b613f0c565b9150915061373b838061334957508161443d565b600088156139195761374b614751565b9050613755613c32565b6001600160a01b031663f557f73c866137766137708e614140565b87614577565b846040518463ffffffff1660e01b815260040161379593929190615a61565b60206040518083038186803b1580156137ad57600080fd5b505afa1580156137c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506137e59190810190614ec2565b965061389d61388f61387983732ad7ccaac0eeb396c3a5fc2b73a885435688c0d563907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801561383557600080fd5b505af4158015613849573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061386d9190810190614ec2565b9063ffffffff6147b216565b6138838a876147d7565b9063ffffffff613f9116565b6138988c6147e9565b6147f3565b97506139096139036138ed83732ad7ccaac0eeb396c3a5fc2b73a885435688c0d563907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801561383557600080fd5b6138f78b87614577565b9063ffffffff61480916565b886147f3565b9650600095506110169350505050565b613921614827565b90506000613938613930614887565b61386d6148dc565b9050600061395e6139588361394c8f614140565b9063ffffffff613c0a16565b86614577565b9050613968613c32565b6001600160a01b031663f557f73c8883866040518463ffffffff1660e01b815260040161399793929190615a61565b60206040518083038186803b1580156139af57600080fd5b505afa1580156139c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506139e79190810190614ec2565b98506000613a40613a3685732ad7ccaac0eeb396c3a5fc2b73a885435688c0d563907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801561383557600080fd5b6138838c896147d7565b9050613a4b8d614140565b613a5b828563ffffffff6147b216565b10613a8a57879950613a708361394c8f614140565b9a50613a7b8d614936565b98506110169650505050505050565b613a958d8285614940565b909b5098506110169650505050505050565b6000613ab161341c565b6001600160a01b03166370a08231836040518263ffffffff1660e01b8152600401613adc9190615944565b60206040518083038186803b158015613af457600080fd5b505afa158015613b08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e0a9190810190614ec2565b6000806000806000613b3c61097f565b92505091508660001415613b5857600094509092509050613b96565b600080613b6488613f0c565b91509150613b8182613b758b61499b565b9063ffffffff613bf516565b96508395508080613b8f5750825b9450505050505b9250925092565b6000613ba76145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6c69737375616e6365526174696f60981b6040518363ffffffff1660e01b815260040161305e929190615a53565b6000612ffd8383670de0b6b3a76400006145c1565b600082821115613c2c5760405162461bcd60e51b815260040161069690615b88565b50900390565b6000610aa0692634b8bab4b230ba37b960b11b612ec1565b613c526149b9565b6001600160a01b031663270fb338846040518263ffffffff1660e01b8152600401613c7d9190615944565b600060405180830381600087803b158015613c9757600080fd5b505af1158015613cab573d6000803e3d6000fd5b505050506000613cb961341c565b90506000613cc685613aa7565b905082841415613cfe57604051631a378f0d60e01b81526001600160a01b03831690631a378f0d906117df9088908590600401615988565b6000613d09856149d8565b9050826001600160a01b0316631a378f0d87848410613d285784613d2a565b835b6040518363ffffffff1660e01b8152600401613d47929190615988565b600060405180830381600087803b158015613d6157600080fd5b505af1158015613d75573d6000803e3d6000fd5b50505050505050505050565b6000806000806000613d91612812565b6001600160a01b0316633a900a2e6040518163ffffffff1660e01b815260040160806040518083038186803b158015613dc957600080fd5b505afa158015613ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613e019190810190614ffa565b935093505092508180613e115750805b935085613eb757600080613e23612812565b6001600160a01b0316632992dba26040518163ffffffff1660e01b8152600401604080518083038186803b158015613e5a57600080fd5b505afa158015613e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613e929190810190614f98565b9092509050613ea7858363ffffffff6147b216565b94508580613eb25750805b955050505b631cd554d160e21b871415613ed15750909250613f059050565b600080613edd89613f0c565b9092509050613ef2858363ffffffff613bf516565b8680613efb5750815b9650965050505050505b9250929050565b600080613f17613602565b6001600160a01b0316630c71cd23846040518263ffffffff1660e01b8152600401613f429190615a37565b604080518083038186803b158015613f5957600080fd5b505afa158015613f6d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506120ac9190810190614f98565b6000670de0b6b3a7640000613fac848463ffffffff614a0a16565b81613fb357fe5b049392505050565b6000600160ff1b8210613fe05760405162461bcd60e51b815260040161069690615c98565b5090565b604080516001808252818301909252606091602080830190803883390190505090506e466c657869626c6553746f7261676560881b8160008151811061402657fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015614065578160200160208202803883390190505b50905060005b83518110156140a75783818151811061408057fe5b602002602001015182828151811061409457fe5b602090810291909101015260010161406b565b5060005b825181101561208e578281815181106140c057fe5b60200260200101518282865101815181106140d757fe5b60209081029190910101526001016140ab565b60008060006140f884614140565b905060008061410961103d87613aa7565b92505091508260001415614125576000945092506120b1915050565b614135828463ffffffff613bf516565b945092505050915091565b6000610e0a61414d6149b9565b6001600160a01b0316628cc262846040518263ffffffff1660e01b81526004016141779190615944565b60206040518083038186803b15801561418f57600080fd5b505afa1580156141a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506141c79190810190614ec2565b61386d6141d385614936565b61386d866147e9565b60006141f26141e96130ae565b61386d846141fb565b42101592915050565b60006142056145a4565b6001600160a01b03166323257c2b6524b9b9bab2b960d11b6d1b185cdd125cdcdd59515d995b9d60921b856040516020016142419291906158f3565b604051602081830303815290604052805190602001206040518363ffffffff1660e01b8152600401613adc929190615a53565b60008061429a766578743a41676772656761746f7244656274526174696f60481b612ec1565b90506000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156142d757600080fd5b505afa1580156142eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061430f9190810190615092565b505050915050600061431f613602565b6001600160a01b031663045056f8620a69cb60eb1b6040518263ffffffff1660e01b81526004016143509190615a37565b606060405180830381600087803b15801561436a57600080fd5b505af115801561437e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506143a29190810190614fb7565b509150506143ae614a44565b6001600160a01b031663413caeb584846040518363ffffffff1660e01b81526004016143db929190615988565b602060405180830381600087803b1580156143f557600080fd5b505af1158015614409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061442d9190810190614e86565b806144355750805b935050505090565b8015610f595760405162461bcd60e51b815260040161069690615bc8565b6144636149b9565b6001600160a01b031663270fb338836040518263ffffffff1660e01b815260040161448e9190615944565b600060405180830381600087803b1580156144a857600080fd5b505af11580156144bc573d6000803e3d6000fd5b5050505060006144ca61341c565b905060006144d7836149d8565b90508061454357604051636178258560e11b81526001600160a01b0383169063c2f04b0a9061450c9087908790600401615988565b600060405180830381600087803b15801561452657600080fd5b505af115801561453a573d6000803e3d6000fd5b50505050614571565b604051636178258560e11b81526001600160a01b0383169063c2f04b0a9061092b9087908590600401615988565b50505050565b6000612ffd838363ffffffff614a6016565b6000610aa06c29bcb73a342932b232b2b6b2b960991b612ec1565b6000610aa06e466c657869626c6553746f7261676560881b612ec1565b6000806145e7846145db87600a870263ffffffff614a0a16565b9063ffffffff614a7516565b90506005600a825b06106145f957600a015b600a9004949350505050565b6000610aa07044656c6567617465417070726f76616c7360781b612ec1565b600061462e614274565b1561463b57506000614749565b828210614648578261464a565b815b9050614657858284613c4a565b631cd554d160e21b6000526005602052600080516020615e5283398151915254604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906146a69087908590600401615988565b600060405180830381600087803b1580156146c057600080fd5b505af11580156146d4573d6000803e3d6000fd5b505050506146e0612812565b6001600160a01b03166342c7b8196146f783613fbb565b6000036040518263ffffffff1660e01b81526004016147169190615a37565b600060405180830381600087803b15801561473057600080fd5b505af1158015614744573d6000803e3d6000fd5b505050505b949350505050565b600061475b6145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7573656c664c69717569646174696f6e50656e616c747960501b6040518363ffffffff1660e01b815260040161305e929190615a53565b600082820183811015612ffd5760405162461bcd60e51b815260040161069690615b58565b6000612ffd838363ffffffff613bf516565b6000613ab1612652565b60008183106148025781612ffd565b5090919050565b6000612ffd826145db85670de0b6b3a764000063ffffffff614a0a16565b60006148316145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b74736e784c69717569646174696f6e50656e616c747960581b6040518363ffffffff1660e01b815260040161305e929190615a53565b60006148916145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b69199b1859d4995dd85c9960b21b6040518363ffffffff1660e01b815260040161305e929190615a53565b60006148e66145a4565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6e1b1a5c5d5a59185d1954995dd85c99608a1b6040518363ffffffff1660e01b815260040161305e929190615a53565b6000613ab1614aaa565b600080600061494e866147e9565b905080614961868663ffffffff6147b216565b11614973575083915060009050614993565b6149878161394c878763ffffffff6147b216565b85935091506149939050565b935093915050565b6000806149a6612fa9565b509050612ffd838263ffffffff614ac616565b6000610aa0704c697175696461746f725265776172647360781b612ec1565b6000806149e3612fa9565b5090508015614a01576149fc838263ffffffff612fe416565b612ffd565b50600092915050565b600082614a1957506000610e0a565b82820282848281614a2657fe5b0414612ffd5760405162461bcd60e51b815260040161069690615c28565b6000610aa06d21b4b931bab4ba213932b0b5b2b960911b612ec1565b6000612ffd8383670de0b6b3a7640000614adb565b6000808211614a965760405162461bcd60e51b815260040161069690615ba8565b6000828481614aa157fe5b04949350505050565b6000610aa06d2932bbb0b93222b9b1b937bbab1960911b612ec1565b6000612ffd83836b033b2e3c9fd0803ce80000005b600080600a8304614af2868663ffffffff614a0a16565b81614af957fe5b0490506005600a826145ef565b815481835581811115610e5e57600083815260209020610e5e918101908301610aa391905b80821115613fe05760008155600101614b2b565b8035610e0a81615e10565b8051610e0a81615e10565b60008083601f840112614b6757600080fd5b50813567ffffffffffffffff811115614b7f57600080fd5b602083019150836020820283011115613f0557600080fd5b600082601f830112614ba857600080fd5b8151614bbb614bb682615d31565b615d0a565b91508181835260208401935060208101905083856020840282011115614be057600080fd5b60005b83811015614c0c5781614bf68882614c37565b8452506020928301929190910190600101614be3565b5050505092915050565b8035610e0a81615e24565b8051610e0a81615e24565b8035610e0a81615e2d565b8051610e0a81615e2d565b8035610e0a81615e36565b8051610e0a81615e36565b8035610e0a81615e3f565b8051610e0a81615e3f565b8051610e0a81615e48565b600060208284031215614c8b57600080fd5b60006147498484614b3f565b600060208284031215614ca957600080fd5b60006147498484614b4a565b60008060408385031215614cc857600080fd5b6000614cd48585614b3f565b9250506020614ce585828601614b3f565b9150509250929050565b600080600060608486031215614d0457600080fd5b6000614d108686614b3f565b9350506020614d2186828701614b3f565b9250506040614d3286828701614c2c565b9150509250925092565b60008060408385031215614d4f57600080fd5b6000614d5b8585614b3f565b9250506020614ce585828601614c16565b60008060408385031215614d7f57600080fd5b6000614d8b8585614b3f565b9250506020614ce585828601614c2c565b60008060008060808587031215614db257600080fd5b6000614dbe8787614b3f565b9450506020614dcf87828801614c2c565b9350506040614de087828801614c2c565b9250506060614df187828801614c2c565b91505092959194509250565b60008060208385031215614e1057600080fd5b823567ffffffffffffffff811115614e2757600080fd5b614e3385828601614b55565b92509250509250929050565b60008060408385031215614e5257600080fd5b825167ffffffffffffffff811115614e6957600080fd5b614e7585828601614b97565b9250506020614ce585828601614c21565b600060208284031215614e9857600080fd5b60006147498484614c21565b600060208284031215614eb657600080fd5b60006147498484614c2c565b600060208284031215614ed457600080fd5b60006147498484614c37565b600080600060608486031215614ef557600080fd5b6000614d108686614c2c565b60008060408385031215614f1457600080fd5b6000614d5b8585614c2c565b600060208284031215614f3257600080fd5b60006147498484614c42565b600060208284031215614f5057600080fd5b60006147498484614c4d565b600060208284031215614f6e57600080fd5b60006147498484614c58565b600060208284031215614f8c57600080fd5b60006147498484614c63565b60008060408385031215614fab57600080fd5b6000614e758585614c37565b600080600060608486031215614fcc57600080fd5b6000614fd88686614c37565b9350506020614fe986828701614c21565b9250506040614d3286828701614c21565b6000806000806080858703121561501057600080fd5b600061501c8787614c37565b945050602061502d87828801614c37565b935050604061503e87828801614c21565b9250506060614df187828801614c21565b60008060006060848603121561506457600080fd5b60006150708686614c37565b935050602061508186828701614c37565b9250506040614d3286828701614c37565b600080600080600060a086880312156150aa57600080fd5b60006150b68888614c6e565b95505060206150c788828901614c37565b94505060406150d888828901614c37565b93505060606150e988828901614c37565b92505060806150fa88828901614c6e565b9150509295509295909350565b6000615113838361527e565b505060200190565b60006151138383615298565b61513081615d6a565b82525050565b61513061514282615d6a565b615def565b60006151538385615d5c565b93506001600160fb1b0383111561516957600080fd5b60208302925061517a838584615db7565b50500190565b600061518b82615d58565b6151958185615d5c565b93506151a083615d52565b8060005b838110156151ce5781516151b88882615107565b97506151c383615d52565b9250506001016151a4565b509495945050505050565b60006151e482615d58565b6151ee8185615d5c565b93506151f983615d52565b8060005b838110156151ce578151615211888261511b565b975061521c83615d52565b9250506001016151fd565b600061523282615d58565b61523c8185615d5c565b935061524783615d52565b8060005b838110156151ce57815161525f8882615107565b975061526a83615d52565b92505060010161524b565b61513081615d75565b61513081610aa3565b61513061529382610aa3565b610aa3565b61513081615d7a565b61513081615dac565b60006152b582615d58565b6152bf8185615d5c565b93506152cf818560208601615dc3565b6152d881615e00565b9093019392505050565b60006152ef601883615d5c565b7f6f6e65206d69677261746f72206d757374206265203078300000000000000000815260200192915050565b6000615328603583615d5c565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b600061537f601483615d5c565b736f6e6c792074727573746564206d696e7465727360601b815260200192915050565b60006153af601d83615d5c565b7f4e6f7420617070726f76656420746f20616374206f6e20626568616c66000000815260200192915050565b60006153e8601b83615d5c565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000615421601283615d5c565b714e6f206465627420746f20666f726769766560701b815260200192915050565b600061544f601083615d5c565b6f416d6f756e7420746f6f206c6172676560801b815260200192915050565b600061547b601e83615d5c565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b60006154b4600e83615d5c565b6d09edcd8f240a6f2dce8d0cae8d2f60931b815260200192915050565b60006154de601a83615d5c565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000815260200192915050565b6000615517601183615d65565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b6000615544601083615d5c565b6f135d5cdd08189948199959481c1bdbdb60821b815260200192915050565b6000615570601e83615d5c565b7f412073796e7468206f7220534e58207261746520697320696e76616c69640000815260200192915050565b60006155a9601383615d5c565b721cde5b9d1a08191bd95cdb89dd08195e1a5cdd606a1b815260200192915050565b60006155d8601483615d5c565b7314de5b9d1a08191bd95cc81b9bdd08195e1a5cdd60621b815260200192915050565b6000615608601883615d5c565b7f4e6f74206f70656e20666f72206c69717569646174696f6e0000000000000000815260200192915050565b6000615641602f83615d5c565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b631cd554d160e21b9052565b600061569e601c83615d5c565b7f53796e7468206164647265737320616c72656164792065786973747300000000815260200192915050565b60006156d7602183615d5c565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b600061571a601383615d5c565b72086c2dcdcdee840e4cadadeecca40e6f2dce8d606b1b815260200192915050565b6000615749601283615d5c565b7127b7363c9029bcb73a342932b232b2b6b2b960711b815260200192915050565b6000615777601583615d5c565b7463616e6e6f7420697373756520302073796e74687360581b815260200192915050565b60006157a8601983615d65565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b60006157e1601683615d5c565b756f6e6c792074727573746564206d69677261746f727360501b815260200192915050565b6000615813600c83615d5c565b6b53796e74682065786973747360a01b815260200192915050565b600061583b601e83615d5c565b7f4d696e696d756d207374616b652074696d65206e6f7420726561636865640000815260200192915050565b6000615874602883615d5c565b7f53616665436173743a2076616c756520646f65736e27742066697420696e2061815267371034b73a191a9b60c11b602082015260400192915050565b60006158be601a83615d5c565b7f43616e6e6f742072656d6f766520776974686f75742072617465000000000000815260200192915050565b61513081615d85565b60006158ff8285615287565b60208201915061590f8284615136565b5060140192915050565b60006159248261550a565b91506159308284615287565b50602001919050565b60006159248261579b565b60208101610e0a8284615127565b604081016159608285615127565b612ffd6020830184615127565b6040810161597b8285615127565b612ffd6020830184615275565b604081016159968285615127565b612ffd602083018461527e565b608081016159b18287615127565b6159be602083018661527e565b6159cb604083018561527e565b6159d8606083018461527e565b95945050505050565b604080825281016159f3818587615147565b905081810360208301526159d88184615227565b60208082528101612ffd8184615180565b60208082528101612ffd81846151d9565b60208101610e0a8284615275565b60208101610e0a828461527e565b60408101615960828561527e565b60408101615996828561527e565b60608101615a6f828661527e565b615a7c602083018561527e565b614749604083018461527e565b60408101615a97828561527e565b612ffd60208301846152a1565b60408101615ab2828561527e565b818103602083015261474981846152aa565b60608101615ad2828561527e565b615adf602083018461527e565b612ffd60408301615685565b60208101610e0a8284615298565b604081016159968285615298565b60208082528101612ffd81846152aa565b60208082528101610e0a816152e2565b60208082528101610e0a8161531b565b60208082528101610e0a81615372565b60208082528101610e0a816153a2565b60208082528101610e0a816153db565b60208082528101610e0a81615414565b60208082528101610e0a81615442565b60208082528101610e0a8161546e565b60208082528101610e0a816154a7565b60208082528101610e0a816154d1565b60208082528101610e0a81615537565b60208082528101610e0a81615563565b60208082528101610e0a8161559c565b60208082528101610e0a816155cb565b60208082528101610e0a816155fb565b60208082528101610e0a81615634565b60208082528101610e0a81615691565b60208082528101610e0a816156ca565b60208082528101610e0a8161570d565b60208082528101610e0a8161573c565b60208082528101610e0a8161576a565b60208082528101610e0a816157d4565b60208082528101610e0a81615806565b60208082528101610e0a8161582e565b60208082528101610e0a81615867565b60208082528101610e0a816158b1565b60208101610e0a82846158ea565b6040810161597b828561527e565b60608101615ce2828661527e565b615cef602083018561527e565b6147496040830184615275565b608081016159b1828761527e565b60405181810167ffffffffffffffff81118282101715615d2957600080fd5b604052919050565b600067ffffffffffffffff821115615d4857600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b919050565b6000610e0a82615d91565b151590565b6000610e0a82615d6a565b6001600160801b031690565b6001600160a01b031690565b69ffffffffffffffffffff1690565b6000610e0a82610aa3565b82818337506000910152565b60005b83811015615dde578181015183820152602001615dc6565b838111156145715750506000910152565b6000610e0a826000610e0a82615e0a565b601f01601f191690565b60601b90565b615e1981615d6a565b8114610f5957600080fd5b615e1981615d75565b615e1981610aa3565b615e1981615d7a565b615e1981615d85565b615e1981615d9d56fe74c62d09fbc50aefae0794a9a068f786a692826fbdfe63828ec23a875865823fa365627a7a72315820160805ca78bb540916fefaeb9c5060d6b370e423bfb95c7cb75099eaad4f23326c6578706572696d656e74616cf564736f6c63430005100040
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee9000000000000000000000000529c553ef2d0370279dc8abf19702b98b166d252
-----Decoded View---------------
Arg [0] : _owner (address): 0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9
Arg [1] : _resolver (address): 0x529C553eF2d0370279DC8AbF19702B98b166D252
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee9
Arg [1] : 000000000000000000000000529c553ef2d0370279dc8abf19702b98b166d252
Library Used
SafeDecimalMath : 0x2ad7ccaac0eeb396c3a5fc2b73a885435688c0d5SystemSettingsLib : 0x343b5efcbf331957d3f4236eb16c338d7256f62dSignedSafeDecimalMath : 0xc7dcc0929881530d3386de51d9ffdd35b8009c6eExchangeSettlementLib : 0x3f60ffaef1ebd84e3c2d0c9c0e12388365d5df12
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.