Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- SimpleERC20Token
- Optimization enabled
- true
- Compiler version
- v0.8.20+commit.a1b79de6
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2023-11-02T19:08:40.163096Z
contracts/ASimpleToken.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IFtsoRegistry} from "@flarenetwork/flare-periphery-contracts/coston2/ftso/userInterfaces/IFtsoRegistry.sol"; import {FlareContractsRegistryLibrary} from "@flarenetwork/flare-periphery-contracts/coston2/util-contracts/ContractRegistryLibrary.sol"; // We want o sell this token for 10 USD equivalent but paid in Flare contract SimpleERC20Token is ERC20 { address public owner; uint256 public addedAt; string public some = "some"; constructor() ERC20("name", "symbol") { owner = msg.sender; addedAt = block.timestamp; } function calculateTokenAmount( uint256 flrAmount ) public view returns (uint256) { uint256 priceOfToken = 10; // 10 $/Token IFtsoRegistry ftsoRegistry = FlareContractsRegistryLibrary .getFtsoRegistry(); (uint256 price, , uint256 decimals) = ftsoRegistry .getCurrentPriceWithDecimals("C2FLR"); uint256 amountToMint = (flrAmount * price) / (priceOfToken * 10 ** decimals); return amountToMint; } function mint() public payable returns (uint256) { uint256 amountToMint = calculateTokenAmount(msg.value); _mint(msg.sender, amountToMint); return amountToMint; } }
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
@flarenetwork/flare-periphery-contracts/coston2/distribution/userInterfaces/IDistributionToDelegators.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; pragma abicoder v2; interface IDistributionToDelegators { // Events event UseGoodRandomSet(bool useGoodRandom, uint256 maxWaitForGoodRandomSeconds); event EntitlementStart(uint256 entitlementStartTs); event AccountClaimed(address indexed whoClaimed, address indexed sentTo, uint256 month, uint256 amountWei); event AccountOptOut(address indexed theAccount, bool confirmed); // Methods /** * @notice Allows the sender to claim or wrap rewards for reward owner. * @notice The caller does not have to be the owner, but must be approved by the owner to claim on his behalf, * this approval is done by calling `setClaimExecutors`. * @notice It is actually safe for this to be called by anybody (nothing can be stolen), but by limiting who can * call, we allow the owner to control the timing of the calls. * @notice Reward owner can claim to any `_recipient`, while the executor can only claim to the reward owner, * reward owners's personal delegation account or one of the addresses set by `setAllowedClaimRecipients`. * @param _rewardOwner address of the reward owner * @param _recipient address to transfer funds to * @param _month last month to claim for * @param _wrap should reward be wrapped immediately * @return _rewardAmount amount of total claimed rewards */ function claim(address _rewardOwner, address _recipient, uint256 _month, bool _wrap) external returns(uint256 _rewardAmount); /** * @notice Allows batch claiming for the list of '_rewardOwners' up to given '_month'. * @notice If reward owner has enabled delegation account, rewards are also claimed for that delegation account and * total claimed amount is sent to that delegation account, otherwise claimed amount is sent to owner's account. * @notice Claimed amount is automatically wrapped. * @notice Method can be used by reward owner or executor. If executor is registered with fee > 0, * then fee is paid to executor for each claimed address from the list. * @param _rewardOwners list of reward owners to claim for * @param _month last month to claim for */ function autoClaim(address[] calldata _rewardOwners, uint256 _month) external; /** * @notice Method to opt-out of receiving airdrop rewards */ function optOutOfAirdrop() external; /** * @notice Returns the next claimable month for '_rewardOwner'. * @param _rewardOwner address of the reward owner */ function nextClaimableMonth(address _rewardOwner) external view returns (uint256); /** * @notice get claimable amount of wei for requesting account for specified month * @param _month month of interest * @return _amountWei amount of wei available for this account and provided month */ function getClaimableAmount(uint256 _month) external view returns(uint256 _amountWei); /** * @notice get claimable amount of wei for account for specified month * @param _account the address of an account we want to get the claimable amount of wei * @param _month month of interest * @return _amountWei amount of wei available for provided account and month */ function getClaimableAmountOf(address _account, uint256 _month) external view returns(uint256 _amountWei); /** * @notice Returns the current month * @return _currentMonth Current month, 0 before entitlementStartTs */ function getCurrentMonth() external view returns (uint256 _currentMonth); /** * @notice Returns the month that will expire next * @return _monthToExpireNext Month that will expire next, 1100 when last month expired */ function getMonthToExpireNext() external view returns (uint256 _monthToExpireNext); /** * @notice Returns claimable months - reverts if none * @return _startMonth first claimable month * @return _endMonth last claimable month */ function getClaimableMonths() external view returns(uint256 _startMonth, uint256 _endMonth); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/ftso/interface/IIFtso.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "../../genesis/interface/IFtsoGenesis.sol"; import "../../userInterfaces/IFtso.sol"; import "../../../util-contracts/token/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 fallbackFinalizePriceEpoch(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 _submitPeriodSeconds, uint256 _revealPeriodSeconds ) 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, uint256 _elasticBandRewardBIPS, uint256 _elasticBandWidthPPM, 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 ftso manager address */ function ftsoManager() external view returns (address); /** * @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 _elasticBandRewardBIPS Hybrid reward band, where _elasticBandRewardBIPS goes to the elastic band (prices within _elasticBandWidthPPM of the median) and 10000 - elasticBandRewardBIPS to the IQR * @return _elasticBandWidthPPM Prices within _elasticBandWidthPPM of median are rewarded * @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, uint256 _elasticBandRewardBIPS, uint256 _elasticBandWidthPPM, 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); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/genesis/interface/IFtsoGenesis.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IFtsoGenesis { /** * @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 * @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 _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); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/genesis/interface/IFtsoManagerGenesis.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IFtsoManagerGenesis { function getCurrentPriceEpochId() external view returns (uint256 _priceEpochId); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/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); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/userInterfaces/IFtso.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IFtso { enum PriceFinalizationType { // initial state NOT_FINALIZED, // median calculation used to find price WEIGHTED_MEDIAN, // low turnout - price calculated from median of trusted addresses TRUSTED_ADDRESSES, // low turnout + no votes from trusted addresses - price copied from previous epoch PREVIOUS_PRICE_COPIED, // price calculated from median of trusted addresses - triggered due to an exception TRUSTED_ADDRESSES_EXCEPTION, // previous price copied - triggered due to an exception PREVIOUS_PRICE_COPIED_EXCEPTION } event PriceRevealed( address indexed voter, uint256 indexed epochId, uint256 price, uint256 timestamp, uint256 votePowerNat, uint256 votePowerAsset ); event PriceFinalized( uint256 indexed epochId, uint256 price, bool rewardedFtso, uint256 lowIQRRewardPrice, uint256 highIQRRewardPrice, uint256 lowElasticBandRewardPrice, uint256 highElasticBandRewardPrice, 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 _firstEpochStartTs First epoch start timestamp * @return _submitPeriodSeconds Submit period in seconds * @return _revealPeriodSeconds Reveal period in seconds */ function getPriceEpochConfiguration() external view returns ( uint256 _firstEpochStartTs, uint256 _submitPeriodSeconds, uint256 _revealPeriodSeconds ); /** * @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 asset price and number of decimals * @return _price Price in USD multiplied by ASSET_PRICE_USD_DECIMALS * @return _timestamp Time when price was updated for the last time * @return _assetPriceUsdDecimals Number of decimals used for USD price */ function getCurrentPriceWithDecimals() external view returns ( uint256 _price, uint256 _timestamp, uint256 _assetPriceUsdDecimals ); /** * @notice Returns current asset price calculated from trusted providers * @return _price Price in USD multiplied by ASSET_PRICE_USD_DECIMALS * @return _timestamp Time when price was updated for the last time */ function getCurrentPriceFromTrustedProviders() external view returns (uint256 _price, uint256 _timestamp); /** * @notice Returns current asset price calculated from trusted providers and number of decimals * @return _price Price in USD multiplied by ASSET_PRICE_USD_DECIMALS * @return _timestamp Time when price was updated for the last time * @return _assetPriceUsdDecimals Number of decimals used for USD price */ function getCurrentPriceWithDecimalsFromTrustedProviders() external view returns ( uint256 _price, uint256 _timestamp, uint256 _assetPriceUsdDecimals ); /** * @notice Returns current asset price details * @return _price Price in USD multiplied by ASSET_PRICE_USD_DECIMALS * @return _priceTimestamp Time when price was updated for the last time * @return _priceFinalizationType Finalization type when price was updated for the last time * @return _lastPriceEpochFinalizationTimestamp Time when last price epoch was finalized * @return _lastPriceEpochFinalizationType Finalization type of last finalized price epoch */ function getCurrentPriceDetails() external view returns ( uint256 _price, uint256 _priceTimestamp, PriceFinalizationType _priceFinalizationType, uint256 _lastPriceEpochFinalizationTimestamp, PriceFinalizationType _lastPriceEpochFinalizationType ); /** * @notice Returns current random number */ function getCurrentRandom() external view returns (uint256); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/userInterfaces/IFtsoManager.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "../ftso/interface/IIFtso.sol"; import "../genesis/interface/IFtsoManagerGenesis.sol"; interface IFtsoManager is IFtsoManagerGenesis { 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); event AccruingUnearnedRewardsFailed(uint256 epochId); event UseGoodRandomSet(bool useGoodRandom, uint256 maxWaitForGoodRandomSeconds); function active() external view returns (bool); function getCurrentRewardEpoch() external view returns (uint256); function getRewardEpochVotePowerBlock(uint256 _rewardEpoch) external view returns (uint256); function getRewardEpochToExpireNext() 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 getRewardEpochConfiguration() external view returns ( uint256 _firstRewardEpochStartTs, uint256 _rewardEpochDurationSeconds ); function getFallbackMode() external view returns ( bool _fallbackMode, IIFtso[] memory _ftsos, bool[] memory _ftsoInFallbackMode ); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/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 { struct PriceInfo { uint256 ftsoIndex; uint256 price; uint256 decimals; uint256 timestamp; } 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 getCurrentPriceWithDecimals(uint256 _assetIndex) external view returns(uint256 _price, uint256 _timestamp, uint256 _assetPriceUsdDecimals); function getCurrentPriceWithDecimals(string memory _symbol) external view returns(uint256 _price, uint256 _timestamp, uint256 _assetPriceUsdDecimals); function getAllCurrentPrices() external view returns (PriceInfo[] memory); function getCurrentPricesByIndices(uint256[] memory _indices) external view returns (PriceInfo[] memory); function getCurrentPricesBySymbols(string[] memory _symbols) external view returns (PriceInfo[] memory); 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); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/userInterfaces/IFtsoRewardManager.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IFtsoRewardManager { event RewardClaimed( address indexed dataProvider, address indexed whoClaimed, address indexed sentTo, uint256 rewardEpoch, uint256 amount ); event UnearnedRewardsAccrued( uint256 epochId, uint256 reward ); event RewardsDistributed( address indexed ftso, uint256 epochId, address[] addresses, uint256[] rewards ); event RewardClaimsEnabled( uint256 rewardEpochId ); event FeePercentageChanged( address indexed dataProvider, uint256 value, uint256 validFromEpoch ); event RewardClaimsExpired( uint256 rewardEpochId ); event FtsoRewardManagerActivated(address ftsoRewardManager); event FtsoRewardManagerDeactivated(address ftsoRewardManager); /** * @notice Allows a percentage delegator to claim rewards. * @notice This function is intended to be used to claim rewards in case of delegation by percentage. * @param _recipient address to transfer funds to * @param _rewardEpochs array of reward epoch numbers to claim for * @return _rewardAmount amount of total claimed rewards * @dev Reverts if `msg.sender` is delegating by amount * @dev Claims for all unclaimed reward epochs to the 'max(_rewardEpochs)'. * @dev Retained for backward compatibility. * @dev This function is deprecated - use `claim` instead. */ function claimReward( address payable _recipient, uint256[] calldata _rewardEpochs ) external returns (uint256 _rewardAmount); /** * @notice Allows the sender to claim or wrap rewards for reward owner. * @notice This function is intended to be used to claim rewards in case of delegation by percentage. * @notice The caller does not have to be the owner, but must be approved by the owner to claim on his behalf, * this approval is done by calling `setClaimExecutors`. * @notice It is actually safe for this to be called by anybody (nothing can be stolen), but by limiting who can * call, we allow the owner to control the timing of the calls. * @notice Reward owner can claim to any `_recipient`, while the executor can only claim to the reward owner, * reward owners's personal delegation account or one of the addresses set by `setAllowedClaimRecipients`. * @param _rewardOwner address of the reward owner * @param _recipient address to transfer funds to * @param _rewardEpoch last reward epoch to claim for * @param _wrap should reward be wrapped immediately * @return _rewardAmount amount of total claimed rewards * @dev Reverts if `msg.sender` is delegating by amount */ function claim( address _rewardOwner, address payable _recipient, uint256 _rewardEpoch, bool _wrap ) external returns (uint256 _rewardAmount); /** * @notice Allows the sender to claim rewards from specified data providers. * @notice This function is intended to be used to claim rewards in case of delegation by amount. * @param _recipient address to transfer funds to * @param _rewardEpochs array of reward epoch numbers to claim for * @param _dataProviders array of addresses representing data providers to claim the reward from * @return _rewardAmount amount of total claimed rewards * @dev Function can only be used for explicit delegations. * @dev This function is deprecated - use `claimFromDataProviders` instead. */ function claimRewardFromDataProviders( address payable _recipient, uint256[] calldata _rewardEpochs, address[] calldata _dataProviders ) external returns (uint256 _rewardAmount); /** * @notice Allows the sender to claim or wrap rewards for reward owner from specified data providers. * @notice This function is intended to be used to claim rewards in case of delegation by amount. * @notice The caller does not have to be the owner, but must be approved by the owner to claim on his behalf, * this approval is done by calling `setClaimExecutors`. * @notice It is actually safe for this to be called by anybody (nothing can be stolen), but by limiting who can * call, we allow the owner to control the timing of the calls. * @notice Reward owner can claim to any `_recipient`, while the executor can only claim to the reward owner, * reward owners's personal delegation account or one of the addresses set by `setAllowedClaimRecipients`. * @param _rewardOwner address of the reward owner * @param _recipient address to transfer funds to * @param _rewardEpochs array of reward epoch numbers to claim for * @param _dataProviders array of addresses representing data providers to claim the reward from * @param _wrap should reward be wrapped immediately * @return _rewardAmount amount of total claimed rewards * @dev Function can only be used for explicit delegations. */ function claimFromDataProviders( address _rewardOwner, address payable _recipient, uint256[] calldata _rewardEpochs, address[] calldata _dataProviders, bool _wrap ) external returns (uint256 _rewardAmount); /** * @notice Allows batch claiming for the list of '_rewardOwners' and for all unclaimed epochs <= '_rewardEpoch'. * @notice If reward owner has enabled delegation account, rewards are also claimed for that delegation account and * total claimed amount is sent to that delegation account, otherwise claimed amount is sent to owner's account. * @notice Claimed amount is automatically wrapped. * @notice Method can be used by reward owner or executor. If executor is registered with fee > 0, * then fee is paid to executor for each claimed address from the list. * @param _rewardOwners list of reward owners to claim for * @param _rewardEpoch last reward epoch to claim for */ function autoClaim(address[] calldata _rewardOwners, uint256 _rewardEpoch) external; /** * @notice Allows data provider to set (or update last) fee percentage. * @param _feePercentageBIPS number representing fee percentage in BIPS * @return _validFromEpoch reward epoch number when the setting becomes effective. */ function setDataProviderFeePercentage(uint256 _feePercentageBIPS) external returns (uint256 _validFromEpoch); /** * @notice Allows reward claiming */ function active() external view returns (bool); /** * @notice Returns the current fee percentage of `_dataProvider` * @param _dataProvider address representing data provider */ function getDataProviderCurrentFeePercentage(address _dataProvider) external view returns (uint256 _feePercentageBIPS); /** * @notice Returns the fee percentage of `_dataProvider` at `_rewardEpoch` * @param _dataProvider address representing data provider * @param _rewardEpoch reward epoch number */ function getDataProviderFeePercentage( address _dataProvider, uint256 _rewardEpoch ) external view returns (uint256 _feePercentageBIPS); /** * @notice Returns the scheduled fee percentage changes of `_dataProvider` * @param _dataProvider address representing data provider * @return _feePercentageBIPS positional array of fee percentages in BIPS * @return _validFromEpoch positional array of block numbers the fee settings are effective from * @return _fixed positional array of boolean values indicating if settings are subjected to change */ function getDataProviderScheduledFeePercentageChanges(address _dataProvider) external view returns ( uint256[] memory _feePercentageBIPS, uint256[] memory _validFromEpoch, bool[] memory _fixed ); /** * @notice Returns information on epoch reward * @param _rewardEpoch reward epoch number * @return _totalReward number representing the total epoch reward * @return _claimedReward number representing the amount of total epoch reward that has been claimed */ function getEpochReward(uint256 _rewardEpoch) external view returns (uint256 _totalReward, uint256 _claimedReward); /** * @notice Returns the state of rewards for `_beneficiary` at `_rewardEpoch` * @param _beneficiary address of reward beneficiary * @param _rewardEpoch reward epoch number * @return _dataProviders positional array of addresses representing data providers * @return _rewardAmounts positional array of reward amounts * @return _claimed positional array of boolean values indicating if reward is claimed * @return _claimable boolean value indicating if rewards are claimable * @dev Reverts when queried with `_beneficiary` delegating by amount */ function getStateOfRewards( address _beneficiary, uint256 _rewardEpoch ) external view returns ( address[] memory _dataProviders, uint256[] memory _rewardAmounts, bool[] memory _claimed, bool _claimable ); /** * @notice Returns the state of rewards for `_beneficiary` at `_rewardEpoch` from `_dataProviders` * @param _beneficiary address of reward beneficiary * @param _rewardEpoch reward epoch number * @param _dataProviders positional array of addresses representing data providers * @return _rewardAmounts positional array of reward amounts * @return _claimed positional array of boolean values indicating if reward is claimed * @return _claimable boolean value indicating if rewards are claimable */ function getStateOfRewardsFromDataProviders( address _beneficiary, uint256 _rewardEpoch, address[] calldata _dataProviders ) external view returns ( uint256[] memory _rewardAmounts, bool[] memory _claimed, bool _claimable ); /** * @notice Returns the start and the end of the reward epoch range for which the reward is claimable * @param _startEpochId the oldest epoch id that allows reward claiming * @param _endEpochId the newest epoch id that allows reward claiming */ function getEpochsWithClaimableRewards() external view returns ( uint256 _startEpochId, uint256 _endEpochId ); /** * @notice Returns the next claimable reward epoch for '_rewardOwner'. * @param _rewardOwner address of the reward owner */ function nextClaimableRewardEpoch(address _rewardOwner) external view returns (uint256); /** * @notice Returns the array of claimable epoch ids for which the reward has not yet been claimed * @param _beneficiary address of reward beneficiary * @return _epochIds array of epoch ids * @dev Reverts when queried with `_beneficiary` delegating by amount */ function getEpochsWithUnclaimedRewards(address _beneficiary) external view returns ( uint256[] memory _epochIds ); /** * @notice Returns the information on claimed reward of `_dataProvider` for `_rewardEpoch` by `_claimer` * @param _rewardEpoch reward epoch number * @param _dataProvider address representing the data provider * @param _claimer address representing the claimer * @return _claimed boolean indicating if reward has been claimed * @return _amount number representing the claimed amount */ function getClaimedReward( uint256 _rewardEpoch, address _dataProvider, address _claimer ) external view returns ( bool _claimed, uint256 _amount ); /** * @notice Return reward epoch that will expire, when new reward epoch will start * @return Reward epoch id that will expire next */ function getRewardEpochToExpireNext() external view returns (uint256); /** * @notice Return reward epoch vote power block * @param _rewardEpoch reward epoch number */ function getRewardEpochVotePowerBlock(uint256 _rewardEpoch) external view returns (uint256); /** * @notice Return current reward epoch number */ function getCurrentRewardEpoch() external view returns (uint256); /** * @notice Return initial reward epoch number */ function getInitialRewardEpoch() external view returns (uint256); /** * @notice Returns the information on rewards and initial vote power of `_dataProvider` for `_rewardEpoch` * @param _rewardEpoch reward epoch number * @param _dataProvider address representing the data provider * @return _rewardAmount number representing the amount of rewards * @return _votePowerIgnoringRevocation number representing the vote power ignoring revocations */ function getDataProviderPerformanceInfo( uint256 _rewardEpoch, address _dataProvider ) external view returns ( uint256 _rewardAmount, uint256 _votePowerIgnoringRevocation ); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/userInterfaces/IPriceSubmitter.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "../genesis/interface/IFtsoGenesis.sol"; import "../genesis/interface/IFtsoRegistryGenesis.sol"; import "../genesis/interface/IFtsoManagerGenesis.sol"; interface IPriceSubmitter { /** * Event emitted when hash was submitted through PriceSubmitter. * @param submitter the address of the sender * @param epochId current price epoch id * @param hash the submitted hash * @param timestamp current block timestamp */ event HashSubmitted( address indexed submitter, uint256 indexed epochId, bytes32 hash, 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 random, uint256 timestamp ); /** * @notice Submits hash for current epoch * @param _epochId Target epoch id to which hash is submitted * @param _hash Hash of ftso indices, prices, random number and voter address * @notice Emits HashSubmitted event */ function submitHash( uint256 _epochId, bytes32 _hash ) 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 increasing ftso indices * @param _prices List of submitted prices in USD * @param _random Submitted random number * @notice The hash of ftso indices, prices, random number and voter address must be equal to the submitted hash * @notice Emits PricesRevealed event */ function revealPrices( uint256 _epochId, uint256[] memory _ftsoIndices, uint256[] memory _prices, uint256 _random ) 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 (IFtsoManagerGenesis); /** * @notice Returns current random number */ function getCurrentRandom() 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); }
@flarenetwork/flare-periphery-contracts/coston2/ftso/userInterfaces/IVoterWhitelister.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IVoterWhitelister { /** * Raised when an account is removed from the voter whitelist. */ event VoterWhitelisted(address voter, uint256 ftsoIndex); /** * Raised when an account is removed from the voter whitelist. */ event VoterRemovedFromWhitelist(address voter, uint256 ftsoIndex); /** * Raised when an account is chilled from the voter whitelist. */ event VoterChilled(address voter, uint256 untilRewardEpoch); /** * Request to whitelist `_voter` account to ftso at `_ftsoIndex`. Will revert if vote power too low. * May be called by any address. */ function requestWhitelistingVoter(address _voter, uint256 _ftsoIndex) external; /** * Request to whitelist `_voter` account to all active ftsos. * May be called by any address. * It returns an array of supported ftso indices and success flag per index. */ function requestFullVoterWhitelisting( address _voter ) external returns ( uint256[] memory _supportedIndices, bool[] memory _success ); /** * Maximum number of voters in the whitelist for a new FTSO. */ function defaultMaxVotersForFtso() external view returns (uint256); /** * Maximum number of voters in the whitelist for FTSO at index `_ftsoIndex`. */ function maxVotersForFtso(uint256 _ftsoIndex) external view returns (uint256); /** * Get whitelisted price providers for ftso with `_symbol` */ function getFtsoWhitelistedPriceProvidersBySymbol(string memory _symbol) external view returns (address[] memory); /** * Get whitelisted price providers for ftso at `_ftsoIndex` */ function getFtsoWhitelistedPriceProviders(uint256 _ftsoIndex) external view returns (address[] memory); /** * In case of providing bad prices (e.g. collusion), the voter can be chilled for a few reward epochs. * A voter can whitelist again from a returned reward epoch onwards. */ function chilledUntilRewardEpoch(address _voter) external view returns (uint256); }
@flarenetwork/flare-periphery-contracts/coston2/governance/userInterfaces/IGovernanceVotePower.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; /** * Interface for contracts delegating their governance vote power. */ interface IGovernanceVotePower { /** * Delegates all governance vote power of `msg.sender` to address `_to`. * @param _to The address of the recipient. */ function delegate(address _to) external; /** * Undelegates all governance vote power of `msg.sender`. */ function undelegate() external; /** * Gets the governance vote power of an address at a given block number, including * all delegations made to it. * @param _who The address being queried. * @param _blockNumber The block number at which to fetch the vote power. * @return Governance vote power of `_who` at `_blockNumber`. */ function votePowerOfAt(address _who, uint256 _blockNumber) external view returns(uint256); /** * Gets the governance vote power of an address at the latest block, including * all delegations made to it. * @param _who The address being queried. * @return Governance vote power of `account` at the lastest block. */ function getVotes(address _who) external view returns (uint256); /** * Gets the address an account is delegating its governance vote power to, at a given block number. * @param _who The address being queried. * @param _blockNumber The block number at which to fetch the address. * @return Address where `_who` was delegating its governance vote power at block `_blockNumber`. */ function getDelegateOfAt(address _who, uint256 _blockNumber) external view returns (address); /** * Gets the address an account is delegating its governance vote power to, at the latest block number. * @param _who The address being queried. * @return Address where `_who` is currently delegating its governance vote power. */ function getDelegateOfAtNow(address _who) external view returns (address); }
@flarenetwork/flare-periphery-contracts/coston2/stateConnector/interface/IStateConnector.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; // solhint-disable func-name-mixedcase interface IStateConnector { event AttestationRequest( address sender, uint256 timestamp, bytes data ); event RoundFinalised( uint256 indexed roundId, bytes32 merkleRoot ); /** * The method to call for requesting a new attestation. * Emits event `AttestationRequest`, which triggers work by attestation providers. */ function requestAttestations(bytes calldata _data) external; /** * Last finalized round id. */ function lastFinalizedRoundId() external view returns (uint256 _roundId); /** * Get Merkle root for the round and check for buffer overflows. */ function merkleRoot(uint256 _roundId) external view returns (bytes32); /** * The first buffer timestamp * (start time in seconds for converting the timestamp into a round number). */ function BUFFER_TIMESTAMP_OFFSET() external view returns (uint256); /** * Amount of time a buffer is active before cycling to the next one * (round length in seconds for converting the timestamp into a round number). */ function BUFFER_WINDOW() external view returns (uint256); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/ContractRegistryLibrary.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IFlareContractRegistry} from "./userInterfaces/IFlareContractRegistry.sol"; // Auto generated imports // AUTO GENERATED - DO NOT EDIT BELOW THIS LINE import {IStateConnector} from "../stateConnector/interface/IStateConnector.sol"; import {IPriceSubmitter} from "../ftso/userInterfaces/IPriceSubmitter.sol"; import {IFtsoRewardManager} from "../ftso/userInterfaces/IFtsoRewardManager.sol"; import {IFtsoRegistry} from "../ftso/userInterfaces/IFtsoRegistry.sol"; import {IVoterWhitelister} from "../ftso/userInterfaces/IVoterWhitelister.sol"; import {IDistributionToDelegators} from "../distribution/userInterfaces/IDistributionToDelegators.sol"; import {IFtsoManager} from "../ftso/userInterfaces/IFtsoManager.sol"; import {IWNat} from "../util-contracts/token/userInterfaces/IWNat.sol"; import {IGenericRewardManager} from "../util-contracts/tokenPools/userInterfaces/IGenericRewardManager.sol"; // END AUTO GENERATED - DO NOT EDIT ABOVE THIS LINE // Library is intended to be used inline, so the strings are all memory allocated (instead of calldata) library FlareContractsRegistryLibrary { address internal constant FLARE_CONTRACT_REGISTRY_ADDRESS = 0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019; IFlareContractRegistry internal constant FLARE_CONTRACT_REGISTRY = IFlareContractRegistry(FLARE_CONTRACT_REGISTRY_ADDRESS); /** * @notice Returns contract address for the given name - might be address(0) * @param _name name of the contract */ function getContractAddressByName( string memory _name ) internal view returns (address) { return FLARE_CONTRACT_REGISTRY.getContractAddressByName(_name); } /** * @notice Returns contract address for the given name hash - might be address(0) * @param _nameHash hash of the contract name (keccak256(abi.encode(name)) */ function getContractAddressByHash( bytes32 _nameHash ) internal view returns (address) { return FLARE_CONTRACT_REGISTRY.getContractAddressByHash(_nameHash); } /** * @notice Returns contract addresses for the given names - might be address(0) * @param _names names of the contracts */ function getContractAddressesByName( string[] memory _names ) internal view returns (address[] memory) { return FLARE_CONTRACT_REGISTRY.getContractAddressesByName(_names); } /** * @notice Returns contract addresses for the given name hashes - might be address(0) * @param _nameHashes hashes of the contract names (keccak256(abi.encode(name)) */ function getContractAddressesByHash( bytes32[] memory _nameHashes ) internal view returns (address[] memory) { return FLARE_CONTRACT_REGISTRY.getContractAddressesByHash(_nameHashes); } /** * @notice Returns all contract names and corresponding addresses */ function getAllContracts() internal view returns (string[] memory _names, address[] memory _addresses) { return FLARE_CONTRACT_REGISTRY.getAllContracts(); } // Nice typed getters for all the important contracts // AUTO GENERATED - DO NOT EDIT BELOW THIS LINE function getStateConnector() internal view returns (IStateConnector) { return IStateConnector( FLARE_CONTRACT_REGISTRY.getContractAddressByName( "StateConnector" ) ); } function getPriceSubmitter() internal view returns (IPriceSubmitter) { return IPriceSubmitter( FLARE_CONTRACT_REGISTRY.getContractAddressByName( "PriceSubmitter" ) ); } function getFtsoRewardManager() internal view returns (IFtsoRewardManager) { return IFtsoRewardManager( FLARE_CONTRACT_REGISTRY.getContractAddressByName( "FtsoRewardManager" ) ); } function getFtsoRegistry() internal view returns (IFtsoRegistry) { return IFtsoRegistry( FLARE_CONTRACT_REGISTRY.getContractAddressByName("FtsoRegistry") ); } function getVoterWhitelister() internal view returns (IVoterWhitelister) { return IVoterWhitelister( FLARE_CONTRACT_REGISTRY.getContractAddressByName( "VoterWhitelister" ) ); } function getDistributionToDelegators() internal view returns (IDistributionToDelegators) { return IDistributionToDelegators( FLARE_CONTRACT_REGISTRY.getContractAddressByName( "DistributionToDelegators" ) ); } function getFtsoManager() internal view returns (IFtsoManager) { return IFtsoManager( FLARE_CONTRACT_REGISTRY.getContractAddressByName("FtsoManager") ); } function getWNat() internal view returns (IWNat) { return IWNat(FLARE_CONTRACT_REGISTRY.getContractAddressByName("WNat")); } function getValidatorRewardManager() internal view returns (IGenericRewardManager) { return IGenericRewardManager( FLARE_CONTRACT_REGISTRY.getContractAddressByName( "ValidatorRewardManager" ) ); } // END AUTO GENERATED - DO NOT EDIT ABOVE THIS LINE }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/infrastructure/userInterfaces/IPChainStakeMirror.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; pragma abicoder v2; import "./IPChainVotePower.sol"; import "./IPChainStakeMirrorVerifier.sol"; /** * Interface for the `PChainStakeMirror` contract. */ interface IPChainStakeMirror is IPChainVotePower { /** * Event emitted when max updates per block is set. * @param maxUpdatesPerBlock new number of max updated per block */ event MaxUpdatesPerBlockSet(uint256 maxUpdatesPerBlock); /** * Event emitted when the stake is confirmed. * @param owner The address who opened the stake. * @param nodeId Node id to which the stake was added. * @param txHash Unique tx hash - keccak256(abi.encode(PChainStake.txId, PChainStake.inputAddress)); * @param amountWei Stake amount (in wei). * @param pChainTxId P-chain transaction id. */ event StakeConfirmed( address indexed owner, bytes20 indexed nodeId, bytes32 indexed txHash, uint256 amountWei, bytes32 pChainTxId ); /** * Event emitted when the stake has ended. * @param owner The address whose stake has ended. * @param nodeId Node id from which the stake was removed. * @param txHash Unique tx hash - keccak256(abi.encode(PChainStake.txId, PChainStake.inputAddress)); * @param amountWei Stake amount (in wei). */ event StakeEnded( address indexed owner, bytes20 indexed nodeId, bytes32 indexed txHash, uint256 amountWei ); /** * Event emitted when the stake was revoked. * @param owner The address whose stake has ended. * @param nodeId Node id from which the stake was removed. * @param txHash Unique tx hash - keccak256(abi.encode(PChainStake.txId, PChainStake.inputAddress)); * @param amountWei Stake amount (in wei). */ event StakeRevoked( address indexed owner, bytes20 indexed nodeId, bytes32 indexed txHash, uint256 amountWei ); /** * Method for P-chain stake mirroring using `PChainStake` data and Merkle proof. * @param _stakeData Information about P-chain stake. * @param _merkleProof Merkle proof that should be used to prove the P-chain stake. */ function mirrorStake( IPChainStakeMirrorVerifier.PChainStake calldata _stakeData, bytes32[] calldata _merkleProof ) external; /** * Method for checking if active stake (stake start time <= block.timestamp < stake end time) was already mirrored. * @param _txId P-chain stake transaction id. * @param _inputAddress P-chain address that opened stake. * @return True if stake is active and mirrored. */ function isActiveStakeMirrored(bytes32 _txId, bytes20 _inputAddress) external view returns(bool); /** * Total amount of tokens at current block. * @return The current total amount of tokens. **/ function totalSupply() external view returns (uint256); /** * 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); /** * Queries the token balance of `_owner` at current block. * @param _owner The address from which the balance will be retrieved. * @return The current balance. **/ function balanceOf(address _owner) external view returns (uint256); /** * 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); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/infrastructure/userInterfaces/IPChainStakeMirrorVerifier.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; pragma abicoder v2; /** * Interface with structure for P-chain stake mirror verifications. */ interface IPChainStakeMirrorVerifier { /** * Structure describing the P-chain stake. */ struct PChainStake { // Hash of the transaction on the underlying chain. bytes32 txId; // Type of the staking/delegation transaction: '0' for 'ADD_VALIDATOR_TX' and '1' for 'ADD_DELEGATOR_TX'. uint8 stakingType; // Input address that triggered the staking or delegation transaction. // See https://support.avax.network/en/articles/4596397-what-is-an-address for address definition for P-chain. bytes20 inputAddress; // NodeID to which staking or delegation is done. // For definitions, see https://github.com/ava-labs/avalanchego/blob/master/ids/node_id.go. bytes20 nodeId; // Start time of the staking/delegation in seconds (Unix epoch). uint64 startTime; // End time of the staking/delegation in seconds (Unix epoch). uint64 endTime; // Staked or delegated amount in Gwei (nano FLR). uint64 weight; } }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/infrastructure/userInterfaces/IPChainVotePower.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; /** * Interface for the vote power part of the `PChainStakeMirror` contract. */ interface IPChainVotePower { /** * Event triggered when a stake is confirmed or at the time it ends. * Definition: `votePowerFromTo(owner, nodeId)` is `changed` from `priorVotePower` to `newVotePower`. * @param owner The account that has changed the amount of vote power it is staking. * @param nodeId The node id whose received vote power has changed. * @param priorVotePower The vote power originally on that node id. * @param newVotePower The new vote power that triggered this event. */ event VotePowerChanged( address indexed owner, bytes20 indexed nodeId, uint256 priorVotePower, uint256 newVotePower ); /** * Emitted when a vote power cache entry is created. * Allows history cleaners to track vote power cache cleanup opportunities off-chain. * @param nodeId The node id whose vote power has just been cached. * @param blockNumber The block number at which the vote power has been cached. */ event VotePowerCacheCreated(bytes20 nodeId, uint256 blockNumber); /** * 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 node id to get voting power. * @param _blockNumber The block number at which to fetch. * @return Vote power of `_owner` at `_blockNumber`. */ function votePowerOfAtCached(bytes20 _owner, uint256 _blockNumber) external returns(uint256); /** * 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); /** * Get the current total vote power. * @return The current total vote power (sum of all accounts' vote powers). */ function totalVotePower() external view returns(uint256); /** * 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); /** * Get the amounts and node ids being staked to by a vote power owner. * @param _owner The address being queried. * @return _nodeIds Array of node ids. * @return _amounts Array of staked amounts, for each node id. */ function stakesOf(address _owner) external view returns ( bytes20[] memory _nodeIds, uint256[] memory _amounts ); /** * Get the amounts and node ids being staked to by a vote power owner, * at a given block. * @param _owner The address being queried. * @param _blockNumber The block number being queried. * @return _nodeIds Array of node ids. * @return _amounts Array of staked amounts, for each node id. */ function stakesOfAt( address _owner, uint256 _blockNumber ) external view returns ( bytes20[] memory _nodeIds, uint256[] memory _amounts ); /** * Get the current vote power of `_nodeId`. * @param _nodeId The node id to get voting power. * @return Current vote power of `_nodeId`. */ function votePowerOf(bytes20 _nodeId) external view returns(uint256); /** * Get the vote power of `_nodeId` at block `_blockNumber` * @param _nodeId The node id to get voting power. * @param _blockNumber The block number at which to fetch. * @return Vote power of `_nodeId` at `_blockNumber`. */ function votePowerOfAt(bytes20 _nodeId, uint256 _blockNumber) external view returns(uint256); /** * Get current staked vote power from `_owner` staked to `_nodeId`. * @param _owner Address of vote power owner. * @param _nodeId Node id. * @return The staked vote power. */ function votePowerFromTo(address _owner, bytes20 _nodeId) external view returns(uint256); /** * Get current staked vote power from `_owner` staked to `_nodeId` at `_blockNumber`. * @param _owner Address of vote power owner. * @param _nodeId Node id. * @param _blockNumber The block number at which to fetch. * @return The staked vote power. */ function votePowerFromToAt(address _owner, bytes20 _nodeId, uint _blockNumber) external view returns(uint256); /** * Return vote powers for several node ids in a batch. * @param _nodeIds The list of node ids to fetch vote power of. * @param _blockNumber The block number at which to fetch. * @return A list of vote powers. */ function batchVotePowerOfAt( bytes20[] memory _nodeIds, uint256 _blockNumber ) external view returns(uint256[] memory); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/token/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; /** * Get the current cleanup block number. */ function cleanupBlockNumber() external view returns (uint256); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/token/token/interface/IIGovernanceVotePower.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "../../userInterfaces/IVPToken.sol"; import "../../../infrastructure/userInterfaces/IPChainStakeMirror.sol"; import "../../../../governance/userInterfaces/IGovernanceVotePower.sol"; /** * Internal interface for contracts delegating their governance vote power. */ interface IIGovernanceVotePower is IGovernanceVotePower { /** * Emitted when a delegate's vote power changes, as a result of a new delegation * or a token transfer, for example. * * The event is always emitted from a `GovernanceVotePower` contract. * @param delegate The account receiving the changing delegated vote power. * @param previousBalance Delegated vote power before the change. * @param newBalance Delegated vote power after the change. */ event DelegateVotesChanged( address indexed delegate, uint256 previousBalance, uint256 newBalance ); /** * Emitted when an account starts delegating vote power or switches its delegation * to another address. * * The event is always emitted from a `GovernanceVotePower` contract. * @param delegator Account delegating its vote power. * @param fromDelegate Account receiving the delegation before the change. * Can be address(0) if there was no previous delegation. * @param toDelegate Account receiving the delegation after the change. * Can be address(0) if `delegator` just undelegated all its vote power. */ event DelegateChanged( address indexed delegator, address indexed fromDelegate, address indexed toDelegate ); /** * Update governance vote power of all involved delegates after tokens are transferred. * * This function **MUST** be called after each governance token transfer for the * delegates to reflect the correct balance. * @param _from Source address of the transfer. * @param _to Destination address of the transfer. * @param _fromBalance _Ignored._ * @param _toBalance _Ignored._ * @param _amount Amount being transferred. */ 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 lower than the 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. * @param _cleanerContract Address of the cleanup contract. * Usually this will be an instance of `CleanupBlockNumberManager`. */ function setCleanerContract(address _cleanerContract) external; /** * Get the token that this governance vote power contract belongs to. * @return The IVPToken interface owning this contract. */ function ownerToken() external view returns (IVPToken); /** * Get the stake mirror contract that this governance vote power contract belongs to. * @return The IPChainStakeMirror interface owning this contract. */ function pChainStakeMirror() external view returns (IPChainStakeMirror); /** * Get the current cleanup block number set with `setCleanupBlockNumber()`. * @return The currently set cleanup block number. */ function getCleanupBlockNumber() external view returns(uint256); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/token/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 cumulative - 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 cumulative - 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); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/token/token/interface/IIVPToken.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import "../../userInterfaces/IVPToken.sol"; import "../../../../governance/userInterfaces/IGovernanceVotePower.sol"; import "./IIVPContract.sol"; import "./IIGovernanceVotePower.sol"; import "./IICleanable.sol"; interface IIVPToken is IVPToken, IICleanable { /** * Set the contract that is allowed to set cleanupBlockNumber. * Usually this will be an instance of CleanupBlockNumberManager. */ function setCleanupBlockNumberManager(address _cleanupBlockNumberManager) external; /** * 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); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/token/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); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/token/userInterfaces/IVPToken.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../../governance/userInterfaces/IGovernanceVotePower.sol"; import "./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 cumulative - every call resets the delegation value (and value of 0 undelegates `to`). **/ function delegate(address _to, uint256 _bips) external; /** * @notice Undelegate all percentage delegations from the sender and then delegate corresponding * `_bips` percentage of voting power from the sender to each member of `_delegatees`. * @param _delegatees The addresses of the new recipients. * @param _bips The percentages of voting power to be delegated expressed in basis points (1/100 of one percent). * Total of all `_bips` values must be at most 10000. **/ function batchDelegate(address[] memory _delegatees, uint256[] memory _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 cumulative - 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); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/token/userInterfaces/IWNat.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IWNat { /** * @notice Deposit native token and mint WNAT ERC20. */ function deposit() external payable; /** * @notice Withdraw native token and burn WNAT ERC20. * @param _amount The amount to withdraw. */ function withdraw(uint256 _amount) external; /** * @notice Deposit native token from msg.sender and mint WNAT ERC20. * @param _recipient An address to receive minted WNAT. */ function depositTo(address _recipient) external payable; /** * @notice Withdraw WNAT from an owner and send NAT to msg.sender given an allowance. * @param _owner An address spending the native tokens. * @param _amount The amount to spend. * * Requirements: * * - `_owner` must have a balance of at least `_amount`. * - the caller must have allowance for `_owners`'s tokens of at least * `_amount`. */ function withdrawFrom(address _owner, uint256 _amount) external; }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/tokenPools/userInterfaces/IGenericRewardManager.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; interface IGenericRewardManager { event RewardClaimed( address indexed beneficiary, address indexed sentTo, uint256 amount ); event RewardsDistributed( address[] addresses, uint256[] rewards ); event ClaimExecutorsChanged( address rewardOwner, address[] executors ); event AllowedClaimRecipientsChanged( address rewardOwner, address[] recipients ); event RewardManagerActivated(address rewardManager); event RewardManagerDeactivated(address rewardManager); /** * @notice Allows the sender to claim or wrap rewards for reward owner. * @notice The caller does not have to be the owner, but must be approved by the owner to claim on his behalf. * this approval is done by calling `setClaimExecutors`. * @notice It is actually safe for this to be called by anybody (nothing can be stolen), but by limiting who can * call, we allow the owner to control the timing of the calls. * @notice Reward owner can claim to any `_recipient`, while the executor can only claim to the reward owner or * one of the addresses set by `setAllowedClaimRecipients`. * @param _rewardOwner address of the reward owner * @param _recipient address to transfer funds to * @param _rewardAmount amount of rewards to claim * @param _wrap should reward be wrapped immediately */ function claim(address _rewardOwner, address payable _recipient, uint256 _rewardAmount, bool _wrap) external; /** * Set the addresses of executors, who are allowed to call `claim`. * @param _executors The new executors. All old executors will be deleted and replaced by these. */ function setClaimExecutors(address[] memory _executors) external; /** * Set the addresses of allowed recipients in the methods `claim`. * Apart from these, the reward owner is always an allowed recipient. * @param _recipients The new allowed recipients. All old recipients will be deleted and replaced by these. */ function setAllowedClaimRecipients(address[] memory _recipients) external; /** * @notice Allows reward claiming */ function active() external view returns (bool); /** * @notice Returns information of beneficiary rewards * @param _beneficiary beneficiary address * @return _totalReward number representing the total reward * @return _claimedReward number representing the amount of total reward that has been claimed */ function getStateOfRewards( address _beneficiary ) external view returns ( uint256 _totalReward, uint256 _claimedReward ); /** * Get the addresses of executors, who are allowed to call `claim`. */ function claimExecutors(address _rewardOwner) external view returns (address[] memory); /** * Get the addresses of allowed recipients in the methods `claim`. * Apart from these, the reward owner is always an allowed recipient. */ function allowedClaimRecipients(address _rewardOwner) external view returns (address[] memory); }
@flarenetwork/flare-periphery-contracts/coston2/util-contracts/userInterfaces/IFlareContractRegistry.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.9; pragma abicoder v2; interface IFlareContractRegistry { /** * @notice Returns contract address for the given name - might be address(0) * @param _name name of the contract */ function getContractAddressByName(string calldata _name) external view returns(address); /** * @notice Returns contract address for the given name hash - might be address(0) * @param _nameHash hash of the contract name (keccak256(abi.encode(name)) */ function getContractAddressByHash(bytes32 _nameHash) external view returns(address); /** * @notice Returns contract addresses for the given names - might be address(0) * @param _names names of the contracts */ function getContractAddressesByName(string[] calldata _names) external view returns(address[] memory); /** * @notice Returns contract addresses for the given name hashes - might be address(0) * @param _nameHashes hashes of the contract names (keccak256(abi.encode(name)) */ function getContractAddressesByHash(bytes32[] calldata _nameHashes) external view returns(address[] memory); /** * @notice Returns all contract names and corresponding addresses */ function getAllContracts() external view returns(string[] memory _names, address[] memory _addresses); }
@openzeppelin/contracts/token/ERC20/ERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool); }
@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"london"}
Contract ABI
[{"type":"constructor","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"addedAt","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateTokenAmount","inputs":[{"type":"uint256","name":"flrAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"decreaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"subtractedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"increaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"addedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"mint","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"some","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","indexed":true},{"type":"address","name":"spender","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","indexed":true},{"type":"address","name":"to","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false}]
Contract Creation Code
0x60c06040526004608090815263736f6d6560e01b60a05260079062000025908262000154565b503480156200003357600080fd5b50604051806040016040528060048152602001636e616d6560e01b815250604051806040016040528060068152602001651cde5b589bdb60d21b815250816003908162000081919062000154565b50600462000090828262000154565b5050600580546001600160a01b03191633179055504260065562000220565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620000da57607f821691505b602082108103620000fb57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200014f57600081815260208120601f850160051c810160208610156200012a5750805b601f850160051c820191505b818110156200014b5782815560010162000136565b5050505b505050565b81516001600160401b03811115620001705762000170620000af565b6200018881620001818454620000c5565b8462000101565b602080601f831160018114620001c05760008415620001a75750858301515b600019600386901b1c1916600185901b1785556200014b565b600085815260208120601f198616915b82811015620001f157888601518255948401946001909101908401620001d0565b5085821015620002105787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610e2c80620002306000396000f3fe6080604052600436106100f35760003560e01c80638da5cb5b1161008a578063a9059cbb11610059578063a9059cbb1461029d578063c03ee3d3146102bd578063c8978eb1146102d2578063dd62ed3e146102e857600080fd5b80638da5cb5b1461021057806395d89b4114610248578063a24bcf461461025d578063a457c2d71461027d57600080fd5b806323b872dd116100c657806323b872dd1461017e578063313ce5671461019e57806339509351146101ba57806370a08231146101da57600080fd5b806306fdde03146100f8578063095ea7b3146101235780631249c58b1461015357806318160ddd14610169575b600080fd5b34801561010457600080fd5b5061010d610308565b60405161011a9190610ad6565b60405180910390f35b34801561012f57600080fd5b5061014361013e366004610b3c565b61039a565b604051901515815260200161011a565b61015b6103b4565b60405190815260200161011a565b34801561017557600080fd5b5060025461015b565b34801561018a57600080fd5b50610143610199366004610b68565b6103d1565b3480156101aa57600080fd5b506040516012815260200161011a565b3480156101c657600080fd5b506101436101d5366004610b3c565b6103f5565b3480156101e657600080fd5b5061015b6101f5366004610ba9565b6001600160a01b031660009081526020819052604090205490565b34801561021c57600080fd5b50600554610230906001600160a01b031681565b6040516001600160a01b03909116815260200161011a565b34801561025457600080fd5b5061010d610417565b34801561026957600080fd5b5061015b610278366004610bcd565b610426565b34801561028957600080fd5b50610143610298366004610b3c565b6104f6565b3480156102a957600080fd5b506101436102b8366004610b3c565b610576565b3480156102c957600080fd5b5061010d610584565b3480156102de57600080fd5b5061015b60065481565b3480156102f457600080fd5b5061015b610303366004610be6565b610612565b60606003805461031790610c1f565b80601f016020809104026020016040519081016040528092919081815260200182805461034390610c1f565b80156103905780601f1061036557610100808354040283529160200191610390565b820191906000526020600020905b81548152906001019060200180831161037357829003601f168201915b5050505050905090565b6000336103a881858561063d565b60019150505b92915050565b6000806103c034610426565b90506103cc3382610761565b919050565b6000336103df858285610820565b6103ea85858561089a565b506001949350505050565b6000336103a88185856104088383610612565b6104129190610c6f565b61063d565b60606004805461031790610c1f565b6000600a81610433610a3e565b60405163534d7ee360e11b8152602060048201526005602482015264219923262960d91b604482015290915060009081906001600160a01b0384169063a69afdc690606401606060405180830381865afa158015610495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b99190610c82565b9250509150600081600a6104cd9190610d94565b6104d79086610da0565b6104e18489610da0565b6104eb9190610db7565b979650505050505050565b600033816105048286610612565b9050838110156105695760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6103ea828686840361063d565b6000336103a881858561089a565b6007805461059190610c1f565b80601f01602080910402602001604051908101604052809291908181526020018280546105bd90610c1f565b801561060a5780601f106105df5761010080835404028352916020019161060a565b820191906000526020600020905b8154815290600101906020018083116105ed57829003601f168201915b505050505081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b03831661069f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610560565b6001600160a01b0382166107005760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610560565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0382166107b75760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610560565b80600260008282546107c99190610c6f565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600061082c8484610612565b9050600019811461089457818110156108875760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610560565b610894848484840361063d565b50505050565b6001600160a01b0383166108fe5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610560565b6001600160a01b0382166109605760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610560565b6001600160a01b038316600090815260208190526040902054818110156109d85760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610560565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610894565b60405163413b07e560e11b815260206004820152600c60248201526b4674736f526567697374727960a01b604482015260009073ad67fe66660fb8dfe9d6b1b4240d8650e30f6019906382760fca90606401602060405180830381865afa158015610aad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad19190610dd9565b905090565b600060208083528351808285015260005b81811015610b0357858101830151858201604001528201610ae7565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610b3957600080fd5b50565b60008060408385031215610b4f57600080fd5b8235610b5a81610b24565b946020939093013593505050565b600080600060608486031215610b7d57600080fd5b8335610b8881610b24565b92506020840135610b9881610b24565b929592945050506040919091013590565b600060208284031215610bbb57600080fd5b8135610bc681610b24565b9392505050565b600060208284031215610bdf57600080fd5b5035919050565b60008060408385031215610bf957600080fd5b8235610c0481610b24565b91506020830135610c1481610b24565b809150509250929050565b600181811c90821680610c3357607f821691505b602082108103610c5357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156103ae576103ae610c59565b600080600060608486031215610c9757600080fd5b8351925060208401519150604084015190509250925092565b600181815b80851115610ceb578160001904821115610cd157610cd1610c59565b80851615610cde57918102915b93841c9390800290610cb5565b509250929050565b600082610d02575060016103ae565b81610d0f575060006103ae565b8160018114610d255760028114610d2f57610d4b565b60019150506103ae565b60ff841115610d4057610d40610c59565b50506001821b6103ae565b5060208310610133831016604e8410600b8410161715610d6e575081810a6103ae565b610d788383610cb0565b8060001904821115610d8c57610d8c610c59565b029392505050565b6000610bc68383610cf3565b80820281158282048414176103ae576103ae610c59565b600082610dd457634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610deb57600080fd5b8151610bc681610b2456fea26469706673582212202290759b5eb8b84a878e3459c56d860dcb3652d947f6ecdd96bcd00b48f9807164736f6c63430008140033
Deployed ByteCode
0x6080604052600436106100f35760003560e01c80638da5cb5b1161008a578063a9059cbb11610059578063a9059cbb1461029d578063c03ee3d3146102bd578063c8978eb1146102d2578063dd62ed3e146102e857600080fd5b80638da5cb5b1461021057806395d89b4114610248578063a24bcf461461025d578063a457c2d71461027d57600080fd5b806323b872dd116100c657806323b872dd1461017e578063313ce5671461019e57806339509351146101ba57806370a08231146101da57600080fd5b806306fdde03146100f8578063095ea7b3146101235780631249c58b1461015357806318160ddd14610169575b600080fd5b34801561010457600080fd5b5061010d610308565b60405161011a9190610ad6565b60405180910390f35b34801561012f57600080fd5b5061014361013e366004610b3c565b61039a565b604051901515815260200161011a565b61015b6103b4565b60405190815260200161011a565b34801561017557600080fd5b5060025461015b565b34801561018a57600080fd5b50610143610199366004610b68565b6103d1565b3480156101aa57600080fd5b506040516012815260200161011a565b3480156101c657600080fd5b506101436101d5366004610b3c565b6103f5565b3480156101e657600080fd5b5061015b6101f5366004610ba9565b6001600160a01b031660009081526020819052604090205490565b34801561021c57600080fd5b50600554610230906001600160a01b031681565b6040516001600160a01b03909116815260200161011a565b34801561025457600080fd5b5061010d610417565b34801561026957600080fd5b5061015b610278366004610bcd565b610426565b34801561028957600080fd5b50610143610298366004610b3c565b6104f6565b3480156102a957600080fd5b506101436102b8366004610b3c565b610576565b3480156102c957600080fd5b5061010d610584565b3480156102de57600080fd5b5061015b60065481565b3480156102f457600080fd5b5061015b610303366004610be6565b610612565b60606003805461031790610c1f565b80601f016020809104026020016040519081016040528092919081815260200182805461034390610c1f565b80156103905780601f1061036557610100808354040283529160200191610390565b820191906000526020600020905b81548152906001019060200180831161037357829003601f168201915b5050505050905090565b6000336103a881858561063d565b60019150505b92915050565b6000806103c034610426565b90506103cc3382610761565b919050565b6000336103df858285610820565b6103ea85858561089a565b506001949350505050565b6000336103a88185856104088383610612565b6104129190610c6f565b61063d565b60606004805461031790610c1f565b6000600a81610433610a3e565b60405163534d7ee360e11b8152602060048201526005602482015264219923262960d91b604482015290915060009081906001600160a01b0384169063a69afdc690606401606060405180830381865afa158015610495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b99190610c82565b9250509150600081600a6104cd9190610d94565b6104d79086610da0565b6104e18489610da0565b6104eb9190610db7565b979650505050505050565b600033816105048286610612565b9050838110156105695760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6103ea828686840361063d565b6000336103a881858561089a565b6007805461059190610c1f565b80601f01602080910402602001604051908101604052809291908181526020018280546105bd90610c1f565b801561060a5780601f106105df5761010080835404028352916020019161060a565b820191906000526020600020905b8154815290600101906020018083116105ed57829003601f168201915b505050505081565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b03831661069f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610560565b6001600160a01b0382166107005760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610560565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0382166107b75760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610560565b80600260008282546107c99190610c6f565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600061082c8484610612565b9050600019811461089457818110156108875760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610560565b610894848484840361063d565b50505050565b6001600160a01b0383166108fe5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610560565b6001600160a01b0382166109605760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610560565b6001600160a01b038316600090815260208190526040902054818110156109d85760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610560565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610894565b60405163413b07e560e11b815260206004820152600c60248201526b4674736f526567697374727960a01b604482015260009073ad67fe66660fb8dfe9d6b1b4240d8650e30f6019906382760fca90606401602060405180830381865afa158015610aad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad19190610dd9565b905090565b600060208083528351808285015260005b81811015610b0357858101830151858201604001528201610ae7565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610b3957600080fd5b50565b60008060408385031215610b4f57600080fd5b8235610b5a81610b24565b946020939093013593505050565b600080600060608486031215610b7d57600080fd5b8335610b8881610b24565b92506020840135610b9881610b24565b929592945050506040919091013590565b600060208284031215610bbb57600080fd5b8135610bc681610b24565b9392505050565b600060208284031215610bdf57600080fd5b5035919050565b60008060408385031215610bf957600080fd5b8235610c0481610b24565b91506020830135610c1481610b24565b809150509250929050565b600181811c90821680610c3357607f821691505b602082108103610c5357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156103ae576103ae610c59565b600080600060608486031215610c9757600080fd5b8351925060208401519150604084015190509250925092565b600181815b80851115610ceb578160001904821115610cd157610cd1610c59565b80851615610cde57918102915b93841c9390800290610cb5565b509250929050565b600082610d02575060016103ae565b81610d0f575060006103ae565b8160018114610d255760028114610d2f57610d4b565b60019150506103ae565b60ff841115610d4057610d40610c59565b50506001821b6103ae565b5060208310610133831016604e8410600b8410161715610d6e575081810a6103ae565b610d788383610cb0565b8060001904821115610d8c57610d8c610c59565b029392505050565b6000610bc68383610cf3565b80820281158282048414176103ae576103ae610c59565b600082610dd457634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610deb57600080fd5b8151610bc681610b2456fea26469706673582212202290759b5eb8b84a878e3459c56d860dcb3652d947f6ecdd96bcd00b48f9807164736f6c63430008140033