Contract Address Details

0xc683e6f77B58D814B31F8661331EbDf63785D607

Contract Name
Reserve
Creator
0xf3eb91–a79239 at 0xbf5c3f–d2ef9d
Balance
0 CELO ( )
Tokens
Fetching tokens...
Transactions
Transfers
Gas Used
Last Balance Update
13810081
This contract has been partially verified via Sourcify. View contract in Sourcify repository
Contract name:
Reserve




Optimization enabled
false
Compiler version
v0.5.13+commit.5b0b510c




EVM Version
istanbul




Verified at
2021-10-20 21:37:25.869364Z

Contract source code

pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/Address.sol";
import "./interfaces/IReserve.sol";
import "./interfaces/ISortedOracles.sol";
import "../common/FixidityLib.sol";
import "../common/Initializable.sol";
import "../common/UsingRegistry.sol";
import "../common/interfaces/ICeloVersionedContract.sol";
import "../common/libraries/ReentrancyGuard.sol";
/**
* @title Ensures price stability of StableTokens with respect to their pegs
*/
contract Reserve is
IReserve,
ICeloVersionedContract,
Ownable,
Initializable,
UsingRegistry,
ReentrancyGuard
{
using SafeMath for uint256;
using FixidityLib for FixidityLib.Fraction;
using Address for address payable; // prettier-ignore
struct TobinTaxCache {
uint128 numerator;
uint128 timestamp;
}
mapping(address => bool) public isToken;
address[] private _tokens;
TobinTaxCache public tobinTaxCache;
uint256 public tobinTaxStalenessThreshold;
uint256 public tobinTax;
uint256 public tobinTaxReserveRatio;
mapping(address => bool) public isSpender;
mapping(address => bool) public isOtherReserveAddress;
address[] public otherReserveAddresses;
bytes32[] public assetAllocationSymbols;
mapping(bytes32 => uint256) public assetAllocationWeights;
uint256 public lastSpendingDay;
uint256 public spendingLimit;
FixidityLib.Fraction private spendingRatio;
uint256 public frozenReserveGoldStartBalance;
uint256 public frozenReserveGoldStartDay;
uint256 public frozenReserveGoldDays;
mapping(address => bool) public isExchangeSpender;
address[] public exchangeSpenderAddresses;
event TobinTaxStalenessThresholdSet(uint256 value);
event DailySpendingRatioSet(uint256 ratio);
event TokenAdded(address indexed token);
event TokenRemoved(address indexed token, uint256 index);
event SpenderAdded(address indexed spender);
event SpenderRemoved(address indexed spender);
event OtherReserveAddressAdded(address indexed otherReserveAddress);
event OtherReserveAddressRemoved(address indexed otherReserveAddress, uint256 index);
event AssetAllocationSet(bytes32[] symbols, uint256[] weights);
event ReserveGoldTransferred(address indexed spender, address indexed to, uint256 value);
event TobinTaxSet(uint256 value);
event TobinTaxReserveRatioSet(uint256 value);
event ExchangeSpenderAdded(address indexed exchangeSpender);
event ExchangeSpenderRemoved(address indexed exchangeSpender);
/**
* @notice Sets initialized == true on implementation contracts
* @param test Set to true to skip implementation initialization
*/
constructor(bool test) public Initializable(test) {}
modifier isStableToken(address token) {
require(isToken[token], "token addr was never registered");
_;
}
/**
* @notice Returns the storage, major, minor, and patch version of the contract.
* @return The storage, major, minor, and patch version of the contract.
*/
function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) {
return (1, 1, 2, 1);
}
function() external payable {} // solhint-disable no-empty-blocks
/**
* @notice Used in place of the constructor to allow the contract to be upgradable via proxy.
* @param registryAddress The address of the registry core smart contract.
* @param _tobinTaxStalenessThreshold The initial number of seconds to cache tobin tax value for.
* @param _spendingRatio The relative daily spending limit for the reserve spender.
* @param _frozenGold The balance of reserve gold that is frozen.
* @param _frozenDays The number of days during which the frozen gold thaws.
* @param _assetAllocationSymbols The symbols of the reserve assets.
* @param _assetAllocationWeights The reserve asset weights.
* @param _tobinTax The tobin tax value as a fixidity fraction.
* @param _tobinTaxReserveRatio When to turn on the tobin tax, as a fixidity fraction.
*/
function initialize(
address registryAddress,
uint256 _tobinTaxStalenessThreshold,
uint256 _spendingRatio,
uint256 _frozenGold,
uint256 _frozenDays,
bytes32[] calldata _assetAllocationSymbols,
uint256[] calldata _assetAllocationWeights,
uint256 _tobinTax,
uint256 _tobinTaxReserveRatio
) external initializer {
_transferOwnership(msg.sender);
setRegistry(registryAddress);
setTobinTaxStalenessThreshold(_tobinTaxStalenessThreshold);
setDailySpendingRatio(_spendingRatio);
setFrozenGold(_frozenGold, _frozenDays);
setAssetAllocations(_assetAllocationSymbols, _assetAllocationWeights);
setTobinTax(_tobinTax);
setTobinTaxReserveRatio(_tobinTaxReserveRatio);
}
/**
* @notice Sets the number of seconds to cache the tobin tax value for.
* @param value The number of seconds to cache the tobin tax value for.
*/
function setTobinTaxStalenessThreshold(uint256 value) public onlyOwner {
require(value > 0, "value was zero");
tobinTaxStalenessThreshold = value;
emit TobinTaxStalenessThresholdSet(value);
}
/**
* @notice Sets the tobin tax.
* @param value The tobin tax.
*/
function setTobinTax(uint256 value) public onlyOwner {
require(FixidityLib.wrap(value).lte(FixidityLib.fixed1()), "tobin tax cannot be larger than 1");
tobinTax = value;
emit TobinTaxSet(value);
}
/**
* @notice Sets the reserve ratio at which the tobin tax sets in.
* @param value The reserve ratio at which the tobin tax sets in.
*/
function setTobinTaxReserveRatio(uint256 value) public onlyOwner {
tobinTaxReserveRatio = value;
emit TobinTaxReserveRatioSet(value);
}
/**
* @notice Set the ratio of reserve that is spendable per day.
* @param ratio Spending ratio as unwrapped Fraction.
*/
function setDailySpendingRatio(uint256 ratio) public onlyOwner {
spendingRatio = FixidityLib.wrap(ratio);
require(spendingRatio.lte(FixidityLib.fixed1()), "spending ratio cannot be larger than 1");
emit DailySpendingRatioSet(ratio);
}
/**
* @notice Get daily spending ratio.
* @return Spending ratio as unwrapped Fraction.
*/
function getDailySpendingRatio() public view returns (uint256) {
return spendingRatio.unwrap();
}
/**
* @notice Sets the balance of reserve gold frozen from transfer.
* @param frozenGold The amount of CELO frozen.
* @param frozenDays The number of days the frozen CELO thaws over.
*/
function setFrozenGold(uint256 frozenGold, uint256 frozenDays) public onlyOwner {
require(frozenGold <= address(this).balance, "Cannot freeze more than balance");
frozenReserveGoldStartBalance = frozenGold;
frozenReserveGoldStartDay = now / 1 days;
frozenReserveGoldDays = frozenDays;
}
/**
* @notice Sets target allocations for CELO and a diversified basket of non-Celo assets.
* @param symbols The symbol of each asset in the Reserve portfolio.
* @param weights The weight for the corresponding asset as unwrapped Fixidity.Fraction.
*/
function setAssetAllocations(bytes32[] memory symbols, uint256[] memory weights)
public
onlyOwner
{
require(symbols.length == weights.length, "Array length mismatch");
FixidityLib.Fraction memory sum = FixidityLib.wrap(0);
for (uint256 i = 0; i < weights.length; i = i.add(1)) {
sum = sum.add(FixidityLib.wrap(weights[i]));
}
require(sum.equals(FixidityLib.fixed1()), "Sum of asset allocation must be 1");
for (uint256 i = 0; i < assetAllocationSymbols.length; i = i.add(1)) {
delete assetAllocationWeights[assetAllocationSymbols[i]];
}
assetAllocationSymbols = symbols;
for (uint256 i = 0; i < symbols.length; i = i.add(1)) {
require(assetAllocationWeights[symbols[i]] == 0, "Cannot set weight twice");
assetAllocationWeights[symbols[i]] = weights[i];
}
// NOTE: The CELO asset launched as "Celo Gold" (cGLD), but was renamed to
// just CELO by the community.
// TODO: Change "cGLD" to "CELO" in this file, after ensuring that any
// off chain tools working with asset allocation weights are aware of this
// change.
require(assetAllocationWeights["cGLD"] != 0, "Must set cGLD asset weight");
emit AssetAllocationSet(symbols, weights);
}
/**
* @notice Add a token that the reserve will stabilize.
* @param token The address of the token being stabilized.
* @return Returns true if the transaction succeeds.
*/
function addToken(address token) external onlyOwner nonReentrant returns (bool) {
require(!isToken[token], "token addr already registered");
// Require an exchange rate between the new token and Gold exists.
address sortedOraclesAddress = registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID);
ISortedOracles sortedOracles = ISortedOracles(sortedOraclesAddress);
uint256 tokenAmount;
uint256 goldAmount;
(tokenAmount, goldAmount) = sortedOracles.medianRate(token);
require(goldAmount > 0, "median rate returned 0 gold");
isToken[token] = true;
_tokens.push(token);
emit TokenAdded(token);
return true;
}
/**
* @notice Remove a token that the reserve will no longer stabilize.
* @param token The address of the token no longer being stabilized.
* @param index The index of the token in _tokens.
* @return Returns true if the transaction succeeds.
*/
function removeToken(address token, uint256 index)
external
onlyOwner
isStableToken(token)
returns (bool)
{
require(
index < _tokens.length && _tokens[index] == token,
"index into tokens list not mapped to token"
);
isToken[token] = false;
address lastItem = _tokens[_tokens.length.sub(1)];
_tokens[index] = lastItem;
_tokens.length = _tokens.length.sub(1);
emit TokenRemoved(token, index);
return true;
}
/**
* @notice Add a reserve address whose balance shall be included in the reserve ratio.
* @param reserveAddress The reserve address to add.
* @return Returns true if the transaction succeeds.
*/
function addOtherReserveAddress(address reserveAddress)
external
onlyOwner
nonReentrant
returns (bool)
{
require(!isOtherReserveAddress[reserveAddress], "reserve addr already added");
isOtherReserveAddress[reserveAddress] = true;
otherReserveAddresses.push(reserveAddress);
emit OtherReserveAddressAdded(reserveAddress);
return true;
}
/**
* @notice Remove reserve address whose balance shall no longer be included in the reserve ratio.
* @param reserveAddress The reserve address to remove.
* @param index The index of the reserve address in otherReserveAddresses.
* @return Returns true if the transaction succeeds.
*/
function removeOtherReserveAddress(address reserveAddress, uint256 index)
external
onlyOwner
returns (bool)
{
require(isOtherReserveAddress[reserveAddress], "reserve addr was never added");
require(
index < otherReserveAddresses.length && otherReserveAddresses[index] == reserveAddress,
"index into reserve list not mapped to address"
);
isOtherReserveAddress[reserveAddress] = false;
address lastItem = otherReserveAddresses[otherReserveAddresses.length.sub(1)];
otherReserveAddresses[index] = lastItem;
otherReserveAddresses.length = otherReserveAddresses.length.sub(1);
emit OtherReserveAddressRemoved(reserveAddress, index);
return true;
}
/**
* @notice Gives an address permission to spend Reserve funds.
* @param spender The address that is allowed to spend Reserve funds.
*/
function addSpender(address spender) external onlyOwner {
require(address(0) != spender, "Spender can't be null");
isSpender[spender] = true;
emit SpenderAdded(spender);
}
/**
* @notice Takes away an address's permission to spend Reserve funds.
* @param spender The address that is to be no longer allowed to spend Reserve funds.
*/
function removeSpender(address spender) external onlyOwner {
isSpender[spender] = false;
emit SpenderRemoved(spender);
}
/**
* @notice Checks if an address is able to spend as an exchange.
* @dev isExchangeSpender was introduced after cUSD, so the cUSD Exchange is not included in it.
* If cUSD's Exchange were to be added to isExchangeSpender, the check with the
* registry could be removed.
* @param spender The address to be checked.
*/
modifier isAllowedToSpendExchange(address spender) {
require(
isExchangeSpender[spender] || (registry.getAddressForOrDie(EXCHANGE_REGISTRY_ID) == spender),
"Address not allowed to spend"
);
_;
}
/**
* @notice Gives an address permission to spend Reserve without limit.
* @param spender The address that is allowed to spend Reserve funds.
*/
function addExchangeSpender(address spender) external onlyOwner {
require(address(0) != spender, "Spender can't be null");
require(!isExchangeSpender[spender], "Address is already Exchange Spender");
isExchangeSpender[spender] = true;
exchangeSpenderAddresses.push(spender);
emit ExchangeSpenderAdded(spender);
}
/**
* @notice Takes away an address's permission to spend Reserve funds without limits.
* @param spender The address that is to be no longer allowed to spend Reserve funds.
* @param index The index in exchangeSpenderAddresses of spender.
*/
function removeExchangeSpender(address spender, uint256 index) external onlyOwner {
isExchangeSpender[spender] = false;
uint256 numAddresses = exchangeSpenderAddresses.length;
require(index < numAddresses, "Index is invalid");
require(spender == exchangeSpenderAddresses[index], "Index does not match spender");
uint256 newNumAddresses = numAddresses.sub(1);
if (index != newNumAddresses) {
exchangeSpenderAddresses[index] = exchangeSpenderAddresses[newNumAddresses];
}
exchangeSpenderAddresses[newNumAddresses] = address(0x0);
exchangeSpenderAddresses.length = newNumAddresses;
emit ExchangeSpenderRemoved(spender);
}
/**
* @notice Returns addresses of exchanges permitted to spend Reserve funds.
* Because exchangeSpenderAddresses was introduced after cUSD, cUSD's exchange
* is not included in this list.
* @return An array of addresses permitted to spend Reserve funds.
*/
function getExchangeSpenders() external view returns (address[] memory) {
return exchangeSpenderAddresses;
}
/**
* @notice Transfer gold to a whitelisted address subject to reserve spending limits.
* @param to The address that will receive the gold.
* @param value The amount of gold to transfer.
* @return Returns true if the transaction succeeds.
*/
function transferGold(address payable to, uint256 value) external returns (bool) {
require(isSpender[msg.sender], "sender not allowed to transfer Reserve funds");
require(isOtherReserveAddress[to], "can only transfer to other reserve address");
uint256 currentDay = now / 1 days;
if (currentDay > lastSpendingDay) {
uint256 balance = getUnfrozenReserveGoldBalance();
lastSpendingDay = currentDay;
spendingLimit = spendingRatio.multiply(FixidityLib.newFixed(balance)).fromFixed();
}
require(spendingLimit >= value, "Exceeding spending limit");
spendingLimit = spendingLimit.sub(value);
return _transferGold(to, value);
}
/**
* @notice Transfer unfrozen gold to any address.
* @param to The address that will receive the gold.
* @param value The amount of gold to transfer.
* @return Returns true if the transaction succeeds.
*/
function _transferGold(address payable to, uint256 value) internal returns (bool) {
require(value <= getUnfrozenBalance(), "Exceeding unfrozen reserves");
to.sendValue(value);
emit ReserveGoldTransferred(msg.sender, to, value);
return true;
}
/**
* @notice Transfer unfrozen gold to any address, used for one side of CP-DOTO.
* @dev Transfers are not subject to a daily spending limit.
* @param to The address that will receive the gold.
* @param value The amount of gold to transfer.
* @return Returns true if the transaction succeeds.
*/
function transferExchangeGold(address payable to, uint256 value)
external
isAllowedToSpendExchange(msg.sender)
returns (bool)
{
return _transferGold(to, value);
}
/**
* @notice Returns the tobin tax, recomputing it if it's stale.
* @return The tobin tax amount as a fraction.
*/
function getOrComputeTobinTax() external nonReentrant returns (uint256, uint256) {
// solhint-disable-next-line not-rely-on-time
if (now.sub(tobinTaxCache.timestamp) > tobinTaxStalenessThreshold) {
tobinTaxCache.numerator = uint128(computeTobinTax().unwrap());
tobinTaxCache.timestamp = uint128(now); // solhint-disable-line not-rely-on-time
}
return (uint256(tobinTaxCache.numerator), FixidityLib.fixed1().unwrap());
}
/**
* @notice Returns the list of stabilized token addresses.
* @return An array of addresses of stabilized tokens.
*/
function getTokens() external view returns (address[] memory) {
return _tokens;
}
/**
* @notice Returns the list other addresses included in the reserve total.
* @return An array of other addresses included in the reserve total.
*/
function getOtherReserveAddresses() external view returns (address[] memory) {
return otherReserveAddresses;
}
/**
* @notice Returns a list of token symbols that have been allocated.
* @return An array of token symbols that have been allocated.
*/
function getAssetAllocationSymbols() external view returns (bytes32[] memory) {
return assetAllocationSymbols;
}
/**
* @notice Returns a list of weights used for the allocation of reserve assets.
* @return An array of a list of weights used for the allocation of reserve assets.
*/
function getAssetAllocationWeights() external view returns (uint256[] memory) {
uint256[] memory weights = new uint256[](assetAllocationSymbols.length);
for (uint256 i = 0; i < assetAllocationSymbols.length; i = i.add(1)) {
weights[i] = assetAllocationWeights[assetAllocationSymbols[i]];
}
return weights;
}
/**
* @notice Returns the amount of unfrozen CELO in the reserve.
* @return The total unfrozen CELO in the reserve.
*/
function getUnfrozenBalance() public view returns (uint256) {
uint256 balance = address(this).balance;
uint256 frozenReserveGold = getFrozenReserveGoldBalance();
return balance > frozenReserveGold ? balance.sub(frozenReserveGold) : 0;
}
/**
* @notice Returns the amount of CELO included in the reserve.
* @return The CELO amount included in the reserve.
*/
function getReserveGoldBalance() public view returns (uint256) {
return address(this).balance.add(getOtherReserveAddressesGoldBalance());
}
/**
* @notice Returns the amount of CELO included in other reserve addresses.
* @return The CELO amount included in other reserve addresses.
*/
function getOtherReserveAddressesGoldBalance() public view returns (uint256) {
uint256 reserveGoldBalance = 0;
for (uint256 i = 0; i < otherReserveAddresses.length; i = i.add(1)) {
reserveGoldBalance = reserveGoldBalance.add(otherReserveAddresses[i].balance);
}
return reserveGoldBalance;
}
/**
* @notice Returns the amount of unfrozen CELO included in the reserve.
* @return The unfrozen CELO amount included in the reserve.
*/
function getUnfrozenReserveGoldBalance() public view returns (uint256) {
return getUnfrozenBalance().add(getOtherReserveAddressesGoldBalance());
}
/**
* @notice Returns the amount of frozen CELO in the reserve.
* @return The total frozen CELO in the reserve.
*/
function getFrozenReserveGoldBalance() public view returns (uint256) {
uint256 currentDay = now / 1 days;
uint256 frozenDays = currentDay.sub(frozenReserveGoldStartDay);
if (frozenDays >= frozenReserveGoldDays) return 0;
return
frozenReserveGoldStartBalance.sub(
frozenReserveGoldStartBalance.mul(frozenDays).div(frozenReserveGoldDays)
);
}
/**
* @notice Computes the ratio of current reserve balance to total stable token valuation.
* @return Reserve ratio in a fixed point format.
*/
function getReserveRatio() public view returns (uint256) {
address sortedOraclesAddress = registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID);
ISortedOracles sortedOracles = ISortedOracles(sortedOraclesAddress);
uint256 reserveGoldBalance = getUnfrozenReserveGoldBalance();
uint256 stableTokensValueInGold = 0;
FixidityLib.Fraction memory cgldWeight = FixidityLib.wrap(assetAllocationWeights["cGLD"]);
for (uint256 i = 0; i < _tokens.length; i = i.add(1)) {
uint256 stableAmount;
uint256 goldAmount;
(stableAmount, goldAmount) = sortedOracles.medianRate(_tokens[i]);
uint256 stableTokenSupply = IERC20(_tokens[i]).totalSupply();
uint256 aStableTokenValueInGold = stableTokenSupply.mul(goldAmount).div(stableAmount);
stableTokensValueInGold = stableTokensValueInGold.add(aStableTokenValueInGold);
}
return
FixidityLib
.newFixed(reserveGoldBalance)
.divide(cgldWeight)
.divide(FixidityLib.newFixed(stableTokensValueInGold))
.unwrap();
}
/*
* Internal functions
*/
/**
* @notice Computes a tobin tax based on the reserve ratio.
* @return The tobin tax expresesed as a fixidity fraction.
*/
function computeTobinTax() private view returns (FixidityLib.Fraction memory) {
FixidityLib.Fraction memory ratio = FixidityLib.wrap(getReserveRatio());
if (ratio.gte(FixidityLib.wrap(tobinTaxReserveRatio))) {
return FixidityLib.wrap(0);
} else {
return FixidityLib.wrap(tobinTax);
}
}
}

