Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- FtsoRegistry
- Optimization enabled
- true
- Compiler version
- v0.7.6+commit.7338295f
- Optimization runs
- 200
- Verified at
- 2022-02-24T10:58:29.801816Z
Constructor Arguments
000000000000000000000000fe4dbb048428c3583e91a8e8f03bc64f09f54ef800000000000000000000000099047a2cbc32c521278c83bb5d83d9178f6e0b9f
Arg [0] (address) : 0xfe4dbb048428c3583e91a8e8f03bc64f09f54ef8
Arg [1] (address) : 0x99047a2cbc32c521278c83bb5d83d9178f6e0b9f
./contracts/utils/implementation/FtsoRegistry.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "../interface/IIFtsoRegistry.sol"; import "../../addressUpdater/implementation/AddressUpdatable.sol"; import "../../ftso/interface/IIFtsoManager.sol"; import "../../governance/implementation/Governed.sol"; /** * @title A contract for FTSO registry */ contract FtsoRegistry is IIFtsoRegistry, Governed, AddressUpdatable { // constants uint256 internal constant MAX_HISTORY_LENGTH = 5; // errors string internal constant ERR_TOKEN_NOT_SUPPORTED = "FTSO index not supported"; string internal constant ERR_FTSO_MANAGER_ONLY = "FTSO manager only"; // storage IIFtso[MAX_HISTORY_LENGTH][] private ftsoHistory; // addresses // This address has to be set in deploy phase IIFtsoManager public ftsoManager; modifier onlyFtsoManager () { require (msg.sender == address(ftsoManager), ERR_FTSO_MANAGER_ONLY); _; } constructor( address _governance, address _addressUpdater ) Governed(_governance) AddressUpdatable(_addressUpdater) { /* empty block */ } /** * @notice Update current active FTSO contracts mapping * @param _ftsoContract new target FTSO contract */ function addFtso(IIFtso _ftsoContract) external override onlyFtsoManager returns(uint256 _ftsoIndex) { uint256 len = ftsoHistory.length; string memory _symbol = _ftsoContract.symbol(); bytes32 _encodedSymbol = keccak256(abi.encode(_symbol)); _ftsoIndex = 0; // Iterate over supported symbol array for ( ; _ftsoIndex < len; _ftsoIndex++) { // Deletion of symbols leaves an empty address "hole", so the address might be zero IIFtso current = ftsoHistory[_ftsoIndex][0]; if (address(current) == address(0)) { continue; } if (_encodedSymbol == keccak256(abi.encode(current.symbol()))) { break; } } // ftso with the same symbol is not yet in history array, add it if (_ftsoIndex == len) { ftsoHistory.push(); } else { // Shift history _shiftHistory(_ftsoIndex); } ftsoHistory[_ftsoIndex][0] = _ftsoContract; } /** * Removes the ftso at specified index and keeps part of the history * @dev Reverts if the provided index is unsupported * @param _ftso ftso to remove */ function removeFtso(IIFtso _ftso) external override onlyFtsoManager { bytes32 _encodedSymbol = keccak256(abi.encode(_ftso.symbol())); uint256 len = ftsoHistory.length; for (uint256 i = 0; i < len; ++i) { IIFtso current = ftsoHistory[i][0]; if (address(current) == address(0)) { continue; } // Removal behaves the same as setting null value as current if (_encodedSymbol == keccak256(abi.encode(current.symbol()))) { _shiftHistory(i); ftsoHistory[i][0] = IIFtso(address(0)); return; } } revert(ERR_TOKEN_NOT_SUPPORTED); } /** * @dev Reverts if unsupported index is passed * @return _activeFtso FTSO contract for provided index */ function getFtso(uint256 _assetIndex) external view override returns(IIFtso _activeFtso) { return _getFtso(_assetIndex); } /** * @dev Reverts if unsupported symbol is passed * @return _activeFtso FTSO contract for provided symbol */ function getFtsoBySymbol(string memory _symbol) external view override returns(IIFtso _activeFtso) { return _getFtso(_getFtsoIndex(_symbol)); } /** * @notice Public view function to get the price of active FTSO for given asset index * @dev Reverts if unsupported index is passed * @return _price current price of asset in USD * @return _timestamp timestamp for when this price was updated */ function getCurrentPrice(uint256 _assetIndex) external view override returns(uint256 _price, uint256 _timestamp) { return _getFtso(_assetIndex).getCurrentPrice(); } function getCurrentPrice(string memory _symbol) external view override returns(uint256 _price, uint256 _timestamp) { return _getFtso(_getFtsoIndex(_symbol)).getCurrentPrice(); } /** * @return _supportedIndices the array of all active FTSO indices in increasing order. * Active FTSOs are ones that currently receive price feeds. */ function getSupportedIndices() external view override returns(uint256[] memory _supportedIndices) { return _getSupportedIndices(); } /** * @return _supportedSymbols the array of all active FTSO symbols in increasing order. * Active FTSOs are ones that currently receive price feeds. */ function getSupportedSymbols() external view override returns(string[] memory _supportedSymbols) { uint256[] memory _supportedIndices = _getSupportedIndices(); uint256 len = _supportedIndices.length; _supportedSymbols = new string[](len); while (len > 0) { --len; IIFtso ftso = ftsoHistory[_supportedIndices[len]][0]; _supportedSymbols[len] = ftso.symbol(); } } /** * @notice Get array of all supported indices and corresponding FTSOs * @return _supportedIndices the array of all supported indices * @return _ftsos the array of all supported ftsos */ function getSupportedIndicesAndFtsos() external view override returns(uint256[] memory _supportedIndices, IIFtso[] memory _ftsos) { _supportedIndices = _getSupportedIndices(); uint256 len = _supportedIndices.length; _ftsos = new IIFtso[](len); while (len > 0) { --len; _ftsos[len] = ftsoHistory[_supportedIndices[len]][0]; } } /** * @notice Get array of all supported symbols and corresponding FTSOs * @return _supportedSymbols the array of all supported symbols * @return _ftsos the array of all supported ftsos */ function getSupportedSymbolsAndFtsos() external view override returns(string[] memory _supportedSymbols, IIFtso[] memory _ftsos) { uint256[] memory _supportedIndices = _getSupportedIndices(); uint256 len = _supportedIndices.length; _ftsos = new IIFtso[](len); _supportedSymbols = new string[](len); while (len > 0) { --len; _ftsos[len] = ftsoHistory[_supportedIndices[len]][0]; _supportedSymbols[len] = _ftsos[len].symbol(); } } /** * @notice Get array of all supported indices and corresponding symbols * @return _supportedIndices the array of all supported indices * @return _supportedSymbols the array of all supported symbols */ function getSupportedIndicesAndSymbols() external view override returns(uint256[] memory _supportedIndices, string[] memory _supportedSymbols) { _supportedIndices = _getSupportedIndices(); uint256 len = _supportedIndices.length; _supportedSymbols = new string[](len); while (len > 0) { --len; IIFtso ftso = ftsoHistory[_supportedIndices[len]][0]; _supportedSymbols[len] = ftso.symbol(); } } /** * @notice Get array of all supported indices, corresponding symbols and FTSOs * @return _supportedIndices the array of all supported indices * @return _supportedSymbols the array of all supported symbols * @return _ftsos the array of all supported ftsos */ function getSupportedIndicesSymbolsAndFtsos() external view override returns(uint256[] memory _supportedIndices, string[] memory _supportedSymbols, IIFtso[] memory _ftsos) { _supportedIndices = _getSupportedIndices(); uint256 len = _supportedIndices.length; _ftsos = new IIFtso[](len); _supportedSymbols = new string[](len); while (len > 0) { --len; _ftsos[len] = ftsoHistory[_supportedIndices[len]][0]; _supportedSymbols[len] = _ftsos[len].symbol(); } } /** * @notice Get array of all FTSO contracts for all supported asset indices. * The index of FTSO in returned array does not necessarily correspond to _assetIndex * Due to deletion, some indices might be unsupported. * @dev See `getSupportedIndicesAndFtsos` for pair of correct indices and `getAllFtsos` * for FTSOs at valid indices but with possible "null" holes. * @return _ftsos the array of all supported FTSOs */ function getSupportedFtsos() external view override returns(IIFtso[] memory _ftsos) { uint256[] memory supportedIndices = _getSupportedIndices(); uint256 len = supportedIndices.length; _ftsos = new IIFtso[](len); while (len > 0) { --len; _ftsos[len] = ftsoHistory[supportedIndices[len]][0]; } } /** * @notice Get the active FTSOs for given indices * @return _ftsos the array of FTSOs */ function getFtsos(uint256[] memory _assetIndices) external view override returns(IFtsoGenesis[] memory _ftsos) { uint256 ftsoLength = ftsoHistory.length; uint256 len = _assetIndices.length; _ftsos = new IFtsoGenesis[](len); while (len > 0) { --len; uint256 assetIndex = _assetIndices[len]; require(assetIndex < ftsoLength, ERR_TOKEN_NOT_SUPPORTED); _ftsos[len] = ftsoHistory[assetIndex][0]; if (address(_ftsos[len]) == address(0)) { // Invalid index, revert if address is zero address revert(ERR_TOKEN_NOT_SUPPORTED); } } } /** * @notice Get array of all FTSO contracts for all supported asset indices * @return _ftsos the array of all FTSOs * @dev Return value might contain uninitialized FTSOS at zero address. */ function getAllFtsos() external view returns(IIFtso[] memory _ftsos) { uint256 len = ftsoHistory.length; IIFtso[] memory ftsos = new IIFtso[](len); while (len > 0) { --len; ftsos[len] = ftsoHistory[len][0]; } return ftsos; } /** * @notice Get the history of FTSOs for given index * @dev If there are less then MAX_HISTORY_LENGTH the remaining addresses will be 0 addresses * @param _assetIndex asset index * @return _ftsoAddressHistory the history of FTSOs contract for provided index */ function getFtsoHistory(uint256 _assetIndex) external view returns(IIFtso[MAX_HISTORY_LENGTH] memory _ftsoAddressHistory) { require(_assetIndex < ftsoHistory.length && address(ftsoHistory[_assetIndex][0]) != address(0), ERR_TOKEN_NOT_SUPPORTED); return ftsoHistory[_assetIndex]; } function getFtsoIndex(string memory _symbol) external view override returns (uint256 _assetIndex) { return _getFtsoIndex(_symbol); } function getFtsoSymbol(uint256 _assetIndex) external view override returns (string memory _symbol) { return _getFtso(_assetIndex).symbol(); } /** * @notice Implementation of the AddressUpdatable abstract method. */ function _updateContractAddresses( bytes32[] memory _contractNameHashes, address[] memory _contractAddresses ) internal override { ftsoManager = IIFtsoManager(_getContractAddress(_contractNameHashes, _contractAddresses, "FtsoManager")); } /** * @notice Shift the FTSOs history by one so the FTSO at index 0 can be overwritten * @dev Internal helper function */ function _shiftHistory(uint256 _assetIndex) internal { for (uint256 i = MAX_HISTORY_LENGTH-1; i > 0; i--) { ftsoHistory[_assetIndex][i] = ftsoHistory[_assetIndex][i-1]; } } function _getFtsoIndex(string memory _symbol) private view returns (uint256 _assetIndex) { bytes32 _encodedSymbol = keccak256(abi.encode(_symbol)); uint256 len = ftsoHistory.length; for (uint256 i = 0; i < len; ++i) { IIFtso current = ftsoHistory[i][0]; if (address(current) == address(0)) { continue; } if (_encodedSymbol == keccak256(abi.encode(current.symbol()))) { return i; } } revert(ERR_TOKEN_NOT_SUPPORTED); } /** * @notice Get the active FTSO for given index * @dev Internal get ftso function so it can be used within other methods */ function _getFtso(uint256 _assetIndex) private view returns(IIFtso _activeFtso) { require(_assetIndex < ftsoHistory.length, ERR_TOKEN_NOT_SUPPORTED); IIFtso ftso = ftsoHistory[_assetIndex][0]; if (address(ftso) == address(0)) { // Invalid index, revert if address is zero address revert(ERR_TOKEN_NOT_SUPPORTED); } _activeFtso = ftso; } function _getSupportedIndices() private view returns(uint256[] memory _supportedIndices) { uint256 len = ftsoHistory.length; uint256[] memory supportedIndices = new uint256[](len); address zeroAddress = address(0); uint256 taken = 0; for (uint256 i = 0; i < len; ++i) { if (address(ftsoHistory[i][0]) != zeroAddress) { supportedIndices[taken] = i; ++taken; } } _supportedIndices = new uint256[](taken); while (taken > 0) { --taken; _supportedIndices[taken] = supportedIndices[taken]; } return _supportedIndices; } }
./contracts/userInterfaces/IVPContractEvents.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IVPContractEvents { /** * Event triggered when an account delegates or undelegates another account. * Definition: `votePowerFromTo(from, to)` is `changed` from `priorVotePower` to `newVotePower`. * For undelegation, `newVotePower` is 0. * * Note: the event is always emitted from VPToken's `writeVotePowerContract`. */ event Delegate(address indexed from, address indexed to, uint256 priorVotePower, uint256 newVotePower); /** * Event triggered only when account `delegator` revokes delegation to `delegatee` * for a single block in the past (typically the current vote block). * * Note: the event is always emitted from VPToken's `writeVotePowerContract` and/or `readVotePowerContract`. */ event Revoke(address indexed delegator, address indexed delegatee, uint256 votePower, uint256 blockNumber); }
./contracts/userInterfaces/IVPToken.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IGovernanceVotePower} from "./IGovernanceVotePower.sol"; import {IVPContractEvents} from "./IVPContractEvents.sol"; interface IVPToken is IERC20 { /** * @notice Delegate by percentage `_bips` of voting power to `_to` from `msg.sender`. * @param _to The address of the recipient * @param _bips The percentage of voting power to be delegated expressed in basis points (1/100 of one percent). * Not cummulative - every call resets the delegation value (and value of 0 undelegates `to`). **/ function delegate(address _to, uint256 _bips) external; /** * @notice Explicitly delegate `_amount` of voting power to `_to` from `msg.sender`. * @param _to The address of the recipient * @param _amount An explicit vote power amount to be delegated. * Not cummulative - every call resets the delegation value (and value of 0 undelegates `to`). **/ function delegateExplicit(address _to, uint _amount) external; /** * @notice Revoke all delegation from sender to `_who` at given block. * Only affects the reads via `votePowerOfAtCached()` in the block `_blockNumber`. * Block `_blockNumber` must be in the past. * This method should be used only to prevent rogue delegate voting in the current voting block. * To stop delegating use delegate/delegateExplicit with value of 0 or undelegateAll/undelegateAllExplicit. * @param _who Address of the delegatee * @param _blockNumber The block number at which to revoke delegation. */ function revokeDelegationAt(address _who, uint _blockNumber) external; /** * @notice Undelegate all voting power for delegates of `msg.sender` * Can only be used with percentage delegation. * Does not reset delegation mode back to NOTSET. **/ function undelegateAll() external; /** * @notice Undelegate all explicit vote power by amount delegates for `msg.sender`. * Can only be used with explicit delegation. * Does not reset delegation mode back to NOTSET. * @param _delegateAddresses Explicit delegation does not store delegatees' addresses, * so the caller must supply them. * @return The amount still delegated (in case the list of delegates was incomplete). */ function undelegateAllExplicit(address[] memory _delegateAddresses) external returns (uint256); /** * @dev Should be compatible with ERC20 method */ function name() external view returns (string memory); /** * @dev Should be compatible with ERC20 method */ function symbol() external view returns (string memory); /** * @dev Should be compatible with ERC20 method */ function decimals() external view returns (uint8); /** * @notice Total amount of tokens at a specific `_blockNumber`. * @param _blockNumber The block number when the totalSupply is queried * @return The total amount of tokens at `_blockNumber` **/ function totalSupplyAt(uint _blockNumber) external view returns(uint256); /** * @dev Queries the token balance of `_owner` at a specific `_blockNumber`. * @param _owner The address from which the balance will be retrieved. * @param _blockNumber The block number when the balance is queried. * @return The balance at `_blockNumber`. **/ function balanceOfAt(address _owner, uint _blockNumber) external view returns (uint256); /** * @notice Get the current total vote power. * @return The current total vote power (sum of all accounts' vote powers). */ function totalVotePower() external view returns(uint256); /** * @notice Get the total vote power at block `_blockNumber` * @param _blockNumber The block number at which to fetch. * @return The total vote power at the block (sum of all accounts' vote powers). */ function totalVotePowerAt(uint _blockNumber) external view returns(uint256); /** * @notice Get the current vote power of `_owner`. * @param _owner The address to get voting power. * @return Current vote power of `_owner`. */ function votePowerOf(address _owner) external view returns(uint256); /** * @notice Get the vote power of `_owner` at block `_blockNumber` * @param _owner The address to get voting power. * @param _blockNumber The block number at which to fetch. * @return Vote power of `_owner` at `_blockNumber`. */ function votePowerOfAt(address _owner, uint256 _blockNumber) external view returns(uint256); /** * @notice Get the vote power of `_owner` at block `_blockNumber`, ignoring revocation information (and cache). * @param _owner The address to get voting power. * @param _blockNumber The block number at which to fetch. * @return Vote power of `_owner` at `_blockNumber`. Result doesn't change if vote power is revoked. */ function votePowerOfAtIgnoringRevocation(address _owner, uint256 _blockNumber) external view returns(uint256); /** * @notice Get the delegation mode for '_who'. This mode determines whether vote power is * allocated by percentage or by explicit value. Once the delegation mode is set, * it never changes, even if all delegations are removed. * @param _who The address to get delegation mode. * @return delegation mode: 0 = NOTSET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit) */ function delegationModeOf(address _who) external view returns(uint256); /** * @notice Get current delegated vote power `_from` delegator delegated `_to` delegatee. * @param _from Address of delegator * @param _to Address of delegatee * @return The delegated vote power. */ function votePowerFromTo(address _from, address _to) external view returns(uint256); /** * @notice Get delegated the vote power `_from` delegator delegated `_to` delegatee at `_blockNumber`. * @param _from Address of delegator * @param _to Address of delegatee * @param _blockNumber The block number at which to fetch. * @return The delegated vote power. */ function votePowerFromToAt(address _from, address _to, uint _blockNumber) external view returns(uint256); /** * @notice Compute the current undelegated vote power of `_owner` * @param _owner The address to get undelegated voting power. * @return The unallocated vote power of `_owner` */ function undelegatedVotePowerOf(address _owner) external view returns(uint256); /** * @notice Get the undelegated vote power of `_owner` at given block. * @param _owner The address to get undelegated voting power. * @param _blockNumber The block number at which to fetch. * @return The undelegated vote power of `_owner` (= owner's own balance minus all delegations from owner) */ function undelegatedVotePowerOfAt(address _owner, uint256 _blockNumber) external view returns(uint256); /** * @notice Get the vote power delegation `delegationAddresses` * and `_bips` of `_who`. Returned in two separate positional arrays. * @param _who The address to get delegations. * @return _delegateAddresses Positional array of delegation addresses. * @return _bips Positional array of delegation percents specified in basis points (1/100 or 1 percent) * @return _count The number of delegates. * @return _delegationMode The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). */ function delegatesOf(address _who) external view returns ( address[] memory _delegateAddresses, uint256[] memory _bips, uint256 _count, uint256 _delegationMode ); /** * @notice Get the vote power delegation `delegationAddresses` * and `pcts` of `_who`. Returned in two separate positional arrays. * @param _who The address to get delegations. * @param _blockNumber The block for which we want to know the delegations. * @return _delegateAddresses Positional array of delegation addresses. * @return _bips Positional array of delegation percents specified in basis points (1/100 or 1 percent) * @return _count The number of delegates. * @return _delegationMode The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). */ function delegatesOfAt(address _who, uint256 _blockNumber) external view returns ( address[] memory _delegateAddresses, uint256[] memory _bips, uint256 _count, uint256 _delegationMode ); /** * Returns VPContract used for readonly operations (view methods). * The only non-view method that might be called on it is `revokeDelegationAt`. * * @notice `readVotePowerContract` is almost always equal to `writeVotePowerContract` * except during upgrade from one VPContract to a new version (which should happen * rarely or never and will be anounced before). * * @notice You shouldn't call any methods on VPContract directly, all are exposed * via VPToken (and state changing methods are forbidden from direct calls). * This is the reason why this method returns `IVPContractEvents` - it should only be used * for listening to events (`Revoke` only). */ function readVotePowerContract() external view returns (IVPContractEvents); /** * Returns VPContract used for state changing operations (non-view methods). * The only non-view method that might be called on it is `revokeDelegationAt`. * * @notice `writeVotePowerContract` is almost always equal to `readVotePowerContract` * except during upgrade from one VPContract to a new version (which should happen * rarely or never and will be anounced before). In the case of upgrade, * `writeVotePowerContract` will be replaced first to establish delegations, and * after some perio (e.g. after a reward epoch ends) `readVotePowerContract` will be set equal to it. * * @notice You shouldn't call any methods on VPContract directly, all are exposed * via VPToken (and state changing methods are forbidden from direct calls). * This is the reason why this method returns `IVPContractEvents` - it should only be used * for listening to events (`Delegate` and `Revoke` only). */ function writeVotePowerContract() external view returns (IVPContractEvents); /** * When set, allows token owners to participate in governance voting * and delegate governance vote power. */ function governanceVotePower() external view returns (IGovernanceVotePower); }
./contracts/utils/interface/IIFtsoRegistry.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; pragma abicoder v2; import "../../ftso/interface/IIFtso.sol"; import "../../userInterfaces/IFtsoRegistry.sol"; interface IIFtsoRegistry is IFtsoRegistry { // returns ftso index function addFtso(IIFtso _ftsoContract) external returns(uint256); function removeFtso(IIFtso _ftso) external; }
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
./contracts/addressUpdater/implementation/AddressUpdatable.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "../interface/IIAddressUpdatable.sol"; abstract contract AddressUpdatable is IIAddressUpdatable { // https://docs.soliditylang.org/en/v0.8.7/contracts.html#constant-and-immutable-state-variables // No storage slot is allocated bytes32 internal constant ADDRESS_STORAGE_POSITION = keccak256("flare.diamond.AddressUpdatable.ADDRESS_STORAGE_POSITION"); modifier onlyAddressUpdater() { require (msg.sender == getAddressUpdater(), "only address updater"); _; } constructor(address _addressUpdater) { setAddressUpdaterValue(_addressUpdater); } function getAddressUpdater() public view returns (address _addressUpdater) { // Only direct constants are allowed in inline assembly, so we assign it here bytes32 position = ADDRESS_STORAGE_POSITION; // solhint-disable-next-line no-inline-assembly assembly { _addressUpdater := sload(position) } } /** * @notice external method called from AddressUpdater only */ function updateContractAddresses( bytes32[] memory _contractNameHashes, address[] memory _contractAddresses ) external override onlyAddressUpdater { // update addressUpdater address setAddressUpdaterValue(_getContractAddress(_contractNameHashes, _contractAddresses, "AddressUpdater")); // update all other addresses _updateContractAddresses(_contractNameHashes, _contractAddresses); } /** * @notice virtual method that a contract extending AddressUpdatable must implement */ function _updateContractAddresses( bytes32[] memory _contractNameHashes, address[] memory _contractAddresses ) internal virtual; /** * @notice helper method to get contract address * @dev it reverts if contract name does not exist */ function _getContractAddress( bytes32[] memory _nameHashes, address[] memory _addresses, string memory _nameToFind ) internal pure returns(address) { bytes32 nameHash = keccak256(abi.encode(_nameToFind)); address a = address(0); for (uint256 i = 0; i < _nameHashes.length; i++) { if (nameHash == _nameHashes[i]) { a = _addresses[i]; break; } } require(a != address(0), "address zero"); return a; } function setAddressUpdaterValue(address _addressUpdater) internal { // Only direct constants are allowed in inline assembly, so we assign it here bytes32 position = ADDRESS_STORAGE_POSITION; // solhint-disable-next-line no-inline-assembly assembly { sstore(position, _addressUpdater) } } }
./contracts/addressUpdater/interface/IIAddressUpdatable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IIAddressUpdatable { /** * @notice Updates contract addresses - should be called only from AddressUpdater contract * @param _contractNameHashes list of keccak256(abi.encode(...)) contract names * @param _contractAddresses list of contract addresses corresponding to the contract names */ function updateContractAddresses( bytes32[] memory _contractNameHashes, address[] memory _contractAddresses ) external; }
./contracts/ftso/interface/IIFtso.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "../../genesis/interface/IFtsoGenesis.sol"; import "../../userInterfaces/IFtso.sol"; import "../../token/interface/IIVPToken.sol"; interface IIFtso is IFtso, IFtsoGenesis { /// function finalizePriceReveal /// called by reward manager only on correct timing. /// if price reveal period for epoch x ended. finalize. /// iterate list of price submissions /// find weighted median /// find adjucant 50% of price submissions. /// Allocate reward for any price submission which is same as a "winning" submission function finalizePriceEpoch(uint256 _epochId, bool _returnRewardData) external returns( address[] memory _eligibleAddresses, uint256[] memory _natWeights, uint256 _totalNatWeight ); function averageFinalizePriceEpoch(uint256 _epochId) external; function forceFinalizePriceEpoch(uint256 _epochId) external; // activateFtso will be called by ftso manager once ftso is added // before this is done, FTSO can't run function activateFtso( uint256 _firstEpochStartTs, uint256 _epochPeriod, uint256 _revealPeriod ) external; function deactivateFtso() external; // update initial price and timestamp - only if not active function updateInitialPrice(uint256 _initialPriceUSD, uint256 _initialPriceTimestamp) external; function configureEpochs( uint256 _maxVotePowerNatThresholdFraction, uint256 _maxVotePowerAssetThresholdFraction, uint256 _lowAssetUSDThreshold, uint256 _highAssetUSDThreshold, uint256 _highAssetTurnoutThresholdBIPS, uint256 _lowNatTurnoutThresholdBIPS, address[] memory _trustedAddresses ) external; function setAsset(IIVPToken _asset) external; function setAssetFtsos(IIFtso[] memory _assetFtsos) external; // current vote power block will update per reward epoch. // the FTSO doesn't have notion of reward epochs. // reward manager only can set this data. function setVotePowerBlock(uint256 _blockNumber) external; function initializeCurrentEpochStateForReveal(uint256 _circulatingSupplyNat, bool _fallbackMode) external; /** * @notice Returns the FTSO asset * @dev Asset is null in case of multi-asset FTSO */ function getAsset() external view returns (IIVPToken); /** * @notice Returns the Asset FTSOs * @dev AssetFtsos is not null only in case of multi-asset FTSO */ function getAssetFtsos() external view returns (IIFtso[] memory); /** * @notice Returns current configuration of epoch state * @return _maxVotePowerNatThresholdFraction High threshold for native token vote power per voter * @return _maxVotePowerAssetThresholdFraction High threshold for asset vote power per voter * @return _lowAssetUSDThreshold Threshold for low asset vote power * @return _highAssetUSDThreshold Threshold for high asset vote power * @return _highAssetTurnoutThresholdBIPS Threshold for high asset turnout * @return _lowNatTurnoutThresholdBIPS Threshold for low nat turnout * @return _trustedAddresses Trusted addresses - use their prices if low nat turnout is not achieved */ function epochsConfiguration() external view returns ( uint256 _maxVotePowerNatThresholdFraction, uint256 _maxVotePowerAssetThresholdFraction, uint256 _lowAssetUSDThreshold, uint256 _highAssetUSDThreshold, uint256 _highAssetTurnoutThresholdBIPS, uint256 _lowNatTurnoutThresholdBIPS, address[] memory _trustedAddresses ); /** * @notice Returns parameters necessary for approximately replicating vote weighting. * @return _assets the list of Assets that are accounted in vote * @return _assetMultipliers weight of each asset in (multiasset) ftso, mutiplied by TERA * @return _totalVotePowerNat total native token vote power at block * @return _totalVotePowerAsset total combined asset vote power at block * @return _assetWeightRatio ratio of combined asset vp vs. native token vp (in BIPS) * @return _votePowerBlock vote powewr block for given epoch */ function getVoteWeightingParameters() external view returns ( IIVPToken[] memory _assets, uint256[] memory _assetMultipliers, uint256 _totalVotePowerNat, uint256 _totalVotePowerAsset, uint256 _assetWeightRatio, uint256 _votePowerBlock ); function wNat() external view returns (IIVPToken); }
./contracts/ftso/interface/IIFtsoManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "../../ftso/interface/IIFtso.sol"; import "../../userInterfaces/IFtsoManager.sol"; import "../../token/interface/IIVPToken.sol"; interface IIFtsoManager is IFtsoManager { event ClosingExpiredRewardEpochFailed(uint256 _rewardEpoch); event CleanupBlockNumberManagerUnset(); event CleanupBlockNumberManagerFailedForBlock(uint256 blockNumber); function activate() external; function setGovernanceParameters( uint256 _maxVotePowerNatThresholdFraction, uint256 _maxVotePowerAssetThresholdFraction, uint256 _lowAssetUSDThreshold, uint256 _highAssetUSDThreshold, uint256 _highAssetTurnoutThresholdBIPS, uint256 _lowNatTurnoutThresholdBIPS, uint256 _rewardExpiryOffsetSeconds, address[] memory _trustedAddresses ) external; function addFtso(IIFtso _ftso) external; function removeFtso(IIFtso _ftso) external; function replaceFtso( IIFtso _ftsoToRemove, IIFtso _ftsoToAdd, bool copyCurrentPrice, bool copyAssetOrAssetFtsos ) external; function setFtsoAsset(IIFtso _ftso, IIVPToken _asset) external; function setFtsoAssetFtsos(IIFtso _ftso, IIFtso[] memory _assetFtsos) external; function setFallbackMode(bool _fallbackMode) external; function setFtsoFallbackMode(IIFtso _ftso, bool _fallbackMode) external; function getRewardEpochToExpireNext() external returns (uint256); }
./contracts/genesis/interface/IFtsoGenesis.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; interface IFtsoGenesis { /** * @notice Submits price hash for current epoch - only price submitter * @param _sender Sender address * @param _epochId Target epoch id to which hashes are submitted * @param _hash Hashed price and random number * @notice Emits PriceHashSubmitted event. */ function submitPriceHashSubmitter(address _sender, uint256 _epochId, bytes32 _hash) external; /** * @notice Reveals submitted price during epoch reveal period - only price submitter * @param _voter Voter address * @param _epochId Id of the epoch in which the price hash was submitted * @param _price Submitted price in USD * @param _random Submitted random number * @notice The hash of _price and _random must be equal to the submitted hash * @notice Emits PriceRevealed event */ function revealPriceSubmitter( address _voter, uint256 _epochId, uint256 _price, uint256 _random, uint256 _wNatVP ) external; /** * @notice Get (and cache) wNat vote power for specified voter and given epoch id * @param _voter Voter address * @param _epochId Id of the epoch in which the price hash was submitted * @return wNat vote power */ function wNatVotePowerCached(address _voter, uint256 _epochId) external returns (uint256); }
./contracts/genesis/interface/IFtsoRegistryGenesis.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "./IFtsoGenesis.sol"; interface IFtsoRegistryGenesis { function getFtsos(uint256[] memory _indices) external view returns(IFtsoGenesis[] memory _ftsos); }
./contracts/governance/implementation/Governed.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import { GovernedBase } from "./GovernedBase.sol"; /** * @title Governed * @dev For deployed, governed contracts, enforce a non-zero address at create time. **/ contract Governed is GovernedBase { constructor(address _governance) GovernedBase(_governance) { require(_governance != address(0), "_governance zero"); } }
./contracts/governance/implementation/GovernedBase.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; /** * @title Governed Base * @notice This abstract base class defines behaviors for a governed contract. * @dev This class is abstract so that specific behaviors can be defined for the constructor. * Contracts should not be left ungoverned, but not all contract will have a constructor * (for example those pre-defined in genesis). **/ abstract contract GovernedBase { address public governance; address public proposedGovernance; bool private initialised; event GovernanceProposed(address proposedGovernance); event GovernanceUpdated (address oldGovernance, address newGoveranance); modifier onlyGovernance () { _checkOnlyGovernance(); _; } constructor(address _governance) { if (_governance != address(0)) { initialise(_governance); } } /** * @notice First of a two step process for turning over governance to another address. * @param _governance The address to propose to receive governance role. * @dev Must hold governance to propose another address. */ function proposeGovernance(address _governance) external onlyGovernance { proposedGovernance = _governance; emit GovernanceProposed(_governance); } /** * @notice Once proposed, claimant can claim the governance role as the second of a two-step process. */ function claimGovernance() external { require(msg.sender == proposedGovernance, "not claimaint"); emit GovernanceUpdated(governance, proposedGovernance); governance = proposedGovernance; proposedGovernance = address(0); } /** * @notice In a one-step process, turn over governance to another address. * @dev Must hold governance to transfer. */ function transferGovernance(address _governance) external onlyGovernance { emit GovernanceUpdated(governance, _governance); governance = _governance; proposedGovernance = address(0); } /** * @notice Initialize the governance address if not first initialized. */ function initialise(address _governance) public virtual { require(initialised == false, "initialised != false"); initialised = true; emit GovernanceUpdated(governance, _governance); governance = _governance; proposedGovernance = address(0); } function _checkOnlyGovernance() internal view { require(msg.sender == governance, "only governance"); } }
./contracts/token/interface/IICleanable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IICleanable { /** * Set the contract that is allowed to call history cleaning methods. */ function setCleanerContract(address _cleanerContract) external; /** * Set the cleanup block number. * Historic data for the blocks before `cleanupBlockNumber` can be erased, * history before that block should never be used since it can be inconsistent. * In particular, cleanup block number must be before current vote power block. * @param _blockNumber The new cleanup block number. */ function setCleanupBlockNumber(uint256 _blockNumber) external; /** * Set the contract that is allowed to set cleanupBlockNumber. * Usually this will be an instance of CleanupBlockNumberManager. */ function setCleanupBlockNumberManager(address _cleanupBlockNumberManager) external; /** * Get the current cleanup block number. */ function cleanupBlockNumber() external view returns (uint256); }
./contracts/token/interface/IIGovernanceVotePower.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "../../userInterfaces/IVPToken.sol"; import "../../userInterfaces/IGovernanceVotePower.sol"; interface IIGovernanceVotePower is IGovernanceVotePower { /** * Update vote powers when tokens are transfered. **/ function updateAtTokenTransfer( address _from, address _to, uint256 _fromBalance, uint256 _toBalance, uint256 _amount ) external; /** * Set the cleanup block number. * Historic data for the blocks before `cleanupBlockNumber` can be erased, * history before that block should never be used since it can be inconsistent. * In particular, cleanup block number must be before current vote power block. * @param _blockNumber The new cleanup block number. */ function setCleanupBlockNumber(uint256 _blockNumber) external; /** * Set the contract that is allowed to call history cleaning methods. */ function setCleanerContract(address _cleanerContract) external; /** * @notice Get the token that this governance vote power contract belongs to. */ function ownerToken() external view returns(IVPToken); }
./contracts/token/interface/IIVPContract.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "../../userInterfaces/IVPToken.sol"; import "../../userInterfaces/IVPContractEvents.sol"; import "./IICleanable.sol"; interface IIVPContract is IICleanable, IVPContractEvents { /** * Update vote powers when tokens are transfered. * Also update delegated vote powers for percentage delegation * and check for enough funds for explicit delegations. **/ function updateAtTokenTransfer( address _from, address _to, uint256 _fromBalance, uint256 _toBalance, uint256 _amount ) external; /** * @notice Delegate `_bips` percentage of voting power to `_to` from `_from` * @param _from The address of the delegator * @param _to The address of the recipient * @param _balance The delegator's current balance * @param _bips The percentage of voting power to be delegated expressed in basis points (1/100 of one percent). * Not cummulative - every call resets the delegation value (and value of 0 revokes delegation). **/ function delegate( address _from, address _to, uint256 _balance, uint256 _bips ) external; /** * @notice Explicitly delegate `_amount` of voting power to `_to` from `msg.sender`. * @param _from The address of the delegator * @param _to The address of the recipient * @param _balance The delegator's current balance * @param _amount An explicit vote power amount to be delegated. * Not cummulative - every call resets the delegation value (and value of 0 undelegates `to`). **/ function delegateExplicit( address _from, address _to, uint256 _balance, uint _amount ) external; /** * @notice Revoke all delegation from sender to `_who` at given block. * Only affects the reads via `votePowerOfAtCached()` in the block `_blockNumber`. * Block `_blockNumber` must be in the past. * This method should be used only to prevent rogue delegate voting in the current voting block. * To stop delegating use delegate/delegateExplicit with value of 0 or undelegateAll/undelegateAllExplicit. * @param _from The address of the delegator * @param _who Address of the delegatee * @param _balance The delegator's current balance * @param _blockNumber The block number at which to revoke delegation. **/ function revokeDelegationAt( address _from, address _who, uint256 _balance, uint _blockNumber ) external; /** * @notice Undelegate all voting power for delegates of `msg.sender` * Can only be used with percentage delegation. * Does not reset delegation mode back to NOTSET. * @param _from The address of the delegator **/ function undelegateAll( address _from, uint256 _balance ) external; /** * @notice Undelegate all explicit vote power by amount delegates for `msg.sender`. * Can only be used with explicit delegation. * Does not reset delegation mode back to NOTSET. * @param _from The address of the delegator * @param _delegateAddresses Explicit delegation does not store delegatees' addresses, * so the caller must supply them. * @return The amount still delegated (in case the list of delegates was incomplete). */ function undelegateAllExplicit( address _from, address[] memory _delegateAddresses ) external returns (uint256); /** * @notice Get the vote power of `_who` at block `_blockNumber` * Reads/updates cache and upholds revocations. * @param _who The address to get voting power. * @param _blockNumber The block number at which to fetch. * @return Vote power of `_who` at `_blockNumber`. */ function votePowerOfAtCached(address _who, uint256 _blockNumber) external returns(uint256); /** * @notice Get the current vote power of `_who`. * @param _who The address to get voting power. * @return Current vote power of `_who`. */ function votePowerOf(address _who) external view returns(uint256); /** * @notice Get the vote power of `_who` at block `_blockNumber` * @param _who The address to get voting power. * @param _blockNumber The block number at which to fetch. * @return Vote power of `_who` at `_blockNumber`. */ function votePowerOfAt(address _who, uint256 _blockNumber) external view returns(uint256); /** * @notice Get the vote power of `_who` at block `_blockNumber`, ignoring revocation information (and cache). * @param _who The address to get voting power. * @param _blockNumber The block number at which to fetch. * @return Vote power of `_who` at `_blockNumber`. Result doesn't change if vote power is revoked. */ function votePowerOfAtIgnoringRevocation(address _who, uint256 _blockNumber) external view returns(uint256); /** * Return vote powers for several addresses in a batch. * @param _owners The list of addresses to fetch vote power of. * @param _blockNumber The block number at which to fetch. * @return A list of vote powers. */ function batchVotePowerOfAt( address[] memory _owners, uint256 _blockNumber ) external view returns(uint256[] memory); /** * @notice Get current delegated vote power `_from` delegator delegated `_to` delegatee. * @param _from Address of delegator * @param _to Address of delegatee * @param _balance The delegator's current balance * @return The delegated vote power. */ function votePowerFromTo( address _from, address _to, uint256 _balance ) external view returns(uint256); /** * @notice Get delegated the vote power `_from` delegator delegated `_to` delegatee at `_blockNumber`. * @param _from Address of delegator * @param _to Address of delegatee * @param _balance The delegator's current balance * @param _blockNumber The block number at which to fetch. * @return The delegated vote power. */ function votePowerFromToAt( address _from, address _to, uint256 _balance, uint _blockNumber ) external view returns(uint256); /** * @notice Compute the current undelegated vote power of `_owner` * @param _owner The address to get undelegated voting power. * @param _balance Owner's current balance * @return The unallocated vote power of `_owner` */ function undelegatedVotePowerOf( address _owner, uint256 _balance ) external view returns(uint256); /** * @notice Get the undelegated vote power of `_owner` at given block. * @param _owner The address to get undelegated voting power. * @param _blockNumber The block number at which to fetch. * @return The undelegated vote power of `_owner` (= owner's own balance minus all delegations from owner) */ function undelegatedVotePowerOfAt( address _owner, uint256 _balance, uint256 _blockNumber ) external view returns(uint256); /** * @notice Get the delegation mode for '_who'. This mode determines whether vote power is * allocated by percentage or by explicit value. * @param _who The address to get delegation mode. * @return Delegation mode (NOTSET=0, PERCENTAGE=1, AMOUNT=2)) */ function delegationModeOf(address _who) external view returns (uint256); /** * @notice Get the vote power delegation `_delegateAddresses` * and `pcts` of an `_owner`. Returned in two separate positional arrays. * @param _owner The address to get delegations. * @return _delegateAddresses Positional array of delegation addresses. * @return _bips Positional array of delegation percents specified in basis points (1/100 or 1 percent) * @return _count The number of delegates. * @return _delegationMode The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). */ function delegatesOf( address _owner ) external view returns ( address[] memory _delegateAddresses, uint256[] memory _bips, uint256 _count, uint256 _delegationMode ); /** * @notice Get the vote power delegation `delegationAddresses` * and `pcts` of an `_owner`. Returned in two separate positional arrays. * @param _owner The address to get delegations. * @param _blockNumber The block for which we want to know the delegations. * @return _delegateAddresses Positional array of delegation addresses. * @return _bips Positional array of delegation percents specified in basis points (1/100 or 1 percent) * @return _count The number of delegates. * @return _delegationMode The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). */ function delegatesOfAt( address _owner, uint256 _blockNumber ) external view returns ( address[] memory _delegateAddresses, uint256[] memory _bips, uint256 _count, uint256 _delegationMode ); /** * The VPToken (or some other contract) that owns this VPContract. * All state changing methods may be called only from this address. * This is because original msg.sender is sent in `_from` parameter * and we must be sure that it cannot be faked by directly calling VPContract. * Owner token is also used in case of replacement to recover vote powers from balances. */ function ownerToken() external view returns (IVPToken); /** * Return true if this IIVPContract is configured to be used as a replacement for other contract. * It means that vote powers are not necessarily correct at the initialization, therefore * every method that reads vote power must check whether it is initialized for that address and block. */ function isReplacement() external view returns (bool); }
./contracts/token/interface/IIVPToken.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "../../userInterfaces/IVPToken.sol"; import "../../userInterfaces/IGovernanceVotePower.sol"; import "./IIVPContract.sol"; import "./IIGovernanceVotePower.sol"; import "./IICleanable.sol"; interface IIVPToken is IVPToken, IICleanable { /** * Sets new governance vote power contract that allows token owners to participate in governance voting * and delegate governance vote power. */ function setGovernanceVotePower(IIGovernanceVotePower _governanceVotePower) external; /** * @notice Get the total vote power at block `_blockNumber` using cache. * It tries to read the cached value and if not found, reads the actual value and stores it in cache. * Can only be used if `_blockNumber` is in the past, otherwise reverts. * @param _blockNumber The block number at which to fetch. * @return The total vote power at the block (sum of all accounts' vote powers). */ function totalVotePowerAtCached(uint256 _blockNumber) external returns(uint256); /** * @notice Get the vote power of `_owner` at block `_blockNumber` using cache. * It tries to read the cached value and if not found, reads the actual value and stores it in cache. * Can only be used if _blockNumber is in the past, otherwise reverts. * @param _owner The address to get voting power. * @param _blockNumber The block number at which to fetch. * @return Vote power of `_owner` at `_blockNumber`. */ function votePowerOfAtCached(address _owner, uint256 _blockNumber) external returns(uint256); /** * Return vote powers for several addresses in a batch. * @param _owners The list of addresses to fetch vote power of. * @param _blockNumber The block number at which to fetch. * @return A list of vote powers. */ function batchVotePowerOfAt( address[] memory _owners, uint256 _blockNumber ) external view returns(uint256[] memory); }
./contracts/userInterfaces/IFtso.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; interface IFtso { enum PriceFinalizationType { // initial state NOT_FINALIZED, // median calculation used to decide price WEIGHTED_MEDIAN, // low turnout - price decided from average of trusted addresses TRUSTED_ADDRESSES, // low turnout + no votes from trusted addresses - price copied from previous epoch PREVIOUS_PRICE_COPIED, // price decided from average of trusted addresses - triggered due to an exception TRUSTED_ADDRESSES_EXCEPTION, // previous price copied - triggered due to an exception PREVIOUS_PRICE_COPIED_EXCEPTION } // events event PriceHashSubmitted( address indexed submitter, uint256 indexed epochId, bytes32 hash, uint256 timestamp ); event PriceRevealed( address indexed voter, uint256 indexed epochId, uint256 price, uint256 random, uint256 timestamp, uint256 votePowerNat, uint256 votePowerAsset ); event PriceFinalized( uint256 indexed epochId, uint256 price, bool rewardedFtso, uint256 lowRewardPrice, uint256 highRewardPrice, PriceFinalizationType finalizationType, uint256 timestamp ); event PriceEpochInitializedOnFtso( uint256 indexed epochId, uint256 endTime, uint256 timestamp ); event LowTurnout( uint256 indexed epochId, uint256 natTurnout, uint256 lowNatTurnoutThresholdBIPS, uint256 timestamp ); /** * @notice Returns if FTSO is active */ function active() external view returns (bool); /** * @notice Returns the FTSO symbol */ function symbol() external view returns (string memory); /** * @notice Returns current epoch id */ function getCurrentEpochId() external view returns (uint256); /** * @notice Returns id of the epoch which was opened for price submission at the specified timestamp * @param _timestamp Timestamp as seconds from unix epoch */ function getEpochId(uint256 _timestamp) external view returns (uint256); /** * @notice Returns random number of the specified epoch * @param _epochId Id of the epoch */ function getRandom(uint256 _epochId) external view returns (uint256); /** * @notice Returns asset price consented in specific epoch * @param _epochId Id of the epoch * @return Price in USD multiplied by ASSET_PRICE_USD_DECIMALS */ function getEpochPrice(uint256 _epochId) external view returns (uint256); /** * @notice Returns current epoch data * @return _epochId Current epoch id * @return _epochSubmitEndTime End time of the current epoch price submission as seconds from unix epoch * @return _epochRevealEndTime End time of the current epoch price reveal as seconds from unix epoch * @return _votePowerBlock Vote power block for the current epoch * @return _fallbackMode Current epoch in fallback mode - only votes from trusted addresses will be used * @dev half-closed intervals - end time not included */ function getPriceEpochData() external view returns ( uint256 _epochId, uint256 _epochSubmitEndTime, uint256 _epochRevealEndTime, uint256 _votePowerBlock, bool _fallbackMode ); /** * @notice Returns current epoch data * @return _firstEpochStartTime First epoch start time * @return _submitPeriod Submit period in seconds * @return _revealPeriod Reveal period in seconds */ function getPriceEpochConfiguration() external view returns ( uint256 _firstEpochStartTime, uint256 _submitPeriod, uint256 _revealPeriod ); /** * @notice Returns asset price submitted by voter in specific epoch * @param _epochId Id of the epoch * @param _voter Address of the voter * @return Price in USD multiplied by ASSET_PRICE_USD_DECIMALS */ function getEpochPriceForVoter(uint256 _epochId, address _voter) external view returns (uint256); /** * @notice Returns current asset price * @return _price Price in USD multiplied by ASSET_PRICE_USD_DECIMALS * @return _timestamp Time when price was updated for the last time */ function getCurrentPrice() external view returns (uint256 _price, uint256 _timestamp); /** * @notice Returns current random number */ function getCurrentRandom() external view returns (uint256); }
./contracts/userInterfaces/IFtsoManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "./IPriceSubmitter.sol"; import "../ftso/interface/IIFtso.sol"; interface IFtsoManager { event FtsoAdded(IIFtso ftso, bool add); event FallbackMode(bool fallbackMode); event FtsoFallbackMode(IIFtso ftso, bool fallbackMode); event RewardEpochFinalized(uint256 votepowerBlock, uint256 startBlock); event PriceEpochFinalized(address chosenFtso, uint256 rewardEpochId); event InitializingCurrentEpochStateForRevealFailed(IIFtso ftso, uint256 epochId); event FinalizingPriceEpochFailed(IIFtso ftso, uint256 epochId, IFtso.PriceFinalizationType failingType); event DistributingRewardsFailed(address ftso, uint256 epochId); function active() external view returns (bool); function getPriceSubmitter() external view returns (IPriceSubmitter); function getCurrentRewardEpoch() external view returns (uint256); function getRewardEpochVotePowerBlock(uint256 _rewardEpoch) external view returns (uint256); function getCurrentPriceEpochData() external view returns ( uint256 _priceEpochId, uint256 _priceEpochStartTimestamp, uint256 _priceEpochEndTimestamp, uint256 _priceEpochRevealEndTimestamp, uint256 _currentTimestamp ); function getFtsos() external view returns (IIFtso[] memory _ftsos); function getPriceEpochConfiguration() external view returns ( uint256 _firstPriceEpochStartTs, uint256 _priceEpochDurationSeconds, uint256 _revealEpochDurationSeconds ); function getFallbackMode() external view returns ( bool _fallbackMode, IIFtso[] memory _ftsos, bool[] memory _ftsoInFallbackMode ); }
./contracts/userInterfaces/IFtsoRegistry.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; pragma abicoder v2; import "../ftso/interface/IIFtso.sol"; import "../genesis/interface/IFtsoRegistryGenesis.sol"; interface IFtsoRegistry is IFtsoRegistryGenesis { function getFtso(uint256 _ftsoIndex) external view returns(IIFtso _activeFtsoAddress); function getFtsoBySymbol(string memory _symbol) external view returns(IIFtso _activeFtsoAddress); function getSupportedIndices() external view returns(uint256[] memory _supportedIndices); function getSupportedSymbols() external view returns(string[] memory _supportedSymbols); function getSupportedFtsos() external view returns(IIFtso[] memory _ftsos); function getFtsoIndex(string memory _symbol) external view returns (uint256 _assetIndex); function getFtsoSymbol(uint256 _ftsoIndex) external view returns (string memory _symbol); function getCurrentPrice(uint256 _ftsoIndex) external view returns(uint256 _price, uint256 _timestamp); function getCurrentPrice(string memory _symbol) external view returns(uint256 _price, uint256 _timestamp); function getSupportedIndicesAndFtsos() external view returns(uint256[] memory _supportedIndices, IIFtso[] memory _ftsos); function getSupportedSymbolsAndFtsos() external view returns(string[] memory _supportedSymbols, IIFtso[] memory _ftsos); function getSupportedIndicesAndSymbols() external view returns(uint256[] memory _supportedIndices, string[] memory _supportedSymbols); function getSupportedIndicesSymbolsAndFtsos() external view returns(uint256[] memory _supportedIndices, string[] memory _supportedSymbols, IIFtso[] memory _ftsos); }
./contracts/userInterfaces/IGovernanceVotePower.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IGovernanceVotePower { /** * @notice Delegate all governance vote power of `msg.sender` to `_to`. * @param _to The address of the recipient **/ function delegate(address _to) external; /** * @notice Undelegate all governance vote power that `msg.sender` has delegated. **/ function undelegate() external; /** * @notice Get the governance vote power of `_who` at block `_blockNumber` * @param _who The address to get voting power. * @param _blockNumber The block number at which to fetch. * @return Governance vote power of `_who` at `_blockNumber`. */ function votePowerOfAt(address _who, uint256 _blockNumber) external view returns(uint256); }
./contracts/userInterfaces/IPriceSubmitter.sol
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "../genesis/interface/IFtsoGenesis.sol"; import "../genesis/interface/IFtsoRegistryGenesis.sol"; interface IPriceSubmitter { /** * Event emitted when price hashes were submitted through PriceSubmitter. * @param submitter the address of the sender * @param epochId current price epoch id * @param ftsos array of ftsos that correspond to the indexes in call * @param hashes the submitted hashes * @param timestamp current block timestamp */ event PriceHashesSubmitted( address indexed submitter, uint256 indexed epochId, IFtsoGenesis[] ftsos, bytes32[] hashes, uint256 timestamp ); /** * Event emitted when prices were revealed through PriceSubmitter. * @param voter the address of the sender * @param epochId id of the epoch in which the price hash was submitted * @param ftsos array of ftsos that correspond to the indexes in the call * @param prices the submitted prices * @param timestamp current block timestamp */ event PricesRevealed( address indexed voter, uint256 indexed epochId, IFtsoGenesis[] ftsos, uint256[] prices, uint256[] randoms, uint256 timestamp ); /** * @notice Submits price hashes for current epoch * @param _epochId Target epoch id to which hashes are submitted * @param _ftsoIndices List of ftso indices * @param _hashes List of hashed price and random number * @notice Emits PriceHashesSubmitted event */ function submitPriceHashes( uint256 _epochId, uint256[] memory _ftsoIndices, bytes32[] memory _hashes ) external; /** * @notice Reveals submitted prices during epoch reveal period * @param _epochId Id of the epoch in which the price hashes was submitted * @param _ftsoIndices List of ftso indices * @param _prices List of submitted prices in USD * @param _randoms List of submitted random numbers * @notice The hash of _price and _random must be equal to the submitted hash * @notice Emits PricesRevealed event */ function revealPrices( uint256 _epochId, uint256[] memory _ftsoIndices, uint256[] memory _prices, uint256[] memory _randoms ) external; /** * Returns bitmap of all ftso's for which `_voter` is allowed to submit prices/hashes. * If voter is allowed to vote for ftso at index (see *_FTSO_INDEX), the corrsponding * bit in the result will be 1. */ function voterWhitelistBitmap(address _voter) external view returns (uint256); function getVoterWhitelister() external view returns (address); function getFtsoRegistry() external view returns (IFtsoRegistryGenesis); function getFtsoManager() external view returns (address); }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_governance","internalType":"address"},{"type":"address","name":"_addressUpdater","internalType":"address"}]},{"type":"event","name":"GovernanceProposed","inputs":[{"type":"address","name":"proposedGovernance","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"GovernanceUpdated","inputs":[{"type":"address","name":"oldGovernance","internalType":"address","indexed":false},{"type":"address","name":"newGoveranance","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"_ftsoIndex","internalType":"uint256"}],"name":"addFtso","inputs":[{"type":"address","name":"_ftsoContract","internalType":"contract IIFtso"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimGovernance","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IIFtsoManager"}],"name":"ftsoManager","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"_addressUpdater","internalType":"address"}],"name":"getAddressUpdater","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"_ftsos","internalType":"contract IIFtso[]"}],"name":"getAllFtsos","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"_price","internalType":"uint256"},{"type":"uint256","name":"_timestamp","internalType":"uint256"}],"name":"getCurrentPrice","inputs":[{"type":"string","name":"_symbol","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"_price","internalType":"uint256"},{"type":"uint256","name":"_timestamp","internalType":"uint256"}],"name":"getCurrentPrice","inputs":[{"type":"uint256","name":"_assetIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"_activeFtso","internalType":"contract IIFtso"}],"name":"getFtso","inputs":[{"type":"uint256","name":"_assetIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"_activeFtso","internalType":"contract IIFtso"}],"name":"getFtsoBySymbol","inputs":[{"type":"string","name":"_symbol","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[5]","name":"_ftsoAddressHistory","internalType":"contract IIFtso[5]"}],"name":"getFtsoHistory","inputs":[{"type":"uint256","name":"_assetIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"_assetIndex","internalType":"uint256"}],"name":"getFtsoIndex","inputs":[{"type":"string","name":"_symbol","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"_symbol","internalType":"string"}],"name":"getFtsoSymbol","inputs":[{"type":"uint256","name":"_assetIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"_ftsos","internalType":"contract IFtsoGenesis[]"}],"name":"getFtsos","inputs":[{"type":"uint256[]","name":"_assetIndices","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"_ftsos","internalType":"contract IIFtso[]"}],"name":"getSupportedFtsos","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"_supportedIndices","internalType":"uint256[]"}],"name":"getSupportedIndices","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"_supportedIndices","internalType":"uint256[]"},{"type":"address[]","name":"_ftsos","internalType":"contract IIFtso[]"}],"name":"getSupportedIndicesAndFtsos","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"_supportedIndices","internalType":"uint256[]"},{"type":"string[]","name":"_supportedSymbols","internalType":"string[]"}],"name":"getSupportedIndicesAndSymbols","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"_supportedIndices","internalType":"uint256[]"},{"type":"string[]","name":"_supportedSymbols","internalType":"string[]"},{"type":"address[]","name":"_ftsos","internalType":"contract IIFtso[]"}],"name":"getSupportedIndicesSymbolsAndFtsos","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string[]","name":"_supportedSymbols","internalType":"string[]"}],"name":"getSupportedSymbols","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string[]","name":"_supportedSymbols","internalType":"string[]"},{"type":"address[]","name":"_ftsos","internalType":"contract IIFtso[]"}],"name":"getSupportedSymbolsAndFtsos","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"governance","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialise","inputs":[{"type":"address","name":"_governance","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"proposeGovernance","inputs":[{"type":"address","name":"_governance","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"proposedGovernance","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeFtso","inputs":[{"type":"address","name":"_ftso","internalType":"contract IIFtso"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferGovernance","inputs":[{"type":"address","name":"_governance","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateContractAddresses","inputs":[{"type":"bytes32[]","name":"_contractNameHashes","internalType":"bytes32[]"},{"type":"address[]","name":"_contractAddresses","internalType":"address[]"}]}]
Contract Creation Code
0x60806040523480156200001157600080fd5b506040516200269c3803806200269c8339810160408190526200003491620001dc565b8082806001600160a01b0381161562000052576200005281620000b7565b506001600160a01b038116620000a2576040805162461bcd60e51b815260206004820152601060248201526f5f676f7665726e616e6365207a65726f60801b604482015290519081900360640190fd5b50620000ae816200019b565b50505062000213565b600154600160a01b900460ff161562000117576040805162461bcd60e51b815260206004820152601460248201527f696e697469616c6973656420213d2066616c7365000000000000000000000000604482015290519081900360640190fd5b6001805460ff60a01b1916600160a01b179055600054604080516001600160a01b039283168152918316602083015280517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d9281900390910190a1600080546001600160a01b039092166001600160a01b0319928316179055600180549091169055565b7f714f205b2abd25bef1d06a1af944e38c113fe6160375c4e1d6d5cf28848e771955565b80516001600160a01b0381168114620001d757600080fd5b919050565b60008060408385031215620001ef578182fd5b620001fa83620001bf565b91506200020a60208401620001bf565b90509250929050565b61247980620002236000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c806397da6af4116100f9578063c55d0f5611610097578063d38bfff411610071578063d38bfff41461038b578063d75f6d811461039e578063e68f283b146103b1578063e848da30146103c7576101a9565b8063c55d0f5614610343578063c71a1b2014610356578063ce1c0e4d14610376576101a9565b8063a40060ba116100d3578063a40060ba14610302578063a670ff871461030a578063b00c0b761461031d578063c373a08e14610330576101a9565b806397da6af4146102bc5780639cb47538146102cf5780639d6a890f146102ef576101a9565b806342a0f243116101665780635d36b190116101405780635d36b1901461027e57806360f7ac97146102885780637687542c14610290578063798aac5b146102a7576101a9565b806342a0f2431461024d5780635267a15d1461026e5780635aa6e67514610276576101a9565b806306a2ba29146101ae5780630cf48497146101cd57806311a7aaaa146101e3578063136d3f64146101f85780632663f1b4146102185780632bcdd6ab14610238575b600080fd5b6101b66103da565b6040516101c49291906122d8565b60405180910390f35b6101d56104b0565b6040516101c49291906122a0565b6101eb610675565b6040516101c491906121df565b61020b6102063660046120c3565b610684565b6040516101c49190612353565b61022b610226366004611e7f565b61070b565b6040516101c49190612366565b610240610978565b6040516101c4919061227a565b61026061025b366004611fe7565b610a34565b6040516101c492919061236f565b6101eb610ac0565b6101eb610ae5565b610286610af4565b005b6101eb610bb6565b610298610bc5565b6040516101c493929190612310565b6102af610d8a565b6040516101c491906122c5565b6101eb6102ca366004611fe7565b610d99565b6102e26102dd366004611f58565b610da7565b6040516101c491906121f3565b6102866102fd366004611e7f565b610f2b565b610240611005565b610286610318366004611e7f565b6110dc565b61028661032b366004611ea2565b611350565b61028661033e366004611e7f565b6113fb565b6102606103513660046120c3565b611457565b6103696103643660046120c3565b611463565b6040516101c49190612240565b61037e611549565b6040516101c4919061228d565b610286610399366004611e7f565b611680565b6101eb6103ac3660046120c3565b6116f9565b6103b9611704565b6040516101c49291906122eb565b61022b6103d5366004611fe7565b61183a565b6060806103e5611845565b8051909250806001600160401b038111801561040057600080fd5b5060405190808252806020026020018201604052801561042a578160200160208202803683370190505b5091505b80156104ab5780600190039050600283828151811061044957fe5b60200260200101518154811061045b57fe5b600091825260208220600590910201015482516001600160a01b039091169083908390811061048657fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061042e565b509091565b60608060006104bd611845565b8051909150806001600160401b03811180156104d857600080fd5b50604051908082528060200260200182016040528015610502578160200160208202803683370190505b509250806001600160401b038111801561051b57600080fd5b5060405190808252806020026020018201604052801561054f57816020015b606081526020019060019003908161053a5790505b5093505b801561066f5780600190039050600282828151811061056e57fe5b60200260200101518154811061058057fe5b600091825260208220600590910201015483516001600160a01b03909116908490839081106105ab57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508281815181106105d757fe5b60200260200101516001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561061757600080fd5b505afa15801561062b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610653919081019061205a565b84828151811061065f57fe5b6020026020010181905250610553565b50509091565b6003546001600160a01b031681565b606061068f82611986565b6001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156106c757600080fd5b505afa1580156106db573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610703919081019061205a565b90505b919050565b6003546040805180820190915260118152704654534f206d616e61676572206f6e6c7960781b60208201526000916001600160a01b0316331461076a5760405162461bcd60e51b81526004016107619190612353565b60405180910390fd5b50600060028054905090506000836001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156107b057600080fd5b505afa1580156107c4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107ec919081019061205a565b90506000816040516020016108019190612353565b604051602081830303815290604052805190602001209050600093505b828410156109115760006002858154811061083557fe5b60009182526020822060059091020101546001600160a01b031690508061085c5750610906565b806001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561089557600080fd5b505afa1580156108a9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108d1919081019061205a565b6040516020016108e19190612353565b604051602081830303815290604052805190602001208214156109045750610911565b505b60019093019261081e565b8284141561092a57600280546001018155600052610933565b61093384611a3d565b846002858154811061094157fe5b6000918252602082206005909102010180546001600160a01b0319166001600160a01b039290921691909117905550919392505050565b6002546060906000816001600160401b038111801561099657600080fd5b506040519080825280602002602001820160405280156109c0578160200160208202803683370190505b5090505b8115610a2e5781600190039150600282815481106109de57fe5b600091825260208220600590910201015481516001600160a01b0390911690829084908110610a0957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506109c4565b91505090565b600080610a48610a4384611acc565b611986565b6001600160a01b031663eb91d37e6040518163ffffffff1660e01b8152600401604080518083038186803b158015610a7f57600080fd5b505afa158015610a93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab791906120db565b91509150915091565b7f714f205b2abd25bef1d06a1af944e38c113fe6160375c4e1d6d5cf28848e77195490565b6000546001600160a01b031681565b6001546001600160a01b03163314610b43576040805162461bcd60e51b815260206004820152600d60248201526c1b9bdd0818db185a5b585a5b9d609a1b604482015290519081900360640190fd5b600054600154604080516001600160a01b03938416815292909116602083015280517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6001546001600160a01b031681565b6060806060610bd2611845565b8051909350806001600160401b0381118015610bed57600080fd5b50604051908082528060200260200182016040528015610c17578160200160208202803683370190505b509150806001600160401b0381118015610c3057600080fd5b50604051908082528060200260200182016040528015610c6457816020015b6060815260200190600190039081610c4f5790505b5092505b8015610d8457806001900390506002848281518110610c8357fe5b602002602001015181548110610c9557fe5b600091825260208220600590910201015482516001600160a01b0390911690839083908110610cc057fe5b60200260200101906001600160a01b031690816001600160a01b031681525050818181518110610cec57fe5b60200260200101516001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015610d2c57600080fd5b505afa158015610d40573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d68919081019061205a565b838281518110610d7457fe5b6020026020010181905250610c68565b50909192565b6060610d94611845565b905090565b6000610703610a4383611acc565b600254815160609190806001600160401b0381118015610dc657600080fd5b50604051908082528060200260200182016040528015610df0578160200160208202803683370190505b5092505b8015610f2457806001900390506000848281518110610e0f57fe5b6020026020010151905082811060405180604001604052806018815260200160008051602061242483398151915281525090610e5e5760405162461bcd60e51b81526004016107619190612353565b5060028181548110610e6c57fe5b600091825260208220600590910201015484516001600160a01b0390911690859084908110610e9757fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b0316848381518110610ece57fe5b60200260200101516001600160a01b03161415610f1e57604080518082018252601881526000805160206124248339815191526020820152905162461bcd60e51b81526107619190600401612353565b50610df4565b5050919050565b600154600160a01b900460ff1615610f81576040805162461bcd60e51b8152602060048201526014602482015273696e697469616c6973656420213d2066616c736560601b604482015290519081900360640190fd5b6001805460ff60a01b1916600160a01b179055600054604080516001600160a01b039283168152918316602083015280517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d9281900390910190a1600080546001600160a01b039092166001600160a01b0319928316179055600180549091169055565b60606000611011611845565b8051909150806001600160401b038111801561102c57600080fd5b50604051908082528060200260200182016040528015611056578160200160208202803683370190505b5092505b80156110d75780600190039050600282828151811061107557fe5b60200260200101518154811061108757fe5b600091825260208220600590910201015483516001600160a01b03909116908490839081106110b257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061105a565b505090565b6003546040805180820190915260118152704654534f206d616e61676572206f6e6c7960781b6020820152906001600160a01b031633146111305760405162461bcd60e51b81526004016107619190612353565b506000816001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561116c57600080fd5b505afa158015611180573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111a8919081019061205a565b6040516020016111b89190612353565b60408051601f19818403018152919052805160209091012060025490915060005b81811015611313576000600282815481106111f057fe5b60009182526020822060059091020101546001600160a01b0316905080611217575061130b565b806001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561125057600080fd5b505afa158015611264573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261128c919081019061205a565b60405160200161129c9190612353565b60405160208183030381529060405280519060200120841415611309576112c282611a3d565b6000600283815481106112d157fe5b6000918252602082206005909102010180546001600160a01b0319166001600160a01b03929092169190911790555061134d92505050565b505b6001016111d9565b50604080518082018252601881526000805160206124248339815191526020820152905162461bcd60e51b81526107619190600401612353565b50565b611358610ac0565b6001600160a01b0316336001600160a01b0316146113b4576040805162461bcd60e51b815260206004820152601460248201527337b7363c9030b2323932b9b9903ab83230ba32b960611b604482015290519081900360640190fd5b6113ed6113e883836040518060400160405280600e81526020016d20b2323932b9b9aab83230ba32b960911b815250611bf6565b611d23565b6113f78282611d47565b5050565b611403611d99565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f1f95fb40be3a947982072902a887b521248d1d8931a39eb38f84f4d6fd758b699181900360200190a150565b600080610a4883611986565b61146b611dec565b600254821080156114ac575060006001600160a01b03166002838154811061148f57fe5b60009182526020822060059091020101546001600160a01b031614155b604051806040016040528060188152602001600080516020612424833981519152815250906114ee5760405162461bcd60e51b81526004016107619190612353565b50600282815481106114fc57fe5b600091825260209091206040805160a0810191829052926005908102909201919082845b81546001600160a01b031681526001909101906020018083116115205750505050509050919050565b60606000611555611845565b8051909150806001600160401b038111801561157057600080fd5b506040519080825280602002602001820160405280156115a457816020015b606081526020019060019003908161158f5790505b5092505b80156110d75780600190039050600060028383815181106115c557fe5b6020026020010151815481106115d757fe5b6000918252602082206005919091020154604080516395d89b4160e01b815290516001600160a01b03909216935083926395d89b4192600480840193829003018186803b15801561162757600080fd5b505afa15801561163b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611663919081019061205a565b84838151811061166f57fe5b6020026020010181905250506115a8565b611688611d99565b600054604080516001600160a01b039283168152918316602083015280517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d9281900390910190a1600080546001600160a01b039092166001600160a01b0319928316179055600180549091169055565b600061070382611986565b60608061170f611845565b8051909250806001600160401b038111801561172a57600080fd5b5060405190808252806020026020018201604052801561175e57816020015b60608152602001906001900390816117495790505b5091505b80156104ab57806001900390506000600284838151811061177f57fe5b60200260200101518154811061179157fe5b6000918252602082206005919091020154604080516395d89b4160e01b815290516001600160a01b03909216935083926395d89b4192600480840193829003018186803b1580156117e157600080fd5b505afa1580156117f5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261181d919081019061205a565b83838151811061182957fe5b602002602001018190525050611762565b600061070382611acc565b6002546060906000816001600160401b038111801561186357600080fd5b5060405190808252806020026020018201604052801561188d578160200160208202803683370190505b50905060008060005b848110156118fc57826001600160a01b0316600282815481106118b557fe5b60009182526020822060059091020101546001600160a01b0316146118f457808483815181106118e157fe5b6020026020010181815250508160010191505b600101611896565b50806001600160401b038111801561191357600080fd5b5060405190808252806020026020018201604052801561193d578160200160208202803683370190505b5094505b801561197f578060019003905082818151811061195a57fe5b602002602001015185828151811061196e57fe5b602002602001018181525050611941565b5050505090565b6002546040805180820190915260188152600080516020612424833981519152602082015260009183106119cd5760405162461bcd60e51b81526004016107619190612353565b506000600283815481106119dd57fe5b60009182526020822060059091020101546001600160a01b0316905080611a3757604080518082018252601881526000805160206124248339815191526020820152905162461bcd60e51b81526107619190600401612353565b92915050565b60045b80156113f75760028281548110611a5357fe5b90600052602060002090600502016001820360058110611a6f57fe5b0154600280546001600160a01b039092169184908110611a8b57fe5b90600052602060002090600502018260058110611aa457fe5b0180546001600160a01b0319166001600160a01b039290921691909117905560001901611a40565b60008082604051602001611ae09190612353565b60408051601f19818403018152919052805160209091012060025490915060005b8181101561131357600060028281548110611b1857fe5b60009182526020822060059091020101546001600160a01b0316905080611b3f5750611bee565b806001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015611b7857600080fd5b505afa158015611b8c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bb4919081019061205a565b604051602001611bc49190612353565b60405160208183030381529060405280519060200120841415611bec57509250610706915050565b505b600101611b01565b600080826040516020018080602001828103825283818151815260200191508051906020019080838360005b83811015611c3a578181015183820152602001611c22565b50505050905090810190601f168015611c675780820380516001836020036101000a031916815260200191505b50925050506040516020818303038152906040528051906020012090506000805b8651811015611ccf57868181518110611c9d57fe5b6020026020010151831415611cc757858181518110611cb857fe5b60200260200101519150611ccf565b600101611c88565b506001600160a01b038116611d1a576040805162461bcd60e51b815260206004820152600c60248201526b61646472657373207a65726f60a01b604482015290519081900360640190fd5b95945050505050565b7f714f205b2abd25bef1d06a1af944e38c113fe6160375c4e1d6d5cf28848e771955565b611d7582826040518060400160405280600b81526020016a233a39b7a6b0b730b3b2b960a91b815250611bf6565b600380546001600160a01b0319166001600160a01b03929092169190911790555050565b6000546001600160a01b03163314611dea576040805162461bcd60e51b815260206004820152600f60248201526e6f6e6c7920676f7665726e616e636560881b604482015290519081900360640190fd5b565b6040518060a001604052806005906020820280368337509192915050565b600082601f830112611e1a578081fd5b81356020611e2f611e2a836123a0565b61237d565b8281528181019085830183850287018401881015611e4b578586fd5b855b85811015611e72578135611e608161240e565b84529284019290840190600101611e4d565b5090979650505050505050565b600060208284031215611e90578081fd5b8135611e9b8161240e565b9392505050565b60008060408385031215611eb4578081fd5b82356001600160401b0380821115611eca578283fd5b818501915085601f830112611edd578283fd5b81356020611eed611e2a836123a0565b82815281810190858301838502870184018b1015611f09578788fd5b8796505b84871015611f2b578035835260019690960195918301918301611f0d565b5096505086013592505080821115611f41578283fd5b50611f4e85828601611e0a565b9150509250929050565b60006020808385031215611f6a578182fd5b82356001600160401b03811115611f7f578283fd5b8301601f81018513611f8f578283fd5b8035611f9d611e2a826123a0565b8181528381019083850185840285018601891015611fb9578687fd5b8694505b83851015611fdb578035835260019490940193918501918501611fbd565b50979650505050505050565b600060208284031215611ff8578081fd5b81356001600160401b0381111561200d578182fd5b8201601f8101841361201d578182fd5b803561202b611e2a826123bd565b81815285602083850101111561203f578384fd5b81602084016020830137908101602001929092525092915050565b60006020828403121561206b578081fd5b81516001600160401b03811115612080578182fd5b8201601f81018413612090578182fd5b805161209e611e2a826123bd565b8181528560208385010111156120b2578384fd5b611d1a8260208301602086016123de565b6000602082840312156120d4578081fd5b5035919050565b600080604083850312156120ed578182fd5b505080516020909101519092909150565b6000815180845260208085019450808401835b838110156121365781516001600160a01b031687529582019590820190600101612111565b509495945050505050565b6000815180845260208085019450848183028601828601855b85811015611e725783830389526121728383516121b3565b9885019892509084019060010161215a565b6000815180845260208085019450808401835b8381101561213657815187529582019590820190600101612197565b600081518084526121cb8160208601602086016123de565b601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b818110156122345783516001600160a01b03168352928401929184019160010161220f565b50909695505050505050565b60a08101818360005b60058110156122715781516001600160a01b0316835260209283019290910190600101612249565b50505092915050565b600060208252611e9b60208301846120fe565b600060208252611e9b6020830184612141565b6000604082526122b36040830185612141565b8281036020840152611d1a81856120fe565b600060208252611e9b6020830184612184565b6000604082526122b36040830185612184565b6000604082526122fe6040830185612184565b8281036020840152611d1a8185612141565b6000606082526123236060830186612184565b82810360208401526123358186612141565b9050828103604084015261234981856120fe565b9695505050505050565b600060208252611e9b60208301846121b3565b90815260200190565b918252602082015260400190565b6040518181016001600160401b038111828210171561239857fe5b604052919050565b60006001600160401b038211156123b357fe5b5060209081020190565b60006001600160401b038211156123d057fe5b50601f01601f191660200190565b60005b838110156123f95781810151838201526020016123e1565b83811115612408576000848401525b50505050565b6001600160a01b038116811461134d57600080fdfe4654534f20696e646578206e6f7420737570706f727465640000000000000000a2646970667358221220b82c8eb1091dfafd57dad22254712f98d4b4e0d2b4207178f092a2c535ac8ac964736f6c63430007060033000000000000000000000000fe4dbb048428c3583e91a8e8f03bc64f09f54ef800000000000000000000000099047a2cbc32c521278c83bb5d83d9178f6e0b9f
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c806397da6af4116100f9578063c55d0f5611610097578063d38bfff411610071578063d38bfff41461038b578063d75f6d811461039e578063e68f283b146103b1578063e848da30146103c7576101a9565b8063c55d0f5614610343578063c71a1b2014610356578063ce1c0e4d14610376576101a9565b8063a40060ba116100d3578063a40060ba14610302578063a670ff871461030a578063b00c0b761461031d578063c373a08e14610330576101a9565b806397da6af4146102bc5780639cb47538146102cf5780639d6a890f146102ef576101a9565b806342a0f243116101665780635d36b190116101405780635d36b1901461027e57806360f7ac97146102885780637687542c14610290578063798aac5b146102a7576101a9565b806342a0f2431461024d5780635267a15d1461026e5780635aa6e67514610276576101a9565b806306a2ba29146101ae5780630cf48497146101cd57806311a7aaaa146101e3578063136d3f64146101f85780632663f1b4146102185780632bcdd6ab14610238575b600080fd5b6101b66103da565b6040516101c49291906122d8565b60405180910390f35b6101d56104b0565b6040516101c49291906122a0565b6101eb610675565b6040516101c491906121df565b61020b6102063660046120c3565b610684565b6040516101c49190612353565b61022b610226366004611e7f565b61070b565b6040516101c49190612366565b610240610978565b6040516101c4919061227a565b61026061025b366004611fe7565b610a34565b6040516101c492919061236f565b6101eb610ac0565b6101eb610ae5565b610286610af4565b005b6101eb610bb6565b610298610bc5565b6040516101c493929190612310565b6102af610d8a565b6040516101c491906122c5565b6101eb6102ca366004611fe7565b610d99565b6102e26102dd366004611f58565b610da7565b6040516101c491906121f3565b6102866102fd366004611e7f565b610f2b565b610240611005565b610286610318366004611e7f565b6110dc565b61028661032b366004611ea2565b611350565b61028661033e366004611e7f565b6113fb565b6102606103513660046120c3565b611457565b6103696103643660046120c3565b611463565b6040516101c49190612240565b61037e611549565b6040516101c4919061228d565b610286610399366004611e7f565b611680565b6101eb6103ac3660046120c3565b6116f9565b6103b9611704565b6040516101c49291906122eb565b61022b6103d5366004611fe7565b61183a565b6060806103e5611845565b8051909250806001600160401b038111801561040057600080fd5b5060405190808252806020026020018201604052801561042a578160200160208202803683370190505b5091505b80156104ab5780600190039050600283828151811061044957fe5b60200260200101518154811061045b57fe5b600091825260208220600590910201015482516001600160a01b039091169083908390811061048657fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061042e565b509091565b60608060006104bd611845565b8051909150806001600160401b03811180156104d857600080fd5b50604051908082528060200260200182016040528015610502578160200160208202803683370190505b509250806001600160401b038111801561051b57600080fd5b5060405190808252806020026020018201604052801561054f57816020015b606081526020019060019003908161053a5790505b5093505b801561066f5780600190039050600282828151811061056e57fe5b60200260200101518154811061058057fe5b600091825260208220600590910201015483516001600160a01b03909116908490839081106105ab57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508281815181106105d757fe5b60200260200101516001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561061757600080fd5b505afa15801561062b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610653919081019061205a565b84828151811061065f57fe5b6020026020010181905250610553565b50509091565b6003546001600160a01b031681565b606061068f82611986565b6001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156106c757600080fd5b505afa1580156106db573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610703919081019061205a565b90505b919050565b6003546040805180820190915260118152704654534f206d616e61676572206f6e6c7960781b60208201526000916001600160a01b0316331461076a5760405162461bcd60e51b81526004016107619190612353565b60405180910390fd5b50600060028054905090506000836001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156107b057600080fd5b505afa1580156107c4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107ec919081019061205a565b90506000816040516020016108019190612353565b604051602081830303815290604052805190602001209050600093505b828410156109115760006002858154811061083557fe5b60009182526020822060059091020101546001600160a01b031690508061085c5750610906565b806001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561089557600080fd5b505afa1580156108a9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108d1919081019061205a565b6040516020016108e19190612353565b604051602081830303815290604052805190602001208214156109045750610911565b505b60019093019261081e565b8284141561092a57600280546001018155600052610933565b61093384611a3d565b846002858154811061094157fe5b6000918252602082206005909102010180546001600160a01b0319166001600160a01b039290921691909117905550919392505050565b6002546060906000816001600160401b038111801561099657600080fd5b506040519080825280602002602001820160405280156109c0578160200160208202803683370190505b5090505b8115610a2e5781600190039150600282815481106109de57fe5b600091825260208220600590910201015481516001600160a01b0390911690829084908110610a0957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506109c4565b91505090565b600080610a48610a4384611acc565b611986565b6001600160a01b031663eb91d37e6040518163ffffffff1660e01b8152600401604080518083038186803b158015610a7f57600080fd5b505afa158015610a93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab791906120db565b91509150915091565b7f714f205b2abd25bef1d06a1af944e38c113fe6160375c4e1d6d5cf28848e77195490565b6000546001600160a01b031681565b6001546001600160a01b03163314610b43576040805162461bcd60e51b815260206004820152600d60248201526c1b9bdd0818db185a5b585a5b9d609a1b604482015290519081900360640190fd5b600054600154604080516001600160a01b03938416815292909116602083015280517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6001546001600160a01b031681565b6060806060610bd2611845565b8051909350806001600160401b0381118015610bed57600080fd5b50604051908082528060200260200182016040528015610c17578160200160208202803683370190505b509150806001600160401b0381118015610c3057600080fd5b50604051908082528060200260200182016040528015610c6457816020015b6060815260200190600190039081610c4f5790505b5092505b8015610d8457806001900390506002848281518110610c8357fe5b602002602001015181548110610c9557fe5b600091825260208220600590910201015482516001600160a01b0390911690839083908110610cc057fe5b60200260200101906001600160a01b031690816001600160a01b031681525050818181518110610cec57fe5b60200260200101516001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015610d2c57600080fd5b505afa158015610d40573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d68919081019061205a565b838281518110610d7457fe5b6020026020010181905250610c68565b50909192565b6060610d94611845565b905090565b6000610703610a4383611acc565b600254815160609190806001600160401b0381118015610dc657600080fd5b50604051908082528060200260200182016040528015610df0578160200160208202803683370190505b5092505b8015610f2457806001900390506000848281518110610e0f57fe5b6020026020010151905082811060405180604001604052806018815260200160008051602061242483398151915281525090610e5e5760405162461bcd60e51b81526004016107619190612353565b5060028181548110610e6c57fe5b600091825260208220600590910201015484516001600160a01b0390911690859084908110610e9757fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b0316848381518110610ece57fe5b60200260200101516001600160a01b03161415610f1e57604080518082018252601881526000805160206124248339815191526020820152905162461bcd60e51b81526107619190600401612353565b50610df4565b5050919050565b600154600160a01b900460ff1615610f81576040805162461bcd60e51b8152602060048201526014602482015273696e697469616c6973656420213d2066616c736560601b604482015290519081900360640190fd5b6001805460ff60a01b1916600160a01b179055600054604080516001600160a01b039283168152918316602083015280517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d9281900390910190a1600080546001600160a01b039092166001600160a01b0319928316179055600180549091169055565b60606000611011611845565b8051909150806001600160401b038111801561102c57600080fd5b50604051908082528060200260200182016040528015611056578160200160208202803683370190505b5092505b80156110d75780600190039050600282828151811061107557fe5b60200260200101518154811061108757fe5b600091825260208220600590910201015483516001600160a01b03909116908490839081106110b257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061105a565b505090565b6003546040805180820190915260118152704654534f206d616e61676572206f6e6c7960781b6020820152906001600160a01b031633146111305760405162461bcd60e51b81526004016107619190612353565b506000816001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561116c57600080fd5b505afa158015611180573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111a8919081019061205a565b6040516020016111b89190612353565b60408051601f19818403018152919052805160209091012060025490915060005b81811015611313576000600282815481106111f057fe5b60009182526020822060059091020101546001600160a01b0316905080611217575061130b565b806001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561125057600080fd5b505afa158015611264573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261128c919081019061205a565b60405160200161129c9190612353565b60405160208183030381529060405280519060200120841415611309576112c282611a3d565b6000600283815481106112d157fe5b6000918252602082206005909102010180546001600160a01b0319166001600160a01b03929092169190911790555061134d92505050565b505b6001016111d9565b50604080518082018252601881526000805160206124248339815191526020820152905162461bcd60e51b81526107619190600401612353565b50565b611358610ac0565b6001600160a01b0316336001600160a01b0316146113b4576040805162461bcd60e51b815260206004820152601460248201527337b7363c9030b2323932b9b9903ab83230ba32b960611b604482015290519081900360640190fd5b6113ed6113e883836040518060400160405280600e81526020016d20b2323932b9b9aab83230ba32b960911b815250611bf6565b611d23565b6113f78282611d47565b5050565b611403611d99565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f1f95fb40be3a947982072902a887b521248d1d8931a39eb38f84f4d6fd758b699181900360200190a150565b600080610a4883611986565b61146b611dec565b600254821080156114ac575060006001600160a01b03166002838154811061148f57fe5b60009182526020822060059091020101546001600160a01b031614155b604051806040016040528060188152602001600080516020612424833981519152815250906114ee5760405162461bcd60e51b81526004016107619190612353565b50600282815481106114fc57fe5b600091825260209091206040805160a0810191829052926005908102909201919082845b81546001600160a01b031681526001909101906020018083116115205750505050509050919050565b60606000611555611845565b8051909150806001600160401b038111801561157057600080fd5b506040519080825280602002602001820160405280156115a457816020015b606081526020019060019003908161158f5790505b5092505b80156110d75780600190039050600060028383815181106115c557fe5b6020026020010151815481106115d757fe5b6000918252602082206005919091020154604080516395d89b4160e01b815290516001600160a01b03909216935083926395d89b4192600480840193829003018186803b15801561162757600080fd5b505afa15801561163b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611663919081019061205a565b84838151811061166f57fe5b6020026020010181905250506115a8565b611688611d99565b600054604080516001600160a01b039283168152918316602083015280517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d9281900390910190a1600080546001600160a01b039092166001600160a01b0319928316179055600180549091169055565b600061070382611986565b60608061170f611845565b8051909250806001600160401b038111801561172a57600080fd5b5060405190808252806020026020018201604052801561175e57816020015b60608152602001906001900390816117495790505b5091505b80156104ab57806001900390506000600284838151811061177f57fe5b60200260200101518154811061179157fe5b6000918252602082206005919091020154604080516395d89b4160e01b815290516001600160a01b03909216935083926395d89b4192600480840193829003018186803b1580156117e157600080fd5b505afa1580156117f5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261181d919081019061205a565b83838151811061182957fe5b602002602001018190525050611762565b600061070382611acc565b6002546060906000816001600160401b038111801561186357600080fd5b5060405190808252806020026020018201604052801561188d578160200160208202803683370190505b50905060008060005b848110156118fc57826001600160a01b0316600282815481106118b557fe5b60009182526020822060059091020101546001600160a01b0316146118f457808483815181106118e157fe5b6020026020010181815250508160010191505b600101611896565b50806001600160401b038111801561191357600080fd5b5060405190808252806020026020018201604052801561193d578160200160208202803683370190505b5094505b801561197f578060019003905082818151811061195a57fe5b602002602001015185828151811061196e57fe5b602002602001018181525050611941565b5050505090565b6002546040805180820190915260188152600080516020612424833981519152602082015260009183106119cd5760405162461bcd60e51b81526004016107619190612353565b506000600283815481106119dd57fe5b60009182526020822060059091020101546001600160a01b0316905080611a3757604080518082018252601881526000805160206124248339815191526020820152905162461bcd60e51b81526107619190600401612353565b92915050565b60045b80156113f75760028281548110611a5357fe5b90600052602060002090600502016001820360058110611a6f57fe5b0154600280546001600160a01b039092169184908110611a8b57fe5b90600052602060002090600502018260058110611aa457fe5b0180546001600160a01b0319166001600160a01b039290921691909117905560001901611a40565b60008082604051602001611ae09190612353565b60408051601f19818403018152919052805160209091012060025490915060005b8181101561131357600060028281548110611b1857fe5b60009182526020822060059091020101546001600160a01b0316905080611b3f5750611bee565b806001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015611b7857600080fd5b505afa158015611b8c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bb4919081019061205a565b604051602001611bc49190612353565b60405160208183030381529060405280519060200120841415611bec57509250610706915050565b505b600101611b01565b600080826040516020018080602001828103825283818151815260200191508051906020019080838360005b83811015611c3a578181015183820152602001611c22565b50505050905090810190601f168015611c675780820380516001836020036101000a031916815260200191505b50925050506040516020818303038152906040528051906020012090506000805b8651811015611ccf57868181518110611c9d57fe5b6020026020010151831415611cc757858181518110611cb857fe5b60200260200101519150611ccf565b600101611c88565b506001600160a01b038116611d1a576040805162461bcd60e51b815260206004820152600c60248201526b61646472657373207a65726f60a01b604482015290519081900360640190fd5b95945050505050565b7f714f205b2abd25bef1d06a1af944e38c113fe6160375c4e1d6d5cf28848e771955565b611d7582826040518060400160405280600b81526020016a233a39b7a6b0b730b3b2b960a91b815250611bf6565b600380546001600160a01b0319166001600160a01b03929092169190911790555050565b6000546001600160a01b03163314611dea576040805162461bcd60e51b815260206004820152600f60248201526e6f6e6c7920676f7665726e616e636560881b604482015290519081900360640190fd5b565b6040518060a001604052806005906020820280368337509192915050565b600082601f830112611e1a578081fd5b81356020611e2f611e2a836123a0565b61237d565b8281528181019085830183850287018401881015611e4b578586fd5b855b85811015611e72578135611e608161240e565b84529284019290840190600101611e4d565b5090979650505050505050565b600060208284031215611e90578081fd5b8135611e9b8161240e565b9392505050565b60008060408385031215611eb4578081fd5b82356001600160401b0380821115611eca578283fd5b818501915085601f830112611edd578283fd5b81356020611eed611e2a836123a0565b82815281810190858301838502870184018b1015611f09578788fd5b8796505b84871015611f2b578035835260019690960195918301918301611f0d565b5096505086013592505080821115611f41578283fd5b50611f4e85828601611e0a565b9150509250929050565b60006020808385031215611f6a578182fd5b82356001600160401b03811115611f7f578283fd5b8301601f81018513611f8f578283fd5b8035611f9d611e2a826123a0565b8181528381019083850185840285018601891015611fb9578687fd5b8694505b83851015611fdb578035835260019490940193918501918501611fbd565b50979650505050505050565b600060208284031215611ff8578081fd5b81356001600160401b0381111561200d578182fd5b8201601f8101841361201d578182fd5b803561202b611e2a826123bd565b81815285602083850101111561203f578384fd5b81602084016020830137908101602001929092525092915050565b60006020828403121561206b578081fd5b81516001600160401b03811115612080578182fd5b8201601f81018413612090578182fd5b805161209e611e2a826123bd565b8181528560208385010111156120b2578384fd5b611d1a8260208301602086016123de565b6000602082840312156120d4578081fd5b5035919050565b600080604083850312156120ed578182fd5b505080516020909101519092909150565b6000815180845260208085019450808401835b838110156121365781516001600160a01b031687529582019590820190600101612111565b509495945050505050565b6000815180845260208085019450848183028601828601855b85811015611e725783830389526121728383516121b3565b9885019892509084019060010161215a565b6000815180845260208085019450808401835b8381101561213657815187529582019590820190600101612197565b600081518084526121cb8160208601602086016123de565b601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b818110156122345783516001600160a01b03168352928401929184019160010161220f565b50909695505050505050565b60a08101818360005b60058110156122715781516001600160a01b0316835260209283019290910190600101612249565b50505092915050565b600060208252611e9b60208301846120fe565b600060208252611e9b6020830184612141565b6000604082526122b36040830185612141565b8281036020840152611d1a81856120fe565b600060208252611e9b6020830184612184565b6000604082526122b36040830185612184565b6000604082526122fe6040830185612184565b8281036020840152611d1a8185612141565b6000606082526123236060830186612184565b82810360208401526123358186612141565b9050828103604084015261234981856120fe565b9695505050505050565b600060208252611e9b60208301846121b3565b90815260200190565b918252602082015260400190565b6040518181016001600160401b038111828210171561239857fe5b604052919050565b60006001600160401b038211156123b357fe5b5060209081020190565b60006001600160401b038211156123d057fe5b50601f01601f191660200190565b60005b838110156123f95781810151838201526020016123e1565b83811115612408576000848401525b50505050565b6001600160a01b038116811461134d57600080fdfe4654534f20696e646578206e6f7420737570706f727465640000000000000000a2646970667358221220b82c8eb1091dfafd57dad22254712f98d4b4e0d2b4207178f092a2c535ac8ac964736f6c63430007060033