IAccounts.sol

pragma solidity ^0.5.13;
interface IAccounts {
function isAccount(address) external view returns (bool);
function voteSignerToAccount(address) external view returns (address);
function validatorSignerToAccount(address) external view returns (address);
function attestationSignerToAccount(address) external view returns (address);
function signerToAccount(address) external view returns (address);
function getAttestationSigner(address) external view returns (address);
function getValidatorSigner(address) external view returns (address);
function getVoteSigner(address) external view returns (address);
function hasAuthorizedVoteSigner(address) external view returns (bool);
function hasAuthorizedValidatorSigner(address) external view returns (bool);
function hasAuthorizedAttestationSigner(address) external view returns (bool);
function setAccountDataEncryptionKey(bytes calldata) external;
function setMetadataURL(string calldata) external;
function setName(string calldata) external;
function setWalletAddress(address, uint8, bytes32, bytes32) external;
function setAccount(string calldata, bytes calldata, address, uint8, bytes32, bytes32) external;
function getDataEncryptionKey(address) external view returns (bytes memory);
function getWalletAddress(address) external view returns (address);
function getMetadataURL(address) external view returns (string memory);
function batchGetMetadataURL(address[] calldata)
external
view
returns (uint256[] memory, bytes memory);
function getName(address) external view returns (string memory);
function authorizeVoteSigner(address, uint8, bytes32, bytes32) external;
function authorizeValidatorSigner(address, uint8, bytes32, bytes32) external;
function authorizeValidatorSignerWithPublicKey(address, uint8, bytes32, bytes32, bytes calldata)
external;
function authorizeValidatorSignerWithKeys(
address,
uint8,
bytes32,
bytes32,
bytes calldata,
bytes calldata,
bytes calldata
) external;
function authorizeAttestationSigner(address, uint8, bytes32, bytes32) external;
function createAccount() external returns (bool);
}

Address.sol

pragma solidity ^0.5.5;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*
* _Available since v2.4.0._
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}

IERC20.sol

pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}

Ownable.sol

pragma solidity ^0.5.0;
import "../GSN/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}

SafeMath.sol

pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}

Context.sol

pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}

IStableToken.sol

pragma solidity ^0.5.13;
/**
* @title This interface describes the functions specific to Celo Stable Tokens, and in the
* absence of interface inheritance is intended as a companion to IERC20.sol and ICeloToken.sol.
*/
interface IStableToken {
function mint(address, uint256) external returns (bool);
function burn(uint256) external returns (bool);
function setInflationParameters(uint256, uint256) external;
function valueToUnits(uint256) external view returns (uint256);
function unitsToValue(uint256) external view returns (uint256);
function getInflationParameters() external view returns (uint256, uint256, uint256, uint256);
// NOTE: duplicated with IERC20.sol, remove once interface inheritance is supported.
function balanceOf(address) external view returns (uint256);
}

ISortedOracles.sol

pragma solidity ^0.5.13;
interface ISortedOracles {
function addOracle(address, address) external;
function removeOracle(address, address, uint256) external;
function report(address, uint256, address, address) external;
function removeExpiredReports(address, uint256) external;
function isOldestReportExpired(address token) external view returns (bool, address);
function numRates(address) external view returns (uint256);
function medianRate(address) external view returns (uint256, uint256);
function numTimestamps(address) external view returns (uint256);
function medianTimestamp(address) external view returns (uint256);
}

IReserve.sol

pragma solidity ^0.5.13;
interface IReserve {
function setTobinTaxStalenessThreshold(uint256) external;
function addToken(address) external returns (bool);
function removeToken(address, uint256) external returns (bool);
function transferGold(address payable, uint256) external returns (bool);
function transferExchangeGold(address payable, uint256) external returns (bool);
function getReserveGoldBalance() external view returns (uint256);
function getUnfrozenReserveGoldBalance() external view returns (uint256);
function getOrComputeTobinTax() external returns (uint256, uint256);
function getTokens() external view returns (address[] memory);
function getReserveRatio() external view returns (uint256);
function addExchangeSpender(address) external;
function removeExchangeSpender(address, uint256) external;
function addSpender(address) external;
function removeSpender(address) external;
}

IExchange.sol

pragma solidity ^0.5.13;
interface IExchange {
function buy(uint256, uint256, bool) external returns (uint256);
function sell(uint256, uint256, bool) external returns (uint256);
function exchange(uint256, uint256, bool) external returns (uint256);
function setUpdateFrequency(uint256) external;
function getBuyTokenAmount(uint256, bool) external view returns (uint256);
function getSellTokenAmount(uint256, bool) external view returns (uint256);
function getBuyAndSellBuckets(bool) external view returns (uint256, uint256);
}

IRandom.sol

pragma solidity ^0.5.13;
interface IRandom {
function revealAndCommit(bytes32, bytes32, address) external;
function randomnessBlockRetentionWindow() external view returns (uint256);
function random() external view returns (bytes32);
function getBlockRandomness(uint256) external view returns (bytes32);
}

IAttestations.sol

pragma solidity ^0.5.13;
interface IAttestations {
function request(bytes32, uint256, address) external;
function selectIssuers(bytes32) external;
function complete(bytes32, uint8, bytes32, bytes32) external;
function revoke(bytes32, uint256) external;
function withdraw(address) external;
function approveTransfer(bytes32, uint256, address, address, bool) external;
// view functions
function getUnselectedRequest(bytes32, address) external view returns (uint32, uint32, address);
function getAttestationIssuers(bytes32, address) external view returns (address[] memory);
function getAttestationStats(bytes32, address) external view returns (uint32, uint32);
function batchGetAttestationStats(bytes32[] calldata)
external
view
returns (uint256[] memory, address[] memory, uint64[] memory, uint64[] memory);
function getAttestationState(bytes32, address, address)
external
view
returns (uint8, uint32, address);
function getCompletableAttestations(bytes32, address)
external
view
returns (uint32[] memory, address[] memory, uint256[] memory, bytes memory);
function getAttestationRequestFee(address) external view returns (uint256);
function getMaxAttestations() external view returns (uint256);
function validateAttestationCode(bytes32, address, uint8, bytes32, bytes32)
external
view
returns (address);
function lookupAccountsForIdentifier(bytes32) external view returns (address[] memory);
function requireNAttestationsRequested(bytes32, address, uint32) external view;
// only owner
function setAttestationRequestFee(address, uint256) external;
function setAttestationExpiryBlocks(uint256) external;
function setSelectIssuersWaitBlocks(uint256) external;
function setMaxAttestations(uint256) external;
}

IValidators.sol

pragma solidity ^0.5.13;
interface IValidators {
function registerValidator(bytes calldata, bytes calldata, bytes calldata)
external
returns (bool);
function deregisterValidator(uint256) external returns (bool);
function affiliate(address) external returns (bool);
function deaffiliate() external returns (bool);
function updateBlsPublicKey(bytes calldata, bytes calldata) external returns (bool);
function registerValidatorGroup(uint256) external returns (bool);
function deregisterValidatorGroup(uint256) external returns (bool);
function addMember(address) external returns (bool);
function addFirstMember(address, address, address) external returns (bool);
function removeMember(address) external returns (bool);
function reorderMember(address, address, address) external returns (bool);
function updateCommission() external;
function setNextCommissionUpdate(uint256) external;
function resetSlashingMultiplier() external;
// only owner
function setCommissionUpdateDelay(uint256) external;
function setMaxGroupSize(uint256) external returns (bool);
function setMembershipHistoryLength(uint256) external returns (bool);
function setValidatorScoreParameters(uint256, uint256) external returns (bool);
function setGroupLockedGoldRequirements(uint256, uint256) external returns (bool);
function setValidatorLockedGoldRequirements(uint256, uint256) external returns (bool);
function setSlashingMultiplierResetPeriod(uint256) external;
// view functions
function getMaxGroupSize() external view returns (uint256);
function getCommissionUpdateDelay() external view returns (uint256);
function getValidatorScoreParameters() external view returns (uint256, uint256);
function getMembershipHistory(address)
external
view
returns (uint256[] memory, address[] memory, uint256, uint256);
function calculateEpochScore(uint256) external view returns (uint256);
function calculateGroupEpochScore(uint256[] calldata) external view returns (uint256);
function getAccountLockedGoldRequirement(address) external view returns (uint256);
function meetsAccountLockedGoldRequirements(address) external view returns (bool);
function getValidatorBlsPublicKeyFromSigner(address) external view returns (bytes memory);
function getValidator(address account)
external
view
returns (bytes memory, bytes memory, address, uint256, address);
function getValidatorGroup(address)
external
view
returns (address[] memory, uint256, uint256, uint256, uint256[] memory, uint256, uint256);
function getGroupNumMembers(address) external view returns (uint256);
function getTopGroupValidators(address, uint256) external view returns (address[] memory);
function getGroupsNumMembers(address[] calldata accounts)
external
view
returns (uint256[] memory);
function getNumRegisteredValidators() external view returns (uint256);
function groupMembershipInEpoch(address, uint256, uint256) external view returns (address);
// only registered contract
function updateEcdsaPublicKey(address, address, bytes calldata) external returns (bool);
function updatePublicKeys(address, address, bytes calldata, bytes calldata, bytes calldata)
external
returns (bool);
function getValidatorLockedGoldRequirements() external view returns (uint256, uint256);
function getGroupLockedGoldRequirements() external view returns (uint256, uint256);
function getRegisteredValidators() external view returns (address[] memory);
function getRegisteredValidatorSigners() external view returns (address[] memory);
function getRegisteredValidatorGroups() external view returns (address[] memory);
function isValidatorGroup(address) external view returns (bool);
function isValidator(address) external view returns (bool);
function getValidatorGroupSlashingMultiplier(address) external view returns (uint256);
function getMembershipInLastEpoch(address) external view returns (address);
function getMembershipInLastEpochFromSigner(address) external view returns (address);
// only VM
function updateValidatorScoreFromSigner(address, uint256) external;
function distributeEpochPaymentsFromSigner(address, uint256) external returns (uint256);
// only slasher
function forceDeaffiliateIfValidator(address) external;
function halveSlashingMultiplier(address) external;
}

ILockedGold.sol

pragma solidity ^0.5.13;
interface ILockedGold {
function incrementNonvotingAccountBalance(address, uint256) external;
function decrementNonvotingAccountBalance(address, uint256) external;
function getAccountTotalLockedGold(address) external view returns (uint256);
function getTotalLockedGold() external view returns (uint256);
function getPendingWithdrawals(address)
external
view
returns (uint256[] memory, uint256[] memory);
function getTotalPendingWithdrawals(address) external view returns (uint256);
function lock() external payable;
function unlock(uint256) external;
function relock(uint256, uint256) external;
function withdraw(uint256) external;
function slash(
address account,
uint256 penalty,
address reporter,
uint256 reward,
address[] calldata lessers,
address[] calldata greaters,
uint256[] calldata indices
) external;
function isSlasher(address) external view returns (bool);
}

IGovernance.sol

pragma solidity ^0.5.13;
interface IGovernance {
function isVoting(address) external view returns (bool);
}

IElection.sol

pragma solidity ^0.5.13;
interface IElection {
function electValidatorSigners() external view returns (address[] memory);
function electNValidatorSigners(uint256, uint256) external view returns (address[] memory);
function vote(address, uint256, address, address) external returns (bool);
function activate(address) external returns (bool);
function revokeActive(address, uint256, address, address, uint256) external returns (bool);
function revokeAllActive(address, address, address, uint256) external returns (bool);
function revokePending(address, uint256, address, address, uint256) external returns (bool);
function markGroupIneligible(address) external;
function markGroupEligible(address, address, address) external;
function forceDecrementVotes(
address,
uint256,
address[] calldata,
address[] calldata,
uint256[] calldata
) external returns (uint256);
// view functions
function getElectableValidators() external view returns (uint256, uint256);
function getElectabilityThreshold() external view returns (uint256);
function getNumVotesReceivable(address) external view returns (uint256);
function getTotalVotes() external view returns (uint256);
function getActiveVotes() external view returns (uint256);
function getTotalVotesByAccount(address) external view returns (uint256);
function getPendingVotesForGroupByAccount(address, address) external view returns (uint256);
function getActiveVotesForGroupByAccount(address, address) external view returns (uint256);
function getTotalVotesForGroupByAccount(address, address) external view returns (uint256);
function getActiveVoteUnitsForGroupByAccount(address, address) external view returns (uint256);
function getTotalVotesForGroup(address) external view returns (uint256);
function getActiveVotesForGroup(address) external view returns (uint256);
function getPendingVotesForGroup(address) external view returns (uint256);
function getGroupEligibility(address) external view returns (bool);
function getGroupEpochRewards(address, uint256, uint256[] calldata)
external
view
returns (uint256);
function getGroupsVotedForByAccount(address) external view returns (address[] memory);
function getEligibleValidatorGroups() external view returns (address[] memory);
function getTotalVotesForEligibleValidatorGroups()
external
view
returns (address[] memory, uint256[] memory);
function getCurrentValidatorSigners() external view returns (address[] memory);
function canReceiveVotes(address, uint256) external view returns (bool);
function hasActivatablePendingVotes(address, address) external view returns (bool);
// only owner
function setElectableValidators(uint256, uint256) external returns (bool);
function setMaxNumGroupsVotedFor(uint256) external returns (bool);
function setElectabilityThreshold(uint256) external returns (bool);
// only VM
function distributeEpochRewards(address, uint256, address, address) external;
}

ReentrancyGuard.sol

pragma solidity ^0.5.13;
/**
* @title Helps contracts guard against reentrancy attacks.
* @author Remco Bloemen <[email protected]π.com>, Eenae <[email protected]>
* @dev If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
constructor() internal {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_guardCounter += 1;
uint256 localCounter = _guardCounter;
_;
require(localCounter == _guardCounter, "reentrant call");
}
}

IRegistry.sol

pragma solidity ^0.5.13;
interface IRegistry {
function setAddressFor(string calldata, address) external;
function getAddressForOrDie(bytes32) external view returns (address);
function getAddressFor(bytes32) external view returns (address);
function getAddressForStringOrDie(string calldata identifier) external view returns (address);
function getAddressForString(string calldata identifier) external view returns (address);
function isOneOf(bytes32[] calldata, address) external view returns (bool);
}

IFreezer.sol

pragma solidity ^0.5.13;
interface IFreezer {
function isFrozen(address) external view returns (bool);
}

IFeeCurrencyWhitelist.sol

pragma solidity ^0.5.13;
interface IFeeCurrencyWhitelist {
function addToken(address) external;
function getWhitelist() external view returns (address[] memory);
}

ICeloVersionedContract.sol

pragma solidity ^0.5.13;
interface ICeloVersionedContract {
/**
* @notice Returns the storage, major, minor, and patch version of the contract.
* @return The storage, major, minor, and patch version of the contract.
*/
function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256);
}

UsingRegistry.sol

pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IAccounts.sol";
import "./interfaces/IFeeCurrencyWhitelist.sol";
import "./interfaces/IFreezer.sol";
import "./interfaces/IRegistry.sol";
import "../governance/interfaces/IElection.sol";
import "../governance/interfaces/IGovernance.sol";
import "../governance/interfaces/ILockedGold.sol";
import "../governance/interfaces/IValidators.sol";
import "../identity/interfaces/IRandom.sol";
import "../identity/interfaces/IAttestations.sol";
import "../stability/interfaces/IExchange.sol";
import "../stability/interfaces/IReserve.sol";
import "../stability/interfaces/ISortedOracles.sol";
import "../stability/interfaces/IStableToken.sol";
contract UsingRegistry is Ownable {
event RegistrySet(address indexed registryAddress);
// solhint-disable state-visibility
bytes32 constant ACCOUNTS_REGISTRY_ID = keccak256(abi.encodePacked("Accounts"));
bytes32 constant ATTESTATIONS_REGISTRY_ID = keccak256(abi.encodePacked("Attestations"));
bytes32 constant DOWNTIME_SLASHER_REGISTRY_ID = keccak256(abi.encodePacked("DowntimeSlasher"));
bytes32 constant DOUBLE_SIGNING_SLASHER_REGISTRY_ID = keccak256(
abi.encodePacked("DoubleSigningSlasher")
);
bytes32 constant ELECTION_REGISTRY_ID = keccak256(abi.encodePacked("Election"));
bytes32 constant EXCHANGE_REGISTRY_ID = keccak256(abi.encodePacked("Exchange"));
bytes32 constant FEE_CURRENCY_WHITELIST_REGISTRY_ID = keccak256(
abi.encodePacked("FeeCurrencyWhitelist")
);
bytes32 constant FREEZER_REGISTRY_ID = keccak256(abi.encodePacked("Freezer"));
bytes32 constant GOLD_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("GoldToken"));
bytes32 constant GOVERNANCE_REGISTRY_ID = keccak256(abi.encodePacked("Governance"));
bytes32 constant GOVERNANCE_SLASHER_REGISTRY_ID = keccak256(
abi.encodePacked("GovernanceSlasher")
);
bytes32 constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold"));
bytes32 constant RESERVE_REGISTRY_ID = keccak256(abi.encodePacked("Reserve"));
bytes32 constant RANDOM_REGISTRY_ID = keccak256(abi.encodePacked("Random"));
bytes32 constant SORTED_ORACLES_REGISTRY_ID = keccak256(abi.encodePacked("SortedOracles"));
bytes32 constant STABLE_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("StableToken"));
bytes32 constant VALIDATORS_REGISTRY_ID = keccak256(abi.encodePacked("Validators"));
// solhint-enable state-visibility
IRegistry public registry;
modifier onlyRegisteredContract(bytes32 identifierHash) {
require(registry.getAddressForOrDie(identifierHash) == msg.sender, "only registered contract");
_;
}
modifier onlyRegisteredContracts(bytes32[] memory identifierHashes) {
require(registry.isOneOf(identifierHashes, msg.sender), "only registered contracts");
_;
}
/**
* @notice Updates the address pointing to a Registry contract.
* @param registryAddress The address of a registry contract for routing to other contracts.
*/
function setRegistry(address registryAddress) public onlyOwner {
require(registryAddress != address(0), "Cannot register the null address");
registry = IRegistry(registryAddress);
emit RegistrySet(registryAddress);
}
function getAccounts() internal view returns (IAccounts) {
return IAccounts(registry.getAddressForOrDie(ACCOUNTS_REGISTRY_ID));
}
function getAttestations() internal view returns (IAttestations) {
return IAttestations(registry.getAddressForOrDie(ATTESTATIONS_REGISTRY_ID));
}
function getElection() internal view returns (IElection) {
return IElection(registry.getAddressForOrDie(ELECTION_REGISTRY_ID));
}
function getExchange() internal view returns (IExchange) {
return IExchange(registry.getAddressForOrDie(EXCHANGE_REGISTRY_ID));
}
function getFeeCurrencyWhitelistRegistry() internal view returns (IFeeCurrencyWhitelist) {
return IFeeCurrencyWhitelist(registry.getAddressForOrDie(FEE_CURRENCY_WHITELIST_REGISTRY_ID));
}
function getFreezer() internal view returns (IFreezer) {
return IFreezer(registry.getAddressForOrDie(FREEZER_REGISTRY_ID));
}
function getGoldToken() internal view returns (IERC20) {
return IERC20(registry.getAddressForOrDie(GOLD_TOKEN_REGISTRY_ID));
}
function getGovernance() internal view returns (IGovernance) {
return IGovernance(registry.getAddressForOrDie(GOVERNANCE_REGISTRY_ID));
}
function getLockedGold() internal view returns (ILockedGold) {
return ILockedGold(registry.getAddressForOrDie(LOCKED_GOLD_REGISTRY_ID));
}
function getRandom() internal view returns (IRandom) {
return IRandom(registry.getAddressForOrDie(RANDOM_REGISTRY_ID));
}
function getReserve() internal view returns (IReserve) {
return IReserve(registry.getAddressForOrDie(RESERVE_REGISTRY_ID));
}
function getSortedOracles() internal view returns (ISortedOracles) {
return ISortedOracles(registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID));
}
function getStableToken() internal view returns (IStableToken) {
return IStableToken(registry.getAddressForOrDie(STABLE_TOKEN_REGISTRY_ID));
}
function getValidators() internal view returns (IValidators) {
return IValidators(registry.getAddressForOrDie(VALIDATORS_REGISTRY_ID));
}
}

Initializable.sol

pragma solidity ^0.5.13;
contract Initializable {
bool public initialized;
constructor(bool testingDeployment) public {
if (!testingDeployment) {
initialized = true;
}
}
modifier initializer() {
require(!initialized, "contract already initialized");
initialized = true;
_;
}
}

FixidityLib.sol

pragma solidity ^0.5.13;
/**
* @title FixidityLib
* @author Gadi Guy, Alberto Cuesta Canada
* @notice This library provides fixed point arithmetic with protection against
* overflow.
* All operations are done with uint256 and the operands must have been created
* with any of the newFrom* functions, which shift the comma digits() to the
* right and check for limits, or with wrap() which expects a number already
* in the internal representation of a fraction.
* When using this library be sure to use maxNewFixed() as the upper limit for
* creation of fixed point numbers.
* @dev All contained functions are pure and thus marked internal to be inlined
* on consuming contracts at compile time for gas efficiency.
*/
library FixidityLib {
struct Fraction {
uint256 value;
}
/**
* @notice Number of positions that the comma is shifted to the right.
*/
function digits() internal pure returns (uint8) {
return 24;
}
uint256 private constant FIXED1_UINT = 1000000000000000000000000;
/**
* @notice This is 1 in the fixed point units used in this library.
* @dev Test fixed1() equals 10^digits()
* Hardcoded to 24 digits.
*/
function fixed1() internal pure returns (Fraction memory) {
return Fraction(FIXED1_UINT);
}
/**
* @notice Wrap a uint256 that represents a 24-decimal fraction in a Fraction
* struct.
* @param x Number that already represents a 24-decimal fraction.
* @return A Fraction struct with contents x.
*/
function wrap(uint256 x) internal pure returns (Fraction memory) {
return Fraction(x);
}
/**
* @notice Unwraps the uint256 inside of a Fraction struct.
*/
function unwrap(Fraction memory x) internal pure returns (uint256) {
return x.value;
}
/**
* @notice The amount of decimals lost on each multiplication operand.
* @dev Test mulPrecision() equals sqrt(fixed1)
*/
function mulPrecision() internal pure returns (uint256) {
return 1000000000000;
}
/**
* @notice Maximum value that can be converted to fixed point. Optimize for deployment.
* @dev
* Test maxNewFixed() equals maxUint256() / fixed1()
*/
function maxNewFixed() internal pure returns (uint256) {
return 115792089237316195423570985008687907853269984665640564;
}
/**
* @notice Converts a uint256 to fixed point Fraction
* @dev Test newFixed(0) returns 0
* Test newFixed(1) returns fixed1()
* Test newFixed(maxNewFixed()) returns maxNewFixed() * fixed1()
* Test newFixed(maxNewFixed()+1) fails
*/
function newFixed(uint256 x) internal pure returns (Fraction memory) {
require(x <= maxNewFixed(), "can't create fixidity number larger than maxNewFixed()");
return Fraction(x * FIXED1_UINT);
}
/**
* @notice Converts a uint256 in the fixed point representation of this
* library to a non decimal. All decimal digits will be truncated.
*/
function fromFixed(Fraction memory x) internal pure returns (uint256) {
return x.value / FIXED1_UINT;
}
/**
* @notice Converts two uint256 representing a fraction to fixed point units,
* equivalent to multiplying dividend and divisor by 10^digits().
* @param numerator numerator must be <= maxNewFixed()
* @param denominator denominator must be <= maxNewFixed() and denominator can't be 0
* @dev
* Test newFixedFraction(1,0) fails
* Test newFixedFraction(0,1) returns 0
* Test newFixedFraction(1,1) returns fixed1()
* Test newFixedFraction(1,fixed1()) returns 1
*/
function newFixedFraction(uint256 numerator, uint256 denominator)
internal
pure
returns (Fraction memory)
{
Fraction memory convertedNumerator = newFixed(numerator);
Fraction memory convertedDenominator = newFixed(denominator);
return divide(convertedNumerator, convertedDenominator);
}
/**
* @notice Returns the integer part of a fixed point number.
* @dev
* Test integer(0) returns 0
* Test integer(fixed1()) returns fixed1()
* Test integer(newFixed(maxNewFixed())) returns maxNewFixed()*fixed1()
*/
function integer(Fraction memory x) internal pure returns (Fraction memory) {
return Fraction((x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
}
/**
* @notice Returns the fractional part of a fixed point number.
* In the case of a negative number the fractional is also negative.
* @dev
* Test fractional(0) returns 0
* Test fractional(fixed1()) returns 0
* Test fractional(fixed1()-1) returns 10^24-1
*/
function fractional(Fraction memory x) internal pure returns (Fraction memory) {
return Fraction(x.value - (x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
}
/**
* @notice x+y.
* @dev The maximum value that can be safely used as an addition operator is defined as
* maxFixedAdd = maxUint256()-1 / 2, or
* 57896044618658097711785492504343953926634992332820282019728792003956564819967.
* Test add(maxFixedAdd,maxFixedAdd) equals maxFixedAdd + maxFixedAdd
* Test add(maxFixedAdd+1,maxFixedAdd+1) throws
*/
function add(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
uint256 z = x.value + y.value;
require(z >= x.value, "add overflow detected");
return Fraction(z);
}
/**
* @notice x-y.
* @dev
* Test subtract(6, 10) fails
*/
function subtract(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
require(x.value >= y.value, "substraction underflow detected");
return Fraction(x.value - y.value);
}
/**
* @notice x*y. If any of the operators is higher than the max multiplier value it
* might overflow.
* @dev The maximum value that can be safely used as a multiplication operator
* (maxFixedMul) is calculated as sqrt(maxUint256()*fixed1()),
* or 340282366920938463463374607431768211455999999999999
* Test multiply(0,0) returns 0
* Test multiply(maxFixedMul,0) returns 0
* Test multiply(0,maxFixedMul) returns 0
* Test multiply(fixed1()/mulPrecision(),fixed1()*mulPrecision()) returns fixed1()
* Test multiply(maxFixedMul,maxFixedMul) is around maxUint256()
* Test multiply(maxFixedMul+1,maxFixedMul+1) fails
*/
function multiply(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
if (x.value == 0 || y.value == 0) return Fraction(0);
if (y.value == FIXED1_UINT) return x;
if (x.value == FIXED1_UINT) return y;
// Separate into integer and fractional parts
// x = x1 + x2, y = y1 + y2
uint256 x1 = integer(x).value / FIXED1_UINT;
uint256 x2 = fractional(x).value;
uint256 y1 = integer(y).value / FIXED1_UINT;
uint256 y2 = fractional(y).value;
// (x1 + x2) * (y1 + y2) = (x1 * y1) + (x1 * y2) + (x2 * y1) + (x2 * y2)
uint256 x1y1 = x1 * y1;
if (x1 != 0) require(x1y1 / x1 == y1, "overflow x1y1 detected");
// x1y1 needs to be multiplied back by fixed1
// solium-disable-next-line mixedcase
uint256 fixed_x1y1 = x1y1 * FIXED1_UINT;
if (x1y1 != 0) require(fixed_x1y1 / x1y1 == FIXED1_UINT, "overflow x1y1 * fixed1 detected");
x1y1 = fixed_x1y1;
uint256 x2y1 = x2 * y1;
if (x2 != 0) require(x2y1 / x2 == y1, "overflow x2y1 detected");
uint256 x1y2 = x1 * y2;
if (x1 != 0) require(x1y2 / x1 == y2, "overflow x1y2 detected");
x2 = x2 / mulPrecision();
y2 = y2 / mulPrecision();
uint256 x2y2 = x2 * y2;
if (x2 != 0) require(x2y2 / x2 == y2, "overflow x2y2 detected");
// result = fixed1() * x1 * y1 + x1 * y2 + x2 * y1 + x2 * y2 / fixed1();
Fraction memory result = Fraction(x1y1);
result = add(result, Fraction(x2y1)); // Add checks for overflow
result = add(result, Fraction(x1y2)); // Add checks for overflow
result = add(result, Fraction(x2y2)); // Add checks for overflow
return result;
}
/**
* @notice 1/x
* @dev
* Test reciprocal(0) fails
* Test reciprocal(fixed1()) returns fixed1()
* Test reciprocal(fixed1()*fixed1()) returns 1 // Testing how the fractional is truncated
* Test reciprocal(1+fixed1()*fixed1()) returns 0 // Testing how the fractional is truncated
* Test reciprocal(newFixedFraction(1, 1e24)) returns newFixed(1e24)
*/
function reciprocal(Fraction memory x) internal pure returns (Fraction memory) {
require(x.value != 0, "can't call reciprocal(0)");
return Fraction((FIXED1_UINT * FIXED1_UINT) / x.value); // Can't overflow
}
/**
* @notice x/y. If the dividend is higher than the max dividend value, it
* might overflow. You can use multiply(x,reciprocal(y)) instead.
* @dev The maximum value that can be safely used as a dividend (maxNewFixed) is defined as
* divide(maxNewFixed,newFixedFraction(1,fixed1())) is around maxUint256().
* This yields the value 115792089237316195423570985008687907853269984665640564.
* Test maxNewFixed equals maxUint256()/fixed1()
* Test divide(maxNewFixed,1) equals maxNewFixed*(fixed1)
* Test divide(maxNewFixed+1,multiply(mulPrecision(),mulPrecision())) throws
* Test divide(fixed1(),0) fails
* Test divide(maxNewFixed,1) = maxNewFixed*(10^digits())
* Test divide(maxNewFixed+1,1) throws
*/
function divide(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
require(y.value != 0, "can't divide by 0");
uint256 X = x.value * FIXED1_UINT;
require(X / FIXED1_UINT == x.value, "overflow at divide");
return Fraction(X / y.value);
}
/**
* @notice x > y
*/
function gt(Fraction memory x, Fraction memory y) internal pure returns (bool) {
return x.value > y.value;
}
/**
* @notice x >= y
*/
function gte(Fraction memory x, Fraction memory y) internal pure returns (bool) {
return x.value >= y.value;
}
/**
* @notice x < y
*/
function lt(Fraction memory x, Fraction memory y) internal pure returns (bool) {
return x.value < y.value;
}
/**
* @notice x <= y
*/
function lte(Fraction memory x, Fraction memory y) internal pure returns (bool) {
return x.value <= y.value;
}
/**
* @notice x == y
*/
function equals(Fraction memory x, Fraction memory y) internal pure returns (bool) {
return x.value == y.value;
}
/**
* @notice x <= 1
*/
function isProperFraction(Fraction memory x) internal pure returns (bool) {
return lte(x, fixed1());
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"AssetAllocationSet","inputs":[{"type":"bytes32[]","name":"symbols","internalType":"bytes32[]","indexed":false},{"type":"uint256[]","name":"weights","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"event","name":"DailySpendingRatioSet","inputs":[{"type":"uint256","name":"ratio","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ExchangeSpenderAdded","inputs":[{"type":"address","name":"exchangeSpender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ExchangeSpenderRemoved","inputs":[{"type":"address","name":"exchangeSpender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OtherReserveAddressAdded","inputs":[{"type":"address","name":"otherReserveAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OtherReserveAddressRemoved","inputs":[{"type":"address","name":"otherReserveAddress","internalType":"address","indexed":true},{"type":"uint256","name":"index","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RegistrySet","inputs":[{"type":"address","name":"registryAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveGoldTransferred","inputs":[{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SpenderAdded","inputs":[{"type":"address","name":"spender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SpenderRemoved","inputs":[{"type":"address","name":"spender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TobinTaxReserveRatioSet","inputs":[{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TobinTaxSet","inputs":[{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TobinTaxStalenessThresholdSet","inputs":[{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TokenAdded","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TokenRemoved","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"index","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"fallback","stateMutability":"payable","payable":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addExchangeSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addOtherReserveAddress","inputs":[{"type":"address","name":"reserveAddress","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addToken","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"assetAllocationSymbols","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"assetAllocationWeights","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"exchangeSpenderAddresses","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"frozenReserveGoldDays","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"frozenReserveGoldStartBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"frozenReserveGoldStartDay","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"}],"name":"getAssetAllocationSymbols","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getAssetAllocationWeights","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getDailySpendingRatio","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getExchangeSpenders","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getFrozenReserveGoldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getOrComputeTobinTax","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getOtherReserveAddresses","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getOtherReserveAddressesGoldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getReserveGoldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getReserveRatio","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getTokens","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getUnfrozenBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getUnfrozenReserveGoldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersionNumber","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"initialize","inputs":[{"type":"address","name":"registryAddress","internalType":"address"},{"type":"uint256","name":"_tobinTaxStalenessThreshold","internalType":"uint256"},{"type":"uint256","name":"_spendingRatio","internalType":"uint256"},{"type":"uint256","name":"_frozenGold","internalType":"uint256"},{"type":"uint256","name":"_frozenDays","internalType":"uint256"},{"type":"bytes32[]","name":"_assetAllocationSymbols","internalType":"bytes32[]"},{"type":"uint256[]","name":"_assetAllocationWeights","internalType":"uint256[]"},{"type":"uint256","name":"_tobinTax","internalType":"uint256"},{"type":"uint256","name":"_tobinTaxReserveRatio","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"initialized","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExchangeSpender","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOtherReserveAddress","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSpender","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isToken","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastSpendingDay","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"otherReserveAddresses","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registry","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeExchangeSpender","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeOtherReserveAddress","inputs":[{"type":"address","name":"reserveAddress","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setAssetAllocations","inputs":[{"type":"bytes32[]","name":"symbols","internalType":"bytes32[]"},{"type":"uint256[]","name":"weights","internalType":"uint256[]"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setDailySpendingRatio","inputs":[{"type":"uint256","name":"ratio","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setFrozenGold","inputs":[{"type":"uint256","name":"frozenGold","internalType":"uint256"},{"type":"uint256","name":"frozenDays","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setRegistry","inputs":[{"type":"address","name":"registryAddress","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setTobinTax","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setTobinTaxReserveRatio","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setTobinTaxStalenessThreshold","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"spendingLimit","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tobinTax","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint128","name":"numerator","internalType":"uint128"},{"type":"uint128","name":"timestamp","internalType":"uint128"}],"name":"tobinTaxCache","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tobinTaxReserveRatio","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tobinTaxStalenessThreshold","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferExchangeGold","inputs":[{"type":"address","name":"to","internalType":"address payable"},{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferGold","inputs":[{"type":"address","name":"to","internalType":"address payable"},{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}],"constant":false}]
            

Deployed ByteCode

Verify & Publish
0x6080604052600436106103505760003560e01c806381b861a6116101c6578063ad62ad10116100f7578063e6b76e9c11610095578063ec4f797b1161006f578063ec4f797b1461146e578063f0b7182b146114bd578063f2fde38b1461150e578063fa9ed95a1461155f57610350565b8063e6b76e9c1461139d578063e7e31e7a146113d8578063e83b373b1461142957610350565b8063d48bfca7116100d1578063d48bfca714611272578063e30f579d146112db578063e33a88e714611306578063e50a6c1e1461133157610350565b8063ad62ad1014611083578063b003dcf1146110be578063ca56d33b1461111957610350565b80638f32d59b11610164578063a1ab55b31161013e578063a1ab55b314610e53578063a3e1f00d14610e8e578063a91ee0dc14610fc6578063aa6ca8081461101757610350565b80638f32d59b14610d4f5780639a206ece14610d7e5780639c3e2f0f14610de757610350565b80638b7df8d4116101a05780638b7df8d414610c515780638ce5877c14610c7c5780638d9a5e6f14610ccd5780638da5cb5b14610cf857610350565b806381b861a614610b8f5780638438796a14610bba578063894098d614610c2657610350565b806339d7f76e116102a05780637090db4e1161023e57806376769a601161021857806376769a6014610a795780637897a78e14610aa45780637b10399914610acf5780637b52207514610b2657610350565b80637090db4e14610a0c578063715018a614610a37578063765c1fe914610a4e57610350565b806354255be01161027a57806354255be0146108b357806356b6d0d5146108f35780635a18b08b1461091e5780635c4a31451461099957610350565b806339d7f76e146107a457806340899365146107cf5780634cea8ded1461084a57610350565b8063158ef93e1161030d5780631c39c7d5116102e75780631c39c7d514610623578063220159681461069657806322796e83146106ff5780632aa1c16d1461077957610350565b8063158ef93e1461055957806317f9a6f71461058857806319f37361146105ba57610350565b806301da32bd1461035257806303a0fea31461038d57806303d835f3146104005780630db279be1461042b5780631218f9821461047a57806313baf1e6146104e6575b005b34801561035e57600080fd5b5061038b6004803603602081101561037557600080fd5b810190808035906020019092919050505061158a565b005b34801561039957600080fd5b506103e6600480360360408110156103b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116db565b604051808215151515815260200191505060405180910390f35b34801561040c57600080fd5b506104156118d9565b6040518082815260200191505060405180910390f35b34801561043757600080fd5b506104646004803603602081101561044e57600080fd5b81019080803590602001909291905050506118df565b6040518082815260200191505060405180910390f35b34801561048657600080fd5b5061048f611900565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156104d25780820151818401526020810190506104b7565b505050509050019250505060405180910390f35b3480156104f257600080fd5b5061053f6004803603604081101561050957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061198e565b604051808215151515815260200191505060405180910390f35b34801561056557600080fd5b5061056e611d18565b604051808215151515815260200191505060405180910390f35b34801561059457600080fd5b5061059d611d2b565b604051808381526020018281526020019250505060405180910390f35b3480156105c657600080fd5b50610609600480360360208110156105dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ee1565b604051808215151515815260200191505060405180910390f35b34801561062f57600080fd5b5061067c6004803603604081101561064657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f01565b604051808215151515815260200191505060405180910390f35b3480156106a257600080fd5b506106e5600480360360208110156106b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061215c565b604051808215151515815260200191505060405180910390f35b34801561070b57600080fd5b50610714612432565b60405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b34801561078557600080fd5b5061078e61247c565b6040518082815260200191505060405180910390f35b3480156107b057600080fd5b506107b9612500565b6040518082815260200191505060405180910390f35b3480156107db57600080fd5b50610808600480360360208110156107f257600080fd5b8101908080359060200190929190505050612506565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561085657600080fd5b506108996004803603602081101561086d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612542565b604051808215151515815260200191505060405180910390f35b3480156108bf57600080fd5b506108c8612562565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b3480156108ff57600080fd5b50610908612589565b6040518082815260200191505060405180910390f35b34801561092a57600080fd5b506109576004803603602081101561094157600080fd5b8101908080359060200190929190505050612955565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109a557600080fd5b506109f2600480360360408110156109bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612991565b604051808215151515815260200191505060405180910390f35b348015610a1857600080fd5b50610a21612d19565b6040518082815260200191505060405180910390f35b348015610a4357600080fd5b50610a4c612d1f565b005b348015610a5a57600080fd5b50610a63612e58565b6040518082815260200191505060405180910390f35b348015610a8557600080fd5b50610a8e612ef8565b6040518082815260200191505060405180910390f35b348015610ab057600080fd5b50610ab9612efe565b6040518082815260200191505060405180910390f35b348015610adb57600080fd5b50610ae4612f24565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b3257600080fd5b50610b7560048036036020811015610b4957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612f4a565b604051808215151515815260200191505060405180910390f35b348015610b9b57600080fd5b50610ba4612f6a565b6040518082815260200191505060405180910390f35b348015610bc657600080fd5b50610bcf612f70565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610c12578082015181840152602081019050610bf7565b505050509050019250505060405180910390f35b348015610c3257600080fd5b50610c3b612fc8565b6040518082815260200191505060405180910390f35b348015610c5d57600080fd5b50610c66612fce565b6040518082815260200191505060405180910390f35b348015610c8857600080fd5b50610ccb60048036036020811015610c9f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ff6565b005b348015610cd957600080fd5b50610ce261310e565b6040518082815260200191505060405180910390f35b348015610d0457600080fd5b50610d0d61312f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610d5b57600080fd5b50610d64613158565b604051808215151515815260200191505060405180910390f35b348015610d8a57600080fd5b50610dcd60048036036020811015610da157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506131b6565b604051808215151515815260200191505060405180910390f35b348015610df357600080fd5b50610dfc6131d6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610e3f578082015181840152602081019050610e24565b505050509050019250505060405180910390f35b348015610e5f57600080fd5b50610e8c60048036036020811015610e7657600080fd5b8101908080359060200190929190505050613264565b005b348015610e9a57600080fd5b50610fc46004803603610120811015610eb257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190640100000000811115610f1757600080fd5b820183602082011115610f2957600080fd5b80359060200191846020830284011164010000000083111715610f4b57600080fd5b909192939192939080359060200190640100000000811115610f6c57600080fd5b820183602082011115610f7e57600080fd5b80359060200191846020830284011164010000000083111715610fa057600080fd5b90919293919293908035906020019092919080359060200190929190505050613395565b005b348015610fd257600080fd5b5061101560048036036020811015610fe957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061350c565b005b34801561102357600080fd5b5061102c6136b0565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561106f578082015181840152602081019050611054565b505050509050019250505060405180910390f35b34801561108f57600080fd5b506110bc600480360360208110156110a657600080fd5b810190808035906020019092919050505061373e565b005b3480156110ca57600080fd5b50611117600480360360408110156110e157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506137f9565b005b34801561112557600080fd5b506112706004803603604081101561113c57600080fd5b810190808035906020019064010000000081111561115957600080fd5b82018360208201111561116b57600080fd5b8035906020019184602083028401116401000000008311171561118d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156111ed57600080fd5b8201836020820111156111ff57600080fd5b8035906020019184602083028401116401000000008311171561122157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050613b7e565b005b34801561127e57600080fd5b506112c16004803603602081101561129557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614036565b604051808215151515815260200191505060405180910390f35b3480156112e757600080fd5b506112f061454f565b6040518082815260200191505060405180910390f35b34801561131257600080fd5b5061131b61458a565b6040518082815260200191505060405180910390f35b34801561133d57600080fd5b50611346614590565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561138957808201518184015260208101905061136e565b505050509050019250505060405180910390f35b3480156113a957600080fd5b506113d6600480360360208110156113c057600080fd5b8101908080359060200190929190505050614643565b005b3480156113e457600080fd5b50611427600480360360208110156113fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614775565b005b34801561143557600080fd5b5061146c6004803603604081101561144c57600080fd5b810190808035906020019092919080359060200190929190505050614930565b005b34801561147a57600080fd5b506114a76004803603602081101561149157600080fd5b8101908080359060200190929190505050614a45565b6040518082815260200191505060405180910390f35b3480156114c957600080fd5b5061150c600480360360208110156114e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614a5d565b005b34801561151a57600080fd5b5061155d6004803603602081101561153157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614d21565b005b34801561156b57600080fd5b50611574614da7565b6040518082815260200191505060405180910390f35b611592613158565b611604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61160d81614dad565b60106000820151816000015590505061164c611627614dcb565b6010604051806020016040529081600082015481525050614df190919063ffffffff16565b6116a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180615f296026913960400191505060405180910390fd5b7fb08f0607338ad77f5b08ccf831e533cefcc2d373c173e87a8f61144f1d82be1e816040518082815260200191505060405180910390a150565b600033601460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061185457508073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f45786368616e67650000000000000000000000000000000000000000000000008152506008019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561180157600080fd5b505afa158015611815573d6000803e3d6000fd5b505050506040513d602081101561182b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b6118c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f41646472657373206e6f7420616c6c6f77656420746f207370656e640000000081525060200191505060405180910390fd5b6118d08484614e07565b91505092915050565b60115481565b600c81815481106118ec57fe5b906000526020600020016000915090505481565b6060601580548060200260200160405190810160405280929190818152602001828054801561198457602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161193a575b5050505050905090565b6000611998613158565b611a0a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b82600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611aca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f746f6b656e206164647220776173206e6576657220726567697374657265640081525060200191505060405180910390fd5b60048054905083108015611b4057508373ffffffffffffffffffffffffffffffffffffffff1660048481548110611afd57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b611b95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180615f4f602a913960400191505060405180910390fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006004611c0a6001600480549050614f1e90919063ffffffff16565b81548110611c1457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508060048581548110611c4f57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611cb06001600480549050614f1e90919063ffffffff16565b600481611cbd9190615d09565b508473ffffffffffffffffffffffffffffffffffffffff167fbe9bb4bdca0a094babd75e3a98b1d2e2390633430d0a2f6e2b9970e2ee03fb2e856040518082815260200191505060405180910390a260019250505092915050565b600060149054906101000a900460ff1681565b600080600160026000828254019250508190555060006002549050600654611d8f600560000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1642614f1e90919063ffffffff16565b1115611e1d57611da5611da0614f68565b614fd0565b600560000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555042600560000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505b600560000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16611e61611e5c614dcb565b614fd0565b925092506002548114611edc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b509091565b60036020528060005260406000206000915054906101000a900460ff1681565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611fa5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180615fa3602c913960400191505060405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612047576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180615f79602a913960400191505060405180910390fd5b600062015180428161205557fe5b049050600e548111156120b657600061206c612fce565b905081600e819055506120ae6120a961208483614fde565b601060405180602001604052908160008201548152505061506890919063ffffffff16565b6154c7565b600f81905550505b82600f54101561212e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f457863656564696e67207370656e64696e67206c696d6974000000000000000081525060200191505060405180910390fd5b61214383600f54614f1e90919063ffffffff16565b600f819055506121538484614e07565b91505092915050565b6000612166613158565b6121d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600160026000828254019250508190555060006002549050600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156122b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f72657365727665206164647220616c726561647920616464656400000000000081525060200191505060405180910390fd5b6001600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b8390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508273ffffffffffffffffffffffffffffffffffffffff167fd78793225285ecf9cf5f0f84b1cdc335c2cb4d6810ff0b9fd156ad6026c89cea60405160405180910390a260019150600254811461242c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50919050565b60058060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b60008062015180428161248b57fe5b04905060006124a560125483614f1e90919063ffffffff16565b905060135481106124bb576000925050506124fd565b6124f86124e76013546124d9846011546154e890919063ffffffff16565b61556e90919063ffffffff16565b601154614f1e90919063ffffffff16565b925050505b90565b600f5481565b600b818154811061251357fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60146020528060005260406000206000915054906101000a900460ff1681565b60008060008060018060026001839350829250819150809050935093509350935090919293565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561264557600080fd5b505afa158015612659573d6000803e3d6000fd5b505050506040513d602081101561266f57600080fd5b8101908080519060200190929190505050905060008190506000612691612fce565b905060008090506126a0615d35565b6126dc600d60007f63474c4400000000000000000000000000000000000000000000000000000000815260200190815260200160002054614dad565b905060008090505b60048054905081101561290d576000808673ffffffffffffffffffffffffffffffffffffffff1663ef90e1b06004858154811061271d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b1580156127a757600080fd5b505afa1580156127bb573d6000803e3d6000fd5b505050506040513d60408110156127d157600080fd5b810190808051906020019092919080519060200190929190505050809250819350505060006004848154811061280357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561287357600080fd5b505afa158015612887573d6000803e3d6000fd5b505050506040513d602081101561289d57600080fd5b8101908080519060200190929190505050905060006128d7846128c985856154e890919063ffffffff16565b61556e90919063ffffffff16565b90506128ec81886155b890919063ffffffff16565b9650505050506129066001826155b890919063ffffffff16565b90506126e4565b5061294b61294661291d84614fde565b6129388461292a88614fde565b61564090919063ffffffff16565b61564090919063ffffffff16565b614fd0565b9550505050505090565b6015818154811061296257fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061299b613158565b612a0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612acc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f72657365727665206164647220776173206e657665722061646465640000000081525060200191505060405180910390fd5b600b8054905082108015612b4257508273ffffffffffffffffffffffffffffffffffffffff16600b8381548110612aff57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b612b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180615efc602d913960400191505060405180910390fd5b6000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600b612c0c6001600b80549050614f1e90919063ffffffff16565b81548110612c1657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905080600b8481548110612c5157fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550612cb26001600b80549050614f1e90919063ffffffff16565b600b81612cbf9190615d09565b508373ffffffffffffffffffffffffffffffffffffffff167f89b4ee5cecfdfb246ede373c10283b5038afe56a531fc1d2f3ed8c5507a52fcb846040518082815260200191505060405180910390a2600191505092915050565b60135481565b612d27613158565b612d99576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000806000905060008090505b600b80549050811015612ef057612ed3600b8281548110612e8257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631836155b890919063ffffffff16565b9150612ee96001826155b890919063ffffffff16565b9050612e65565b508091505090565b60085481565b6000612f1f6010604051806020016040529081600082015481525050614fd0565b905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a6020528060005260406000206000915054906101000a900460ff1681565b60125481565b6060600c805480602002602001604051908101604052809291908181526020018280548015612fbe57602002820191906000526020600020905b815481526020019060010190808311612faa575b5050505050905090565b60075481565b6000612ff1612fdb612e58565b612fe361454f565b6155b890919063ffffffff16565b905090565b612ffe613158565b613070576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fab8cff50266d80b9c9d9703af934ca455b9218286bf4fcaa05653a564c499e4b60405160405180910390a250565b600061312a61311b612e58565b476155b890919063ffffffff16565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661319a615789565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60096020528060005260406000206000915054906101000a900460ff1681565b6060600b80548060200260200160405190810160405280929190818152602001828054801561325a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311613210575b5050505050905090565b61326c613158565b6132de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111613354576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f76616c756520776173207a65726f00000000000000000000000000000000000081525060200191505060405180910390fd5b806006819055507f7bfe94ca3147f135fcd6d94ebf61d33fa34fbe904f933ccae66911b9548544f2816040518082815260200191505060405180910390a150565b600060149054906101000a900460ff1615613418576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff02191690831515021790555061343c33615791565b6134458b61350c565b61344e8a613264565b6134578961158a565b6134618888614930565b6134ed868680806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050613b7e565b6134f682614643565b6134ff8161373e565b5050505050505050505050565b613514613158565b613586576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613629576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f7420726567697374657220746865206e756c6c206164647265737381525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b60405160405180910390a250565b6060600480548060200260200160405190810160405280929190818152602001828054801561373457602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116136ea575b5050505050905090565b613746613158565b6137b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b806008819055507f4da8e8b2223fbbb897200fb9dfb6b986c1b4188621114d407ee8ec363569fc37816040518082815260200191505060405180910390a150565b613801613158565b613873576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000601460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000601580549050905080821061394a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f496e64657820697320696e76616c69640000000000000000000000000000000081525060200191505060405180910390fd5b6015828154811061395757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614613a22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e64657820646f6573206e6f74206d61746368207370656e6465720000000081525060200191505060405180910390fd5b6000613a38600183614f1e90919063ffffffff16565b9050808314613acf5760158181548110613a4e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660158481548110613a8657fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600060158281548110613ade57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601581613b349190615d09565b508373ffffffffffffffffffffffffffffffffffffffff167f20aaa18caa668680a42b328a15fd50d580bac65d8bd346e104355473c6373ff360405160405180910390a250505050565b613b86613158565b613bf8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8051825114613c6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4172726179206c656e677468206d69736d61746368000000000000000000000081525060200191505060405180910390fd5b613c77615d35565b613c816000614dad565b905060008090505b8251811015613cdd57613cc0613cb1848381518110613ca457fe5b6020026020010151614dad565b836158d590919063ffffffff16565b9150613cd66001826155b890919063ffffffff16565b9050613c89565b50613cf8613ce9614dcb565b8261597e90919063ffffffff16565b613d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615eba6021913960400191505060405180910390fd5b60008090505b600c80549050811015613da957600d6000600c8381548110613d7157fe5b9060005260206000200154815260200190815260200160002060009055613da26001826155b890919063ffffffff16565b9050613d53565b5082600c9080519060200190613dc0929190615d48565b5060008090505b8351811015613ec5576000600d6000868481518110613de257fe5b602002602001015181526020019081526020016000205414613e6c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74207365742077656967687420747769636500000000000000000081525060200191505060405180910390fd5b828181518110613e7857fe5b6020026020010151600d6000868481518110613e9057fe5b6020026020010151815260200190815260200160002081905550613ebe6001826155b890919063ffffffff16565b9050613dc7565b506000600d60007f63474c44000000000000000000000000000000000000000000000000000000008152602001908152602001600020541415613f70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4d757374207365742063474c442061737365742077656967687400000000000081525060200191505060405180910390fd5b7f55b488abd19ae7621712324d3d42c2ef7a9575f64f5503103286a1161fb408558383604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015613fda578082015181840152602081019050613fbf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561401c578082015181840152602081019050614001565b5050505090500194505050505060405180910390a1505050565b6000614040613158565b6140b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600160026000828254019250508190555060006002549050600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561418a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f746f6b656e206164647220616c7265616479207265676973746572656400000081525060200191505060405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561424557600080fd5b505afa158015614259573d6000803e3d6000fd5b505050506040513d602081101561426f57600080fd5b8101908080519060200190929190505050905060008190506000808273ffffffffffffffffffffffffffffffffffffffff1663ef90e1b0886040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b15801561430657600080fd5b505afa15801561431a573d6000803e3d6000fd5b505050506040513d604081101561433057600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050600081116143c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f6d656469616e20726174652072657475726e6564203020676f6c64000000000081525060200191505060405180910390fd5b6001600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060048790806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508673ffffffffffffffffffffffffffffffffffffffff167f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a460405160405180910390a260019550505050506002548114614549576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50919050565b600080479050600061455f61247c565b905080821161456f576000614583565b6145828183614f1e90919063ffffffff16565b5b9250505090565b60065481565b606080600c805490506040519080825280602002602001820160405280156145c75781602001602082028038833980820191505090505b50905060008090505b600c8054905081101561463b57600d6000600c83815481106145ee57fe5b906000526020600020015481526020019081526020016000205482828151811061461457fe5b6020026020010181815250506146346001826155b890919063ffffffff16565b90506145d0565b508091505090565b61464b613158565b6146bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6146df6146c8614dcb565b6146d183614dad565b614df190919063ffffffff16565b614734576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615e066021913960400191505060405180910390fd5b806007819055507ffe69856ffb1b1d6cb00c1d8151726e6e95032b1666282eeb293ecadd58b29a6e816040518082815260200191505060405180910390a150565b61477d613158565b6147ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff161415614892576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f5370656e6465722063616e2774206265206e756c6c000000000000000000000081525060200191505060405180910390fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f3139419c41cdd7abca84fa19dd21118cd285d3e2ce1a9444e8161ce9fa62fdcd60405160405180910390a250565b614938613158565b6149aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b47821115614a20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f43616e6e6f7420667265657a65206d6f7265207468616e2062616c616e63650081525060200191505060405180910390fd5b81601181905550620151804281614a3357fe5b04601281905550806013819055505050565b600d6020528060005260406000206000915090505481565b614a65613158565b614ad7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff161415614b7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f5370656e6465722063616e2774206265206e756c6c000000000000000000000081525060200191505060405180910390fd5b601460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615614c1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180615e616023913960400191505060405180910390fd5b6001601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060158190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508073ffffffffffffffffffffffffffffffffffffffff167f71bccdb89fff4d914e3d2e472b327e3debaf4c4d6f1dfe528f430447e4cbcf5f60405160405180910390a250565b614d29613158565b614d9b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b614da481615791565b50565b600e5481565b614db5615d35565b6040518060200160405280838152509050919050565b614dd3615d35565b604051806020016040528069d3c21bcecceda1000000815250905090565b6000816000015183600001511115905092915050565b6000614e1161454f565b821115614e86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f457863656564696e6720756e66726f7a656e207265736572766573000000000081525060200191505060405180910390fd5b614eaf828473ffffffffffffffffffffffffffffffffffffffff1661599390919063ffffffff16565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f4dd1abe16ad3d4f829372dc77766ca2cce34e205af9b10f8cc1fab370425864f846040518082815260200191505060405180910390a36001905092915050565b6000614f6083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250615acd565b905092915050565b614f70615d35565b614f78615d35565b614f88614f83612589565b614dad565b9050614fa7614f98600854614dad565b82615b8d90919063ffffffff16565b15614fbe57614fb66000614dad565b915050614fcd565b614fc9600754614dad565b9150505b90565b600081600001519050919050565b614fe6615d35565b614fee615ba3565b821115615046576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180615e846036913960400191505060405180910390fd5b604051806020016040528069d3c21bcecceda100000084028152509050919050565b615070615d35565b600083600001511480615087575060008260000151145b156150a3576040518060200160405280600081525090506154c1565b69d3c21bcecceda1000000826000015114156150c1578290506154c1565b69d3c21bcecceda1000000836000015114156150df578190506154c1565b600069d3c21bcecceda10000006150f585615bc2565b600001518161510057fe5b049050600061510e85615bf9565b600001519050600069d3c21bcecceda100000061512a86615bc2565b600001518161513557fe5b049050600061514386615bf9565b60000151905060008285029050600085146151d7578285828161516257fe5b04146151d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600069d3c21bcecceda100000082029050600082146152795769d3c21bcecceda100000082828161520457fe5b0414615278576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f766572666c6f772078317931202a206669786564312064657465637465640081525060200191505060405180910390fd5b5b809150600084860290506000861461530a578486828161529557fe5b0414615309576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b6000848802905060008814615398578488828161532357fe5b0414615397576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b6153a0615c36565b87816153a857fe5b0496506153b3615c36565b85816153bb57fe5b049450600085880290506000881461544c57858882816153d757fe5b041461544b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b615454615d35565b604051806020016040528087815250905061547d816040518060200160405280878152506158d5565b9050615497816040518060200160405280868152506158d5565b90506154b1816040518060200160405280858152506158d5565b9050809a50505050505050505050505b92915050565b600069d3c21bcecceda10000008260000151816154e057fe5b049050919050565b6000808314156154fb5760009050615568565b600082840290508284828161550c57fe5b0414615563576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615edb6021913960400191505060405180910390fd5b809150505b92915050565b60006155b083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250615c43565b905092915050565b600080828401905083811015615636576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b615648615d35565b6000826000015114156156c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f63616e277420646976696465206279203000000000000000000000000000000081525060200191505060405180910390fd5b600069d3c21bcecceda10000008460000151029050836000015169d3c21bcecceda100000082816156f057fe5b0414615764576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6f766572666c6f7720617420646976696465000000000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808460000151838161577c57fe5b0481525091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415615817576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180615de06026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6158dd615d35565b6000826000015184600001510190508360000151811015615966576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f616464206f766572666c6f77206465746563746564000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808281525091505092915050565b60008160000151836000015114905092915050565b80471015615a09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416464726573733a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405180600001905060006040518083038185875af1925050503d8060008114615a69576040519150601f19603f3d011682016040523d82523d6000602084013e615a6e565b606091505b5050905080615ac8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180615e27603a913960400191505060405180910390fd5b505050565b6000838311158290615b7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015615b3f578082015181840152602081019050615b24565b50505050905090810190601f168015615b6c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000816000015183600001511015905092915050565b60007601357c299a88ea76a58924d52ce4f26a85af186c2b9e74905090565b615bca615d35565b604051806020016040528069d3c21bcecceda100000080856000015181615bed57fe5b04028152509050919050565b615c01615d35565b604051806020016040528069d3c21bcecceda100000080856000015181615c2457fe5b04028460000151038152509050919050565b600064e8d4a51000905090565b60008083118290615cef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015615cb4578082015181840152602081019050615c99565b50505050905090810190601f168015615ce15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581615cfb57fe5b049050809150509392505050565b815481835581811115615d3057818360005260206000209182019101615d2f9190615d95565b5b505050565b6040518060200160405280600081525090565b828054828255906000526020600020908101928215615d84579160200282015b82811115615d83578251825591602001919060010190615d68565b5b509050615d919190615dba565b5090565b615db791905b80821115615db3576000816000905550600101615d9b565b5090565b90565b615ddc91905b80821115615dd8576000816000905550600101615dc0565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373746f62696e207461782063616e6e6f74206265206c6172676572207468616e2031416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d617920686176652072657665727465644164647265737320697320616c72656164792045786368616e6765205370656e64657263616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e65774669786564282953756d206f6620617373657420616c6c6f636174696f6e206d7573742062652031536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77696e64657820696e746f2072657365727665206c697374206e6f74206d617070656420746f20616464726573737370656e64696e6720726174696f2063616e6e6f74206265206c6172676572207468616e2031696e64657820696e746f20746f6b656e73206c697374206e6f74206d617070656420746f20746f6b656e63616e206f6e6c79207472616e7366657220746f206f746865722072657365727665206164647265737373656e646572206e6f7420616c6c6f77656420746f207472616e7366657220526573657276652066756e6473a265627a7a72315820b2cd6b6db3c00a8152d6f074da45304f2c275b0e67c950322db14b1ceb88025464736f6c634300050d0032