From 8bdcc06c299a837976e2f9e01899fb2c9c85d7d8 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Wed, 20 Sep 2023 16:34:20 +0200 Subject: [PATCH] Add API reference guide (#81) Sync API ref docs with smart contracts commit 71509c4c --- docs/apis/index.md | 17 +- docs/apis/smart-contracts/AddressUpdatable.md | 109 + docs/apis/smart-contracts/AddressUpdater.md | 489 ++++ docs/apis/smart-contracts/CheckPointable.md | 215 ++ .../apis/smart-contracts/ClaimSetupManager.md | 1531 +++++++++++++ .../CleanupBlockNumberManager.md | 651 ++++++ docs/apis/smart-contracts/CloneFactory.md | 30 + docs/apis/smart-contracts/Delegatable.md | 401 ++++ .../smart-contracts/FlareContractRegistry.md | 233 ++ docs/apis/smart-contracts/FlareDaemon.md | 1257 +++++++++++ docs/apis/smart-contracts/Ftso.md | 1335 +++++++++++ docs/apis/smart-contracts/FtsoManager.md | 1973 +++++++++++++++++ docs/apis/smart-contracts/FtsoRegistry.md | 972 ++++++++ .../apis/smart-contracts/FtsoRewardManager.md | 1911 ++++++++++++++++ .../smart-contracts/GovernanceSettings.md | 362 +++ .../smart-contracts/GovernanceVotePower.md | 510 +++++ docs/apis/smart-contracts/Governed.md | 145 ++ .../GovernedAndFlareDaemonized.md | 308 +++ .../apis/smart-contracts/GovernedAtGenesis.md | 172 ++ docs/apis/smart-contracts/GovernedBase.md | 373 ++++ .../smart-contracts/IClaimSetupManager.md | 1000 +++++++++ .../smart-contracts/IFlareContractRegistry.md | 168 ++ docs/apis/smart-contracts/IFlareDaemonize.md | 101 + docs/apis/smart-contracts/IFtso.md | 624 ++++++ docs/apis/smart-contracts/IFtsoGenesis.md | 87 + docs/apis/smart-contracts/IFtsoManager.md | 593 +++++ .../smart-contracts/IFtsoManagerGenesis.md | 48 + docs/apis/smart-contracts/IFtsoRegistry.md | 541 +++++ .../smart-contracts/IFtsoRegistryGenesis.md | 54 + .../smart-contracts/IFtsoRewardManager.md | 968 ++++++++ .../smart-contracts/IGovernanceSettings.md | 134 ++ .../smart-contracts/IGovernanceVotePower.md | 191 ++ .../smart-contracts/IIAddressUpdatable.md | 54 + docs/apis/smart-contracts/IIAddressUpdater.md | 166 ++ .../smart-contracts/IIClaimSetupManager.md | 1192 ++++++++++ docs/apis/smart-contracts/IICleanable.md | 101 + docs/apis/smart-contracts/IIFtso.md | 981 ++++++++ docs/apis/smart-contracts/IIFtsoManager.md | 1387 ++++++++++++ docs/apis/smart-contracts/IIFtsoRegistry.md | 571 +++++ .../smart-contracts/IIFtsoRewardManager.md | 1417 ++++++++++++ .../smart-contracts/IIGovernanceVotePower.md | 398 ++++ .../smart-contracts/IIInflationReceiver.md | 139 ++ docs/apis/smart-contracts/IIPriceSubmitter.md | 339 +++ docs/apis/smart-contracts/IITokenPool.md | 52 + docs/apis/smart-contracts/IIVPContract.md | 734 ++++++ docs/apis/smart-contracts/IIVPToken.md | 1166 ++++++++++ .../smart-contracts/IIVoterWhitelister.md | 391 ++++ .../apis/smart-contracts/IInflationGenesis.md | 49 + docs/apis/smart-contracts/IPriceSubmitter.md | 310 +++ .../apis/smart-contracts/IVPContractEvents.md | 93 + docs/apis/smart-contracts/IVPToken.md | 950 ++++++++ .../apis/smart-contracts/IVoterWhitelister.md | 316 +++ docs/apis/smart-contracts/IWNat.md | 147 ++ docs/apis/smart-contracts/Inflation.md | 1216 ++++++++++ docs/apis/smart-contracts/PriceSubmitter.md | 766 +++++++ .../smart-contracts/RevertErrorTracking.md | 206 ++ docs/apis/smart-contracts/VPContract.md | 1098 +++++++++ docs/apis/smart-contracts/VPToken.md | 1837 +++++++++++++++ docs/apis/smart-contracts/VoterWhitelister.md | 975 ++++++++ docs/apis/smart-contracts/WNat.md | 1871 ++++++++++++++++ docs/apis/smart-contracts/index.md | 89 + docs/assets/stylesheets/extra.css | 29 + mkdocs.yml | 63 +- 63 files changed, 36597 insertions(+), 9 deletions(-) create mode 100644 docs/apis/smart-contracts/AddressUpdatable.md create mode 100644 docs/apis/smart-contracts/AddressUpdater.md create mode 100644 docs/apis/smart-contracts/CheckPointable.md create mode 100644 docs/apis/smart-contracts/ClaimSetupManager.md create mode 100644 docs/apis/smart-contracts/CleanupBlockNumberManager.md create mode 100644 docs/apis/smart-contracts/CloneFactory.md create mode 100644 docs/apis/smart-contracts/Delegatable.md create mode 100644 docs/apis/smart-contracts/FlareContractRegistry.md create mode 100644 docs/apis/smart-contracts/FlareDaemon.md create mode 100644 docs/apis/smart-contracts/Ftso.md create mode 100644 docs/apis/smart-contracts/FtsoManager.md create mode 100644 docs/apis/smart-contracts/FtsoRegistry.md create mode 100644 docs/apis/smart-contracts/FtsoRewardManager.md create mode 100644 docs/apis/smart-contracts/GovernanceSettings.md create mode 100644 docs/apis/smart-contracts/GovernanceVotePower.md create mode 100644 docs/apis/smart-contracts/Governed.md create mode 100644 docs/apis/smart-contracts/GovernedAndFlareDaemonized.md create mode 100644 docs/apis/smart-contracts/GovernedAtGenesis.md create mode 100644 docs/apis/smart-contracts/GovernedBase.md create mode 100644 docs/apis/smart-contracts/IClaimSetupManager.md create mode 100644 docs/apis/smart-contracts/IFlareContractRegistry.md create mode 100644 docs/apis/smart-contracts/IFlareDaemonize.md create mode 100644 docs/apis/smart-contracts/IFtso.md create mode 100644 docs/apis/smart-contracts/IFtsoGenesis.md create mode 100644 docs/apis/smart-contracts/IFtsoManager.md create mode 100644 docs/apis/smart-contracts/IFtsoManagerGenesis.md create mode 100644 docs/apis/smart-contracts/IFtsoRegistry.md create mode 100644 docs/apis/smart-contracts/IFtsoRegistryGenesis.md create mode 100644 docs/apis/smart-contracts/IFtsoRewardManager.md create mode 100644 docs/apis/smart-contracts/IGovernanceSettings.md create mode 100644 docs/apis/smart-contracts/IGovernanceVotePower.md create mode 100644 docs/apis/smart-contracts/IIAddressUpdatable.md create mode 100644 docs/apis/smart-contracts/IIAddressUpdater.md create mode 100644 docs/apis/smart-contracts/IIClaimSetupManager.md create mode 100644 docs/apis/smart-contracts/IICleanable.md create mode 100644 docs/apis/smart-contracts/IIFtso.md create mode 100644 docs/apis/smart-contracts/IIFtsoManager.md create mode 100644 docs/apis/smart-contracts/IIFtsoRegistry.md create mode 100644 docs/apis/smart-contracts/IIFtsoRewardManager.md create mode 100644 docs/apis/smart-contracts/IIGovernanceVotePower.md create mode 100644 docs/apis/smart-contracts/IIInflationReceiver.md create mode 100644 docs/apis/smart-contracts/IIPriceSubmitter.md create mode 100644 docs/apis/smart-contracts/IITokenPool.md create mode 100644 docs/apis/smart-contracts/IIVPContract.md create mode 100644 docs/apis/smart-contracts/IIVPToken.md create mode 100644 docs/apis/smart-contracts/IIVoterWhitelister.md create mode 100644 docs/apis/smart-contracts/IInflationGenesis.md create mode 100644 docs/apis/smart-contracts/IPriceSubmitter.md create mode 100644 docs/apis/smart-contracts/IVPContractEvents.md create mode 100644 docs/apis/smart-contracts/IVPToken.md create mode 100644 docs/apis/smart-contracts/IVoterWhitelister.md create mode 100644 docs/apis/smart-contracts/IWNat.md create mode 100644 docs/apis/smart-contracts/Inflation.md create mode 100644 docs/apis/smart-contracts/PriceSubmitter.md create mode 100644 docs/apis/smart-contracts/RevertErrorTracking.md create mode 100644 docs/apis/smart-contracts/VPContract.md create mode 100644 docs/apis/smart-contracts/VPToken.md create mode 100644 docs/apis/smart-contracts/VoterWhitelister.md create mode 100644 docs/apis/smart-contracts/WNat.md create mode 100644 docs/apis/smart-contracts/index.md diff --git a/docs/apis/index.md b/docs/apis/index.md index 3841b9ec1..cd67bba83 100644 --- a/docs/apis/index.md +++ b/docs/apis/index.md @@ -1,22 +1,23 @@ --- section_icon: api-icon.svg section_icon_type: filled-svg -hide: - - navigation --- # APIs Select one of the topics below: -## Access Nodes +## Flare API Documentation -* [Public RPC nodes](../dev/reference/network-config.md) for Flare, Songbird and Coston. -* [Public RPC nodes for connected chains](../dev/reference/network-config.md#connected-networks) -* [Flare API Portal](../tech/api-portal.md) (private nodes) +* [Smart Contracts API](./smart-contracts/index.md) (Work in progress) -## API Documentation +## External Documentation -* [Flare API](../dev/reference/index.md) * [web3.js API](https://docs.web3js.org/api) * [ethers.js API](https://docs.ethers.org) + +!!! info "Access Nodes" + + * [Public RPC nodes](../dev/reference/network-config.md) for Flare, Songbird and Coston. + * [Public RPC nodes for connected chains](../dev/reference/network-config.md#connected-networks) + * [Flare API Portal](../tech/api-portal.md) (private nodes) diff --git a/docs/apis/smart-contracts/AddressUpdatable.md b/docs/apis/smart-contracts/AddressUpdatable.md new file mode 100644 index 000000000..b000ecc48 --- /dev/null +++ b/docs/apis/smart-contracts/AddressUpdatable.md @@ -0,0 +1,109 @@ +--- +title: AddressUpdatable +--- + + + +# `AddressUpdatable` { #ct_addressupdatable } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol) | Inherits from [IIAddressUpdatable](./IIAddressUpdatable.md) +
+ +
+ +Abstract base class for contracts that depend on other contracts whose addresses can change. + +The [`AddressUpdater`](./AddressUpdater.md) contract keeps a list of addresses for all unique and special +platform contracts. By inheriting from [`AddressUpdatable`](./AddressUpdatable.md) a contract will receive updates +if any of the platform contract addresses change. + +A contract's address changes when it is redeployed, so [`AddressUpdatable`](./AddressUpdatable.md) offers a way +to keep up to date with the latest address for all dependencies. + +
+ +
+ +## Functions + +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +
+ +## Variables + +
+ diff --git a/docs/apis/smart-contracts/AddressUpdater.md b/docs/apis/smart-contracts/AddressUpdater.md new file mode 100644 index 000000000..08e3afa4b --- /dev/null +++ b/docs/apis/smart-contracts/AddressUpdater.md @@ -0,0 +1,489 @@ +--- +title: AddressUpdater +--- + + + +# `AddressUpdater` { #ct_addressupdater } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol) | Inherits from [IIAddressUpdater](./IIAddressUpdater.md), [Governed](./Governed.md) +
+ +
+ +Keeps track of the current address for all unique and special platform contracts. + +This contract keeps a list of addresses that gets updated by [`governance`](#fn_governance) every time +any of the tracked contracts is redeployed. +This list is then used by the [`FlareContractRegistry`](./FlareContractRegistry.md), and also by [`AddressUpdatable`](./AddressUpdatable.md) +to inform all dependent contracts of any address change. + +
+ +
+ +## Functions + +
+ +### `addOrUpdateContractNamesAndAddresses` { #fn_addorupdatecontractnamesandaddresses } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function addOrUpdateContractNamesAndAddresses( + string[] _contractNames, + address[] _contractAddresses +) external; +``` + +Add or [`update`](#fn_update) contract names and addresses that are later used in [`updateContractAddresses`](#fn_updatecontractaddresses) calls. + +Can only be called by [`governance`](#fn_governance). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_contractNames` | `string[]` | Contracts names. | +| `_contractAddresses` | `address[]` | Addresses of corresponding contracts names. | + +
+
+ +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `getContractAddress` { #fn_getcontractaddress } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function getContractAddress( + string _name +) external view returns ( + address); +``` + +Returns contract address for the given name, which might be address(0). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_name` | `string` | Name of the contract to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Current address for the queried contract. | +
+
+ +
+ +### `getContractAddressByHash` { #fn_getcontractaddressbyhash } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function getContractAddressByHash( + bytes32 _nameHash +) external view returns ( + address); +``` + +Returns contract address for the given name hash, which might be address(0). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nameHash` | `bytes32` | Hash of the contract name: `keccak256(abi.encode(name))` | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Current address for the queried contract. | +
+
+ +
+ +### `getContractAddresses` { #fn_getcontractaddresses } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function getContractAddresses( + string[] _names +) external view returns ( + address[]); +``` + +Returns contract addresses for the given names, which might be address(0). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_names` | `string[]` | Names of the contracts to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Current addresses for the queried contracts. | +
+
+ +
+ +### `getContractAddressesByHash` { #fn_getcontractaddressesbyhash } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function getContractAddressesByHash( + bytes32[] _nameHashes +) external view returns ( + address[]); +``` + +Returns contract addresses for the given name hashes, which might be address(0). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nameHashes` | `bytes32[]` | Hashes of the contract names: `keccak256(abi.encode(name))` | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Current addresses for the queried contracts. | +
+
+ +
+ +### `getContractNamesAndAddresses` { #fn_getcontractnamesandaddresses } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function getContractNamesAndAddresses( +) external view returns ( + string[] _contractNames, + address[] _contractAddresses); +``` + +Returns all contract names and corresponding addresses currently being tracked. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_contractNames` | `string[]` | Array of contract names. | +| `_contractAddresses` | `address[]` | Array of contract addresses. | +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `removeContracts` { #fn_removecontracts } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function removeContracts( + string[] _contractNames +) external; +``` + +Remove contracts with given names. + +Can only be called by [`governance`](#fn_governance). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_contractNames` | `string[]` | Contract names. | + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `update` { #fn_update } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function update( + string[] _contractNames, + address[] _contractAddresses, + contract IIAddressUpdatable[] _contractsToUpdate +) external; +``` + +Set or [`update`](#fn_update) contract names and addresses, and then apply changes to specific contracts. + +This is a combination of [`addOrUpdateContractNamesAndAddresses`](#fn_addorupdatecontractnamesandaddresses) and [`updateContractAddresses`](#fn_updatecontractaddresses). +Can only be called by [`governance`](#fn_governance). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_contractNames` | `string[]` | Contracts names. | +| `_contractAddresses` | `address[]` | Addresses of corresponding contracts names. | +| `_contractsToUpdate` | `contract IIAddressUpdatable[]` | Contracts to be updated. | + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdater` ([Docs](./AddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdater.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + contract IIAddressUpdatable[] _contractsToUpdate +) external; +``` + +Updates contract addresses on specific contracts. + +Can only be called by [`governance`](#fn_governance). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_contractsToUpdate` | `contract IIAddressUpdatable[]` | Contracts to be updated, which must implement the [`IIAddressUpdatable`](./IIAddressUpdatable.md) interface. | + +
+
+ +
+ +
+ +## Variables + +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/CheckPointable.md b/docs/apis/smart-contracts/CheckPointable.md new file mode 100644 index 000000000..d089c5d59 --- /dev/null +++ b/docs/apis/smart-contracts/CheckPointable.md @@ -0,0 +1,215 @@ +--- +title: CheckPointable +--- + + + +# `CheckPointable` { #ct_checkpointable } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol) +
+ +
+ +Check-Pointable ERC20 Behavior. + +ERC20 behavior that adds balance check-point features. + +
+ +
+ +## Events + +
+ +### `CreatedTotalSupplyCache` { #ev_createdtotalsupplycache } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +event CreatedTotalSupplyCache( + uint256 _blockNumber +) +``` + +Emitted when a total supply cache entry is created. +Allows history cleaners to track total supply cache cleanup opportunities off-chain. + +
+
+ +
+ +
+ +## Functions + +
+ +### `balanceHistoryCleanup` { #fn_balancehistorycleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function balanceHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete balance checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | balance owner account address | +| `_count` | `uint256` | maximum number of checkpoints to delete | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of checkpoints deleted | +
+
+ +
+ +### `totalSupplyCacheCleanup` { #fn_totalsupplycachecleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function totalSupplyCacheCleanup( + uint256 _blockNumber +) external returns ( + uint256); +``` + +Delete total supply cache entry that expired (i.e. is before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | the block number for which total supply value was cached | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of cache entries deleted (always 0 or 1) | +
+
+ +
+ +### `totalSupplyHistoryCleanup` { #fn_totalsupplyhistorycleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function totalSupplyHistoryCleanup( + uint256 _count +) external returns ( + uint256); +``` + +Delete total supply checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_count` | `uint256` | maximum number of checkpoints to delete | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of checkpoints deleted | +
+
+ +
+ +
+ +## Modifiers + +
+ +### `notBeforeCleanupBlock` { #md_notbeforecleanupblock } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +modifier notBeforeCleanupBlock( uint256 _blockNumber) +``` + +This method cannot be called for `_blockNumber` lower than the current cleanup block number. + +
+
+ +
+ +### `onlyCleaner` { #md_onlycleaner } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +modifier onlyCleaner() +``` + +Only the [`cleanerContract`](#va_cleanercontract) can call this method. + +
+
+ +
+ +
+ +## Variables + +
+ +### `cleanerContract` { #va_cleanercontract } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity + address cleanerContract +``` + +Address of the contract that is allowed to call methods for history cleaning. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/ClaimSetupManager.md b/docs/apis/smart-contracts/ClaimSetupManager.md new file mode 100644 index 000000000..6dd8415b3 --- /dev/null +++ b/docs/apis/smart-contracts/ClaimSetupManager.md @@ -0,0 +1,1531 @@ +--- +title: ClaimSetupManager +--- + + + +# `ClaimSetupManager` { #ct_claimsetupmanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol) | Inherits from [IIClaimSetupManager](./IIClaimSetupManager.md), [Governed](./Governed.md), [AddressUpdatable](./AddressUpdatable.md), [CloneFactory](./CloneFactory.md), ReentrancyGuard +
+ +
+ +Manages automation of operations related to reward claiming. + +Rewards include [FTSO rewards](https://docs.flare.network/tech/ftso) and +[airdrops](https://docs.flare.network/tech/the-flaredrop/). +Managed operations include [Automatic Claiming](https://docs.flare.network/tech/automatic-claiming) and +[Personal Delegation Accounts](https://docs.flare.network/tech/personal-delegation-account). + +
+ +
+ +## Functions + +
+ +### `accountToDelegationAccount` { #fn_accounttodelegationaccount } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function accountToDelegationAccount( + address _owner +) external view returns ( + address); +``` + +Gets the [PDA](https://docs.flare.network/tech/personal-delegation-account) of an account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of its PDA or `address(0)` if it has not been created yet. | +
+
+ +
+ +### `allowedClaimRecipients` { #fn_allowedclaimrecipients } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function allowedClaimRecipients( + address _owner +) external view returns ( + address[]); +``` + +Gets the addresses of recipients allowed to receive rewards on behalf of an account. +Beside these, the owner of the rewards is always authorized. +See [`setAllowedClaimRecipients`](#fn_setallowedclaimrecipients). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Addresses of all set authorized recipients. | +
+
+ +
+ +### `batchDelegate` { #fn_batchdelegate } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function batchDelegate( + address[] _delegatees, + uint256[] _bips +) external; +``` + +Undelegates all percentage delegations from the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account) and then [`delegate`](#fn_delegate) to a list of accounts. + +See [`delegate`](#fn_delegate). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegatees` | `address[]` | The addresses of the new recipients. | +| `_bips` | `uint256[]` | The percentage of voting power to be delegated to each delegatee, expressed in basis points (1/100 of one percent). Total of all `_bips` values must be lower than 10000. | + +
+
+ +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `checkExecutorAndAllowedRecipient` { #fn_checkexecutorandallowedrecipient } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function checkExecutorAndAllowedRecipient( + address _executor, + address _claimFor, + address _recipient +) external view; +``` + +Checks if an executor can claim on behalf of a given account and send funds to a given recipient address. + +Reverts if claiming is not possible, does nothing otherwise. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | +| `_claimFor` | `address` | | +| `_recipient` | `address` | The address where the reward would be sent. | + +
+
+ +
+ +### `claimExecutors` { #fn_claimexecutors } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function claimExecutors( + address _owner +) external view returns ( + address[]); +``` + +Gets the addresses of executors authorized to claim for an account. +See [`setClaimExecutors`](#fn_setclaimexecutors). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Addresses of all set executors. | +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + address _addressUpdater, + uint256 _feeValueUpdateOffset, + uint256 _minFeeValueWei, + uint256 _maxFeeValueWei, + uint256 _registerExecutorFeeValueWei +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function delegate( + address _to, + uint256 _bips +) external; +``` + +Delegates a percentage of the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account)'s voting power to another address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_bips` | `uint256` | 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. A value of 0 revokes delegation. | + +
+
+ +
+ +### `delegateGovernance` { #fn_delegategovernance } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function delegateGovernance( + address _to +) external; +``` + +Delegates all the [governance](https://docs.flare.network/tech/governance/) vote power of the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account) to another account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | Address of the recipient of the delegation. | + +
+
+ +
+ +### `disableDelegationAccount` { #fn_disabledelegationaccount } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function disableDelegationAccount( +) external; +``` + +Disables the +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +When using automatic claiming, all airdrops and FTSO rewards will be sent to the owner's account. +Rewards accrued by the PDA will no longer be automatically claimed. + +Reverts if there is no PDA. + +
+
+ +
+ +### `enableDelegationAccount` { #fn_enabledelegationaccount } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function enableDelegationAccount( +) external returns ( + contract IDelegationAccount); +``` + +Enables (or creates) a +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +When using automatic claiming, all airdrops and FTSO rewards will be sent to the PDA, and any rewards +accrued by the PDA will be claimed too. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IDelegationAccount` | Address of the delegation account contract. | +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getAutoClaimAddressesAndExecutorFee` { #fn_getautoclaimaddressesandexecutorfee } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function getAutoClaimAddressesAndExecutorFee( + address _executor, + address[] _owners +) external view returns ( + address[] _recipients, + uint256 _executorFeeValue); +``` + +Gets the [Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA) for +a list of accounts for which an executor is claiming. +Returns owner address instead if the PDA is not created yet or not enabled. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | Executor to query. | +| `_owners` | `address[]` | Array of reward owners which must have set `_executor` as their executor. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_recipients` | `address[]` | Addresses which will receive the claimed rewards. Can be the reward owners or their PDAs. | +| `_executorFeeValue` | `uint256` | Executor's fee value, in wei. | +
+
+ +
+ +### `getDelegationAccountData` { #fn_getdelegationaccountdata } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function getDelegationAccountData( + address _owner +) external view returns ( + contract IDelegationAccount _delegationAccount, + bool _enabled); +``` + +Gets [PDA](https://docs.flare.network/tech/personal-delegation-account) data for an account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegationAccount` | `contract IDelegationAccount` | Account's PDA address or `address(0)` if it has not been created yet. | +| `_enabled` | `bool` | Whether the PDA is enabled. | +
+
+ +
+ +### `getExecutorCurrentFeeValue` { #fn_getexecutorcurrentfeevalue } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorCurrentFeeValue( + address _executor +) public view returns ( + uint256); +``` + +Returns the current fee of a registered executor. +Reverts if the executor is not registered. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Fee in wei. | +
+
+ +
+ +### `getExecutorFeeValue` { #fn_getexecutorfeevalue } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorFeeValue( + address _executor, + uint256 _rewardEpoch +) external view returns ( + uint256); +``` + +Returns the fee of an executor at a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | +| `_rewardEpoch` | `uint256` | Reward Epoch ID to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Fee in wei at that reward epoch. | +
+
+ +
+ +### `getExecutorInfo` { #fn_getexecutorinfo } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorInfo( + address _executor +) external view returns ( + bool _registered, + uint256 _currentFeeValue); +``` + +Returns information about an executor. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_registered` | `bool` | Whether the executor is registered. | +| `_currentFeeValue` | `uint256` | Executor's current fee value, if registered. | +
+
+ +
+ +### `getExecutorScheduledFeeValueChanges` { #fn_getexecutorscheduledfeevaluechanges } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorScheduledFeeValueChanges( + address _executor +) external view returns ( + uint256[] _feeValue, + uint256[] _validFromEpoch, + bool[] _fixed); +``` + +Returns the currently scheduled fee changes of an executor. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | Executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feeValue` | `uint256[]` | Array of scheduled fees. | +| `_validFromEpoch` | `uint256[]` | Array of reward epochs ID where the scheduled fees will become effective. | +| `_fixed` | `bool[]` | Array of booleans indicating if an scheduled fee change is fixed or it might still be changed. | +
+
+ +
+ +### `getRegisteredExecutors` { #fn_getregisteredexecutors } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function getRegisteredExecutors( + uint256 _start, + uint256 _end +) external view returns ( + address[] _registeredExecutors, + uint256 _totalLength); +``` + +Returns the list of executors registered through [`registerExecutor`](#fn_registerexecutor). +Supports paging. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_start` | `uint256` | First executor to return. | +| `_end` | `uint256` | Last executor to return. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_registeredExecutors` | `address[]` | Addresses of the registered executors. | +| `_totalLength` | `uint256` | Total amount of executors. | +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `isClaimExecutor` { #fn_isclaimexecutor } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function isClaimExecutor( + address _owner, + address _executor +) external view returns ( + bool); +``` + +Returns whether an executor is authorized to claim on behalf of a reward owner. +See [`setClaimExecutors`](#fn_setclaimexecutors). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The reward owner to query. | +| `_executor` | `address` | The executor to query. | + +
+
+ +
+ +### `registerExecutor` { #fn_registerexecutor } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function registerExecutor( + uint256 _feeValue +) external payable returns ( + uint256); +``` + +Registers the caller as an executor and sets its initial fee value. + +If the executor was already registered, this method only updates the fee, which will take effect after +[`feeValueUpdateOffset`](#va_feevalueupdateoffset) reward epochs have elapsed. + +Executor must pay a fee in order to register. See [`registerExecutorFeeValueWei`](#va_registerexecutorfeevaluewei). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feeValue` | `uint256` | Desired fee, in wei. Must be between `minFeeValueWei` and `maxFeeValueWei`. 0 means no fee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID when the changes become effective. | +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _who, + uint256 _blockNumber +) external; +``` + +Revokes all delegation from the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account) +to a given account at a given block. + +Only affects the reads via `votePowerOfAtCached()` in the specified block. + +This method should be used only to prevent rogue [`delegate`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) with percentage of 0 or [`undelegateAll`](#fn_undelegateall). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The account to revoke. | +| `_blockNumber` | `uint256` | Block number where the revoking will take place. Must be in the past. | + +
+
+ +
+ +### `setAllowedClaimRecipients` { #fn_setallowedclaimrecipients } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function setAllowedClaimRecipients( + address[] _recipients +) external; +``` + +Set the addresses of allowed recipients. +The reward owner is always an allowed recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipients` | `address[]` | The new allowed recipients. All old recipients will be deleted and replaced by these. | + +
+
+ +
+ +### `setAutoClaiming` { #fn_setautoclaiming } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function setAutoClaiming( + address[] _executors, + bool _enableDelegationAccount +) external payable; +``` + +Sets the addresses of executors and optionally enables (creates) a +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +If any of the executors is a registered executor, some fee needs to be paid. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executors` | `address[]` | The new executors. All old executors will be deleted and replaced by these. | +| `_enableDelegationAccount` | `bool` | Whether the PDA should be enabled. | + +
+
+ +
+ +### `setClaimExecutors` { #fn_setclaimexecutors } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function setClaimExecutors( + address[] _executors +) external payable; +``` + +Sets the addresses of executors. + +If any of the executors is a registered executor, some fee needs to be paid. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executors` | `address[]` | The new executors. All old executors will be deleted and replaced by these. | + +
+
+ +
+ +### `setLibraryAddress` { #fn_setlibraryaddress } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function setLibraryAddress( + address _libraryAddress +) external; +``` + +Sets new library address. + +Only [`governance`](#fn_governance) can call this. + +
+
+ +
+ +### `setMaxFeeValueWei` { #fn_setmaxfeevaluewei } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function setMaxFeeValueWei( + uint256 _maxFeeValueWei +) external; +``` + +Sets maximum fee allowed for executors, in wei. + +Only [`governance`](#fn_governance) can call this. + +
+
+ +
+ +### `setMinFeeValueWei` { #fn_setminfeevaluewei } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function setMinFeeValueWei( + uint256 _minFeeValueWei +) external; +``` + +Sets minimum fee allowed for executors, in wei. + +Only [`governance`](#fn_governance) can call this. + +
+
+ +
+ +### `setRegisterExecutorFeeValueWei` { #fn_setregisterexecutorfeevaluewei } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function setRegisterExecutorFeeValueWei( + uint256 _registerExecutorFeeValueWei +) external; +``` + +Sets the fee required to register an executor, which must be higher than 0. + +Only [`governance`](#fn_governance) can call this. + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `transferExternalToken` { #fn_transferexternaltoken } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function transferExternalToken( + contract IERC20 _token, + uint256 _amount +) external; +``` + +Allows the caller to transfer ERC-20 tokens from their +[PDA](https://docs.flare.network/tech/personal-delegation-account) to the owner account. + +The main use case is to move ERC-20 tokes received by mistake (by an airdrop, for example) out of the PDA +and into the main account, where they can be more easily managed. + +Reverts if the target token is the [`WNat`](./WNat.md) contract: use method [`withdraw`](#fn_withdraw) for that. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_token` | `contract IERC20` | Target token contract address. | +| `_amount` | `uint256` | Amount of tokens to transfer. | + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function undelegateAll( +) external; +``` + +Removes all delegations from the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account). + +
+
+ +
+ +### `undelegateGovernance` { #fn_undelegategovernance } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function undelegateGovernance( +) external; +``` + +Undelegates all [governance](https://docs.flare.network/tech/governance/) vote power currently delegated by +the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account). + +
+
+ +
+ +### `unregisterExecutor` { #fn_unregisterexecutor } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function unregisterExecutor( +) external returns ( + uint256 _validFromEpoch); +``` + +Unregisters the caller as an executor. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_validFromEpoch` | `uint256` | Reward epoch ID when the change becomes effective. | +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +### `updateExecutorFeeValue` { #fn_updateexecutorfeevalue } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function updateExecutorFeeValue( + uint256 _feeValue +) external returns ( + uint256); +``` + +Sets the caller's executor fee. The caller must be an executor registered through [`registerExecutor`](#fn_registerexecutor). + +When called multiple times inside the same reward epoch, only the last value remains. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feeValue` | `uint256` | Desired fee, in wei. Must be between `minFeeValueWei` and `maxFeeValueWei`. 0 means no fee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID when the changes become effective. | +
+
+ +
+ +### `wNat` { #fn_wnat } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +function wNat( +) external view returns ( + contract WNat); +``` + +Returns the [`WNat`](./WNat.md) contract. + +
+
+ +
+ +### `withdraw` { #fn_withdraw } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +function withdraw( + uint256 _amount +) external; +``` + +Allows the caller to transfer [`WNat`](./WNat.md) wrapped tokens from their +[PDA](https://docs.flare.network/tech/personal-delegation-account) to the owner account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_amount` | `uint256` | Amount of tokens to transfer, in wei. | + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `nonReentrant` { #md_nonreentrant } + +
+Defined in `ReentrancyGuard` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/utils/ReentrancyGuard.sol)). +
+ +
+ +```solidity +modifier nonReentrant() +``` + +Prevents a contract from calling itself, directly or indirectly. +Calling a `nonReentrant` function from another `nonReentrant` +function is not supported. It is possible to prevent this from happening +by making the `nonReentrant` function external, and make it call a +`private` function that does the actual work. + +
+
+ +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +### `onlyOwnerOrExecutor` { #md_onlyownerorexecutor } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity +modifier onlyOwnerOrExecutor( address _executor, + address[] _owners) +``` + +
+
+ +
+ +
+ +## Structures + +
+ +### `DelegationAccountData` { #st_delegationaccountdata } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +
+```solidity +struct DelegationAccountData { + contract IIDelegationAccount delegationAccount; + bool enabled; +} +``` + +
+ +
+ +### `ExecutorFee` { #st_executorfee } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +
+```solidity +struct ExecutorFee { + uint256 value; + uint256 validFromEpoch; +} +``` + +
+ +
+ +### `TimelockedCall` { #st_timelockedcall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +
+```solidity +struct TimelockedCall { + uint256 allowedAfterTimestamp; + bytes encodedCall; +} +``` + +
+ +
+ +
+ +## Variables + +
+ +### `feeValueUpdateOffset` { #va_feevalueupdateoffset } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity + uint256 feeValueUpdateOffset +``` + +Number of reward epochs that must elapse before an executor's fee change takes effect. + +
+
+ +
+ +### `ftsoManager` { #va_ftsomanager } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity + contract IFtsoManager ftsoManager +``` + +The [`FtsoManager`](./FtsoManager.md) contract. + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `governanceVP` { #va_governancevp } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity + contract IGovernanceVotePower governanceVP +``` + +The [`GovernanceVotePower`](./GovernanceVotePower.md) contract. + +
+
+ +
+ +### `libraryAddress` { #va_libraryaddress } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity + address libraryAddress +``` + +
+
+ +
+ +### `maxFeeValueWei` { #va_maxfeevaluewei } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity + uint256 maxFeeValueWei +``` + +Maximum allowed value for an executor's fee. + +
+
+ +
+ +### `minFeeValueWei` { #va_minfeevaluewei } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity + uint256 minFeeValueWei +``` + +Minimum allowed value for an executor's fee. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `registerExecutorFeeValueWei` { #va_registerexecutorfeevaluewei } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity + uint256 registerExecutorFeeValueWei +``` + +Fee that must be paid to register an executor. + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ +### `wNat` { #va_wnat } + +
+Defined in `ClaimSetupManager` ([Docs](./ClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/ClaimSetupManager.sol)). +
+ +
+ +```solidity + contract WNat wNat +``` + +The [`WNat`](./WNat.md) contract. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/CleanupBlockNumberManager.md b/docs/apis/smart-contracts/CleanupBlockNumberManager.md new file mode 100644 index 000000000..5c5d9c532 --- /dev/null +++ b/docs/apis/smart-contracts/CleanupBlockNumberManager.md @@ -0,0 +1,651 @@ +--- +title: CleanupBlockNumberManager +--- + + + +# `CleanupBlockNumberManager` { #ct_cleanupblocknumbermanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol) | Inherits from [Governed](./Governed.md), [AddressUpdatable](./AddressUpdatable.md) +
+ +
+ +Token history cleanup manager. + +Maintains the list of cleanable tokens for which history cleanup can be collectively executed. + +
+ +
+ +## Events + +
+ +### `CleanupBlockNumberSet` { #ev_cleanupblocknumberset } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity +event CleanupBlockNumberSet( + contract IICleanable theContract, + uint256 blockNumber, + bool success +) +``` + +Emitted when an attempt has been made to set the cleanup block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `theContract` | `contract IICleanable` | The token contract address. | +| `blockNumber` | `uint256` | The block number being set. | +| `success` | `bool` | Whether it succeeded or not. | + +
+
+ +
+ +### `GovernanceCallTimelocked` { #ev_governancecalltimelocked } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceCallTimelocked( + bytes4 selector, + uint256 allowedAfterTimestamp, + bytes encodedCall +) +``` + +Emitted when a new [`governance`](#fn_governance) call has been recorded and is now waiting for the time lock to expire. + +
+
+ +
+ +### `GovernanceInitialised` { #ev_governanceinitialised } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceInitialised( + address initialGovernance +) +``` + +Emitted when the [`governance`](#fn_governance) address is initialized. +This address will be used until production mode is entered (see [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered)). +At that point the [`governance`](#fn_governance) address is taken from [`GovernanceSettings`](./GovernanceSettings.md). + +
+
+ +
+ +### `GovernedProductionModeEntered` { #ev_governedproductionmodeentered } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernedProductionModeEntered( + address governanceSettings +) +``` + +Emitted when [`governance`](#fn_governance) is enabled and the [`governance`](#fn_governance) address cannot be changed anymore +(only through a network fork). + +
+
+ +
+ +### `RegistrationUpdated` { #ev_registrationupdated } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity +event RegistrationUpdated( + contract IICleanable theContract, + bool add +) +``` + +Emitted when a new token has been registered to have its history managed by us, or +an old one unregistered. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `theContract` | `contract IICleanable` | The token contract address. | +| `add` | `bool` | **true** is the token has been registered, **false** if unregistered. | + +
+
+ +
+ +### `TimelockedGovernanceCallCanceled` { #ev_timelockedgovernancecallcanceled } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallCanceled( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is canceled before execution. + +
+
+ +
+ +### `TimelockedGovernanceCallExecuted` { #ev_timelockedgovernancecallexecuted } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallExecuted( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is executed. + +
+
+ +
+ +
+ +## Functions + +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + address _addressUpdater, + string _triggerContractName +) public; +``` + +Build a new instance. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Contract address that can make governance calls. See [`Governed`](./Governed.md). | +| `_addressUpdater` | `address` | Contract address that can update redeployable addresses. See `AdressUpdatable`. | +| `_triggerContractName` | `string` | Contract name that can trigger history cleanups. | + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `registerToken` { #fn_registertoken } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity +function registerToken( + contract IICleanable _cleanableToken +) external; +``` + +Register a token contract whose history cleanup index is to be managed. +The registered contracts must allow calling `setCleanupBlockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanableToken` | `contract IICleanable` | The address of the contract to be managed. | + +
+
+ +
+ +### `setCleanUpBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity +function setCleanUpBlockNumber( + uint256 _blockNumber +) external; +``` + +Sets clean up block number on managed cleanable tokens. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | cleanup block number | + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `unregisterToken` { #fn_unregistertoken } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity +function unregisterToken( + contract IICleanable _cleanableToken +) external; +``` + +Unregister a token contract from history cleanup index management. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanableToken` | `contract IICleanable` | The address of the contract to unregister. | + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +### `onlyTrigger` { #md_onlytrigger } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity +modifier onlyTrigger() +``` + +Only the trigger contract can call this method. +This contract is set at construction time and updated through [`AddressUpdatable`](./AddressUpdatable.md). + +
+
+ +
+ +
+ +## Variables + +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `registeredTokens` { #va_registeredtokens } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity + contract IICleanable[] registeredTokens +``` + +Current list of token contracts being managed. + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ +### `triggerContract` { #va_triggercontract } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity + address triggerContract +``` + +Address of the contract that can trigger a cleanup. + +
+
+ +
+ +### `triggerContractName` { #va_triggercontractname } + +
+Defined in `CleanupBlockNumberManager` ([Docs](./CleanupBlockNumberManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CleanupBlockNumberManager.sol)). +
+ +
+ +```solidity + string triggerContractName +``` + +Name of the contract that can trigger a cleanup. +Needed to update the trigger contract address through the [`AddressUpdater`](./AddressUpdater.md). + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/CloneFactory.md b/docs/apis/smart-contracts/CloneFactory.md new file mode 100644 index 000000000..675757083 --- /dev/null +++ b/docs/apis/smart-contracts/CloneFactory.md @@ -0,0 +1,30 @@ +--- +title: CloneFactory +--- + + + +# `CloneFactory` { #ct_clonefactory } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/implementation/CloneFactory.sol) +
+ +
+ +Simple clone contract factory. + +This code (intended to be called from an implementor factory contract) will allow you to install a master copy of a +contract, then easily (cheaply) create clones with separate state. +The deployed bytecode just delegates all calls to the master contract address. + +[Source attribution](https://github.com/optionality/clone-factory). + +
+ +
+ +## Functions + +
+ diff --git a/docs/apis/smart-contracts/Delegatable.md b/docs/apis/smart-contracts/Delegatable.md new file mode 100644 index 000000000..118e80bd9 --- /dev/null +++ b/docs/apis/smart-contracts/Delegatable.md @@ -0,0 +1,401 @@ +--- +title: Delegatable +--- + + + +# `Delegatable` { #ct_delegatable } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol) | Inherits from [IVPContractEvents](./IVPContractEvents.md) +
+ +
+ +[`Delegatable`](./Delegatable.md) ERC20 behavior. + +Adds delegation capabilities to tokens. This contract orchestrates interaction between +managing a delegation and the vote power allocations that result. + +
+ +
+ +## Enums + +
+ +### `DelegationMode` { #en_delegationmode } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +
+```solidity +enum DelegationMode { + NOTSET, + PERCENTAGE, + AMOUNT +} +``` + +Delegation mode of an account. Once set, it cannot be changed. + +* `NOTSET`: Delegation mode not set yet. +* `PERCENTAGE`: Delegation by percentage. +* `AMOUNT`: Delegation by amount (explicit). + +
+ +
+ +
+ +## Events + +
+ +### `CreatedVotePowerCache` { #ev_createdvotepowercache } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +event CreatedVotePowerCache( + address _owner, + uint256 _blockNumber +) +``` + +Emitted when a vote power cache entry is created. +Allows history cleaners to track vote power cache cleanup opportunities off-chain. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address whose vote power has just been cached. | +| `_blockNumber` | `uint256` | The block number at which the vote power has been cached. | + +
+
+ +
+ +### `Delegate` { #ev_delegate } + +
+Defined in `IVPContractEvents` ([Docs](./IVPContractEvents.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPContractEvents.sol)). +
+ +
+ +```solidity +event Delegate( + address from, + address to, + uint256 priorVotePower, + uint256 newVotePower +) +``` + +Emitted when the amount of vote power delegated from one account to another changes. + +**Note**: This event is always emitted from [`VPToken`](./VPToken.md)'s `writeVotePowerContract`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `from` | `address` | The account that has changed the amount of vote power it is delegating. | +| `to` | `address` | The account whose received vote power has changed. | +| `priorVotePower` | `uint256` | The vote power originally delegated. | +| `newVotePower` | `uint256` | The new vote power that triggered this event. It can be 0 if the delegation is completely canceled. | + +
+
+ +
+ +### `Revoke` { #ev_revoke } + +
+Defined in `IVPContractEvents` ([Docs](./IVPContractEvents.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPContractEvents.sol)). +
+ +
+ +```solidity +event Revoke( + address delegator, + address delegatee, + uint256 votePower, + uint256 blockNumber +) +``` + +Emitted when an account revokes its vote power delegation to another account +for a single current or past block (typically the current vote block). + +**Note**: This event is always emitted from [`VPToken`](./VPToken.md)'s `writeVotePowerContract` or `readVotePowerContract`. + +See `revokeDelegationAt` in [`IVPToken`](./IVPToken.md). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `delegator` | `address` | The account that revoked the delegation. | +| `delegatee` | `address` | The account that has been revoked. | +| `votePower` | `uint256` | The revoked vote power. | +| `blockNumber` | `uint256` | The block number at which the delegation has been revoked. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `explicitDelegationHistoryCleanup` { #fn_explicitdelegationhistorycleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function explicitDelegationHistoryCleanup( + address _from, + address _to, + uint256 _count +) external returns ( + uint256); +``` + +Delete explicit delegation checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Delegator address. | +| `_to` | `address` | Delegatee address. | +| `_count` | `uint256` | Maximum number of checkpoints to delete. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of checkpoints deleted. | +
+
+ +
+ +### `percentageDelegationHistoryCleanup` { #fn_percentagedelegationhistorycleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function percentageDelegationHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete percentage delegation checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Balance owner account address. | +| `_count` | `uint256` | Maximum number of checkpoints to delete. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of deleted checkpoints. | +
+
+ +
+ +### `revocationCleanup` { #fn_revocationcleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function revocationCleanup( + address _from, + address _to, + uint256 _blockNumber +) external returns ( + uint256); +``` + +Delete revocation entry that expired (i.e. is before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Delegator address. | +| `_to` | `address` | Delegatee address. | +| `_blockNumber` | `uint256` | Block number for which total supply value was cached. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of revocation entries deleted (always 0 or 1). | +
+
+ +
+ +### `votePowerCacheCleanup` { #fn_votepowercachecleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function votePowerCacheCleanup( + address _owner, + uint256 _blockNumber +) external returns ( + uint256); +``` + +Delete vote power cache entry that expired (i.e. is before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Vote power owner account address. | +| `_blockNumber` | `uint256` | Block number for which total supply value was cached. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of deleted cache entries (always 0 or 1). | +
+
+ +
+ +### `votePowerHistoryCleanup` { #fn_votepowerhistorycleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function votePowerHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete vote power checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Vote power owner account address. | +| `_count` | `uint256` | Maximum number of checkpoints to delete. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of deleted checkpoints. | +
+
+ +
+ +
+ +## Modifiers + +
+ +### `notBeforeCleanupBlock` { #md_notbeforecleanupblock } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +modifier notBeforeCleanupBlock( uint256 _blockNumber) +``` + +Reading from history is not allowed before `cleanupBlockNumber`, since data before that +might have been deleted and is thus unreliable. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number being checked for validity. | + +
+
+ +
+ +### `onlyCleaner` { #md_onlycleaner } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +modifier onlyCleaner() +``` + +History cleaning methods can be called only from [`cleanerContract`](#va_cleanercontract). + +
+
+ +
+ +
+ +## Variables + +
+ +### `cleanerContract` { #va_cleanercontract } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity + address cleanerContract +``` + +Address of the contract that is allowed to call methods for history cleaning. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/FlareContractRegistry.md b/docs/apis/smart-contracts/FlareContractRegistry.md new file mode 100644 index 000000000..7d5066002 --- /dev/null +++ b/docs/apis/smart-contracts/FlareContractRegistry.md @@ -0,0 +1,233 @@ +--- +title: FlareContractRegistry +--- + + + +# `FlareContractRegistry` { #ct_flarecontractregistry } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FlareContractRegistry.sol) | Inherits from [IFlareContractRegistry](./IFlareContractRegistry.md), [AddressUpdatable](./AddressUpdatable.md) +
+ +
+ +The Flare contract registry. + +Entry point for all external dapps that need the latest contract addresses deployed by Flare. + +
+ +
+ +## Functions + +
+ +### `constructor` { #fn_constructor } + +
+Defined in `FlareContractRegistry` ([Docs](./FlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FlareContractRegistry.sol)). +
+ +
+ +```solidity +constructor( + address _addressUpdater +) public; +``` + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getAllContracts` { #fn_getallcontracts } + +
+Defined in `FlareContractRegistry` ([Docs](./FlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FlareContractRegistry.sol)). +
+ +
+ +```solidity +function getAllContracts( +) external view returns ( + string[] _names, + address[] _addresses); +``` + +Returns all contract names and their corresponding addresses. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_names` | `string[]` | Array of contract names. | +| `_addresses` | `address[]` | Array of corresponding contract addresses. | +
+
+ +
+ +### `getContractAddressByHash` { #fn_getcontractaddressbyhash } + +
+Defined in `FlareContractRegistry` ([Docs](./FlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FlareContractRegistry.sol)). +
+ +
+ +```solidity +function getContractAddressByHash( + bytes32 _nameHash +) external view returns ( + address); +``` + +Returns the address of a given contract hash. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nameHash` | `bytes32` | Hash of the contract name as: `keccak256(abi.encode(name))`. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of the contract, or `address(0)` if not found. | +
+
+ +
+ +### `getContractAddressByName` { #fn_getcontractaddressbyname } + +
+Defined in `FlareContractRegistry` ([Docs](./FlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FlareContractRegistry.sol)). +
+ +
+ +```solidity +function getContractAddressByName( + string _name +) external view returns ( + address); +``` + +Returns the address of a given contract name. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_name` | `string` | Name of the contract. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of the contract, or `address(0)` if not found. | +
+
+ +
+ +### `getContractAddressesByHash` { #fn_getcontractaddressesbyhash } + +
+Defined in `FlareContractRegistry` ([Docs](./FlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FlareContractRegistry.sol)). +
+ +
+ +```solidity +function getContractAddressesByHash( + bytes32[] _nameHashes +) external view returns ( + address[]); +``` + +Returns the addresses of a list of contract hashes. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nameHashes` | `bytes32[]` | Array of contract name hashes as: `keccak256(abi.encode(name))`. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the contracts. Any of them might be `address(0)` if not found. | +
+
+ +
+ +### `getContractAddressesByName` { #fn_getcontractaddressesbyname } + +
+Defined in `FlareContractRegistry` ([Docs](./FlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FlareContractRegistry.sol)). +
+ +
+ +```solidity +function getContractAddressesByName( + string[] _names +) external view returns ( + address[]); +``` + +Returns the addresses of a list of contract names. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_names` | `string[]` | Array of contract names. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the contracts. Any of them might be `address(0)` if not found. | +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/FlareDaemon.md b/docs/apis/smart-contracts/FlareDaemon.md new file mode 100644 index 000000000..32b1e991a --- /dev/null +++ b/docs/apis/smart-contracts/FlareDaemon.md @@ -0,0 +1,1257 @@ +--- +title: FlareDaemon +--- + + + +# `FlareDaemon` { #ct_flaredaemon } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol) | Inherits from [GovernedAtGenesis](./GovernedAtGenesis.md), [AddressUpdatable](./AddressUpdatable.md) +
+ +
+ +Flare Daemon contract. + +This contract exists to coordinate regular daemon-like polling of contracts +that are registered to receive said polling. The [`trigger`](#fn_trigger) method is called by the +validator right at the end of block state transition. + +
+ +
+ +## Events + +
+ +### `ContractDaemonizeErrored` { #ev_contractdaemonizeerrored } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event ContractDaemonizeErrored( + address theContract, + uint256 atBlock, + string theMessage, + uint256 gasConsumed +) +``` + +
+
+ +
+ +### `ContractDaemonized` { #ev_contractdaemonized } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event ContractDaemonized( + address theContract, + uint256 gasConsumed +) +``` + +
+
+ +
+ +### `ContractHeldOff` { #ev_contractheldoff } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event ContractHeldOff( + address theContract, + uint256 blockHoldoffsRemaining +) +``` + +
+
+ +
+ +### `ContractsSkippedOutOfGas` { #ev_contractsskippedoutofgas } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event ContractsSkippedOutOfGas( + uint256 numberOfSkippedConstracts +) +``` + +
+
+ +
+ +### `GovernanceCallTimelocked` { #ev_governancecalltimelocked } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceCallTimelocked( + bytes4 selector, + uint256 allowedAfterTimestamp, + bytes encodedCall +) +``` + +Emitted when a new [`governance`](#fn_governance) call has been recorded and is now waiting for the time lock to expire. + +
+
+ +
+ +### `GovernanceInitialised` { #ev_governanceinitialised } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceInitialised( + address initialGovernance +) +``` + +Emitted when the [`governance`](#fn_governance) address is initialized. +This address will be used until production mode is entered (see [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered)). +At that point the [`governance`](#fn_governance) address is taken from [`GovernanceSettings`](./GovernanceSettings.md). + +
+
+ +
+ +### `GovernedProductionModeEntered` { #ev_governedproductionmodeentered } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernedProductionModeEntered( + address governanceSettings +) +``` + +Emitted when [`governance`](#fn_governance) is enabled and the [`governance`](#fn_governance) address cannot be changed anymore +(only through a network fork). + +
+
+ +
+ +### `InflationSet` { #ev_inflationset } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event InflationSet( + contract IInflationGenesis theNewContract, + contract IInflationGenesis theOldContract +) +``` + +
+
+ +
+ +### `MintingReceived` { #ev_mintingreceived } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event MintingReceived( + uint256 amountWei +) +``` + +
+
+ +
+ +### `MintingRequestReceived` { #ev_mintingrequestreceived } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event MintingRequestReceived( + uint256 amountWei +) +``` + +
+
+ +
+ +### `MintingRequestTriggered` { #ev_mintingrequesttriggered } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event MintingRequestTriggered( + uint256 amountWei +) +``` + +
+
+ +
+ +### `MintingWithdrawn` { #ev_mintingwithdrawn } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event MintingWithdrawn( + uint256 amountWei +) +``` + +
+
+ +
+ +### `RegistrationUpdated` { #ev_registrationupdated } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event RegistrationUpdated( + contract IFlareDaemonize theContract, + bool add +) +``` + +
+
+ +
+ +### `SelfDestructReceived` { #ev_selfdestructreceived } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +event SelfDestructReceived( + uint256 amountWei +) +``` + +
+
+ +
+ +### `TimelockedGovernanceCallCanceled` { #ev_timelockedgovernancecallcanceled } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallCanceled( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is canceled before execution. + +
+
+ +
+ +### `TimelockedGovernanceCallExecuted` { #ev_timelockedgovernancecallexecuted } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallExecuted( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is executed. + +
+
+ +
+ +
+ +## Functions + +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +constructor( +) public; +``` + +This [`constructor`](#fn_constructor) should contain no code as this contract is pre-loaded into the genesis block. + The super [`constructor`](#fn_constructor) is called for testing convenience. + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getDaemonizedContractsData` { #fn_getdaemonizedcontractsdata } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function getDaemonizedContractsData( +) external view returns ( + contract IFlareDaemonize[] _daemonizeContracts, + uint256[] _gasLimits, + uint256[] _blockHoldoffsRemaining); +``` + +
+
+ +
+ +### `getNextMintRequestAllowedTs` { #fn_getnextmintrequestallowedts } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function getNextMintRequestAllowedTs( +) external view returns ( + uint256); +``` + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `initialise` { #fn_initialise } + +
+Defined in `GovernedAtGenesis` ([Docs](./GovernedAtGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedAtGenesis.sol)). +
+ +
+ +```solidity +function initialise( + address _governance +) public pure; +``` + +Disallow [`initialise`](#fn_initialise) to be called. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | The governance address for initial claiming. | + +
+
+ +
+ +### `initialiseFixedAddress` { #fn_initialisefixedaddress } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function initialiseFixedAddress( +) public returns ( + address); +``` + +Set the [`governance`](#fn_governance) address to a hard-coded known address. + +This should be done at contract deployment time. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | The governance address. | +
+
+ +
+ +### `registerToDaemonize` { #fn_registertodaemonize } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function registerToDaemonize( + struct FlareDaemon.Registration[] _registrations +) external; +``` + +Register contracts to be polled by the daemon process. + +A gas limit of zero will set no limit for the contract but the validator has an overall + limit for the [`trigger`](#fn_trigger) method. +If any registrations already exist, they will be unregistered. +Contracts will be daemonized in the order in which presented via the _registrations array. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_registrations` | `struct FlareDaemon.Registration[]` | An array of Registration structures of [`IFlareDaemonize`](./IFlareDaemonize.md) contracts to daemonize and gas limits for each contract. | + +
+
+ +
+ +### `requestMinting` { #fn_requestminting } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function requestMinting( + uint256 _amountWei +) external; +``` + +Queue up a minting request to send to the validator at next [`trigger`](#fn_trigger). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_amountWei` | `uint256` | The amount to mint. | + +
+
+ +
+ +### `setAddressUpdater` { #fn_setaddressupdater } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function setAddressUpdater( + address _addressUpdater +) external; +``` + +Sets the address udpater contract. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_addressUpdater` | `address` | The address updater contract. | + +
+
+ +
+ +### `setBlockHoldoff` { #fn_setblockholdoff } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function setBlockHoldoff( + uint256 _blockHoldoff +) external; +``` + +Set number of blocks that must elapse before a daemonized contract exceeding gas limit can have + its daemonize() method called again. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockHoldoff` | `uint256` | The number of blocks to holdoff. | + +
+
+ +
+ +### `setMaxMintingRequest` { #fn_setmaxmintingrequest } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function setMaxMintingRequest( + uint256 _maxMintingRequestWei +) external; +``` + +Set limit on how much can be minted per request. +this number can't be udated too often + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_maxMintingRequestWei` | `uint256` | The request maximum in wei. | + +
+
+ +
+ +### `showDaemonizedErrors` { #fn_showdaemonizederrors } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function showDaemonizedErrors( + uint256 startIndex, + uint256 numErrorTypesToShow +) public view returns ( + uint256[] _lastErrorBlock, + uint256[] _numErrors, + string[] _errorString, + address[] _erroringContract, + uint256 _totalDaemonizedErrors); +``` + +
+
+ +
+ +### `showLastDaemonizedError` { #fn_showlastdaemonizederror } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +function showLastDaemonizedError( +) external view returns ( + uint256[] _lastErrorBlock, + uint256[] _numErrors, + string[] _errorString, + address[] _erroringContract, + uint256 _totalDaemonizedErrors); +``` + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `inflationSet` { #md_inflationset } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +modifier inflationSet() +``` + +As there is not a [`constructor`](#fn_constructor), this modifier exists to make sure the [`inflation`](#va_inflation) + contract is set for methods that require it. + +
+
+ +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +### `onlyInflation` { #md_onlyinflation } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +modifier onlyInflation( address _inflation) +``` + +Access control to protect methods to allow only minters to call select methods + (like transferring balance out). + +
+
+ +
+ +### `onlySystemTrigger` { #md_onlysystemtrigger } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity +modifier onlySystemTrigger() +``` + +Access control to protect [`trigger`](#fn_trigger) method. +Please note that the sender address is the same as deployed [`FlareDaemon`](./FlareDaemon.md) address in this case. + +
+
+ +
+ +
+ +## Structures + +
+ +### `DaemonizedError` { #st_daemonizederror } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +
+```solidity +struct DaemonizedError { + uint192 lastErrorBlock; + uint64 numErrors; + address fromContract; + uint64 errorTypeIndex; + string errorMessage; +} +``` + +
+ +
+ +### `LastErrorData` { #st_lasterrordata } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +
+```solidity +struct LastErrorData { + uint192 totalDaemonizedErrors; + uint64 lastErrorTypeIndex; +} +``` + +
+ +
+ +### `Registration` { #st_registration } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +
+```solidity +struct Registration { + contract IFlareDaemonize daemonizedContract; + uint256 gasLimit; +} +``` + +
+ +
+ +### `TimelockedCall` { #st_timelockedcall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +
+```solidity +struct TimelockedCall { + uint256 allowedAfterTimestamp; + bytes encodedCall; +} +``` + +
+ +
+ +
+ +## Variables + +
+ +### `blockHoldoff` { #va_blockholdoff } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 blockHoldoff +``` + +
+
+ +
+ +### `errorData` { #va_errordata } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + struct FlareDaemon.LastErrorData errorData +``` + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `inflation` { #va_inflation } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + contract IInflationGenesis inflation +``` + +
+
+ +
+ +### `lastMintRequestTs` { #va_lastmintrequestts } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 lastMintRequestTs +``` + +
+
+ +
+ +### `lastUpdateMaxMintRequestTs` { #va_lastupdatemaxmintrequestts } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 lastUpdateMaxMintRequestTs +``` + +
+
+ +
+ +### `maxMintingRequestWei` { #va_maxmintingrequestwei } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 maxMintingRequestWei +``` + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `systemLastTriggeredAt` { #va_systemlasttriggeredat } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 systemLastTriggeredAt +``` + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ +### `totalMintingReceivedWei` { #va_totalmintingreceivedwei } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 totalMintingReceivedWei +``` + +
+
+ +
+ +### `totalMintingRequestedWei` { #va_totalmintingrequestedwei } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 totalMintingRequestedWei +``` + +
+
+ +
+ +### `totalMintingWithdrawnWei` { #va_totalmintingwithdrawnwei } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 totalMintingWithdrawnWei +``` + +
+
+ +
+ +### `totalSelfDestructReceivedWei` { #va_totalselfdestructreceivedwei } + +
+Defined in `FlareDaemon` ([Docs](./FlareDaemon.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/FlareDaemon.sol)). +
+ +
+ +```solidity + uint256 totalSelfDestructReceivedWei +``` + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/Ftso.md b/docs/apis/smart-contracts/Ftso.md new file mode 100644 index 000000000..3ffacd39e --- /dev/null +++ b/docs/apis/smart-contracts/Ftso.md @@ -0,0 +1,1335 @@ +--- +title: Ftso +--- + + + +# `Ftso` { #ct_ftso } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol) | Inherits from [IIFtso](./IIFtso.md) +
+ +
+ +[Flare Time Series Oracle](https://docs.flare.network/tech/ftso) contract. + +An instance of this contract is created for each tracked asset, and typically +accessed through the [`FtsoRegistry`](./FtsoRegistry.md). +Data providers do not access the [`Ftso`](./Ftso.md) instances directly either, and use the +[`PriceSubmitter`](./PriceSubmitter.md) contract instead. + +
+ +
+ +## Functions + +
+ +### `activateFtso` { #fn_activateftso } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function activateFtso( + uint256 _firstEpochStartTs, + uint256 _submitPeriodSeconds, + uint256 _revealPeriodSeconds +) external; +``` + +Initializes FTSO immutable settings and activates the contract. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_firstEpochStartTs` | `uint256` | Timestamp of the first epoch in seconds from UNIX epoch. | +| `_submitPeriodSeconds` | `uint256` | Duration of epoch submission window in seconds. | +| `_revealPeriodSeconds` | `uint256` | Duration of epoch reveal window in seconds. | + +
+
+ +
+ +### `active` { #fn_active } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Returns whether FTSO is [`active`](#fn_active) or not. + +
+
+ +
+ +### `configureEpochs` { #fn_configureepochs } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function configureEpochs( + uint256 _maxVotePowerNatThresholdFraction, + uint256 _maxVotePowerAssetThresholdFraction, + uint256 _lowAssetUSDThreshold, + uint256 _highAssetUSDThreshold, + uint256 _highAssetTurnoutThresholdBIPS, + uint256 _lowNatTurnoutThresholdBIPS, + uint256 _elasticBandRewardBIPS, + uint256 _elasticBandWidthPPM, + address[] _trustedAddresses +) external; +``` + +Sets configurable settings related to epochs. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). +Should never revert if called from [`ftsoManager`](#va_ftsomanager). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_maxVotePowerNatThresholdFraction` | `uint256` | High threshold for native token vote power per voter. | +| `_maxVotePowerAssetThresholdFraction` | `uint256` | High threshold for asset vote power per voter. | +| `_lowAssetUSDThreshold` | `uint256` | Threshold for low asset vote power (in scaled USD). | +| `_highAssetUSDThreshold` | `uint256` | Threshold for high asset vote power (in scaled USD). | +| `_highAssetTurnoutThresholdBIPS` | `uint256` | Threshold for high asset turnout (in BIPS). | +| `_lowNatTurnoutThresholdBIPS` | `uint256` | Threshold for low nat turnout (in BIPS). | +| `_elasticBandRewardBIPS` | `uint256` | Percentage of the rewards (in BIPS) that go to the [secondary reward band](https://docs.flare.network/tech/ftso/#rewards). The rest go to the primary reward band. | +| `_elasticBandWidthPPM` | `uint256` | Width of the secondary reward band, in parts-per-milion of the median. | +| `_trustedAddresses` | `address[]` | Trusted voters that will be used if low voter turnout is detected. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +constructor( + string _symbol, + uint256 _decimals, + contract IPriceSubmitter _priceSubmitter, + contract IIVPToken _wNat, + address _ftsoManager, + uint256 _firstEpochStartTs, + uint256 _submitPeriodSeconds, + uint256 _revealPeriodSeconds, + uint128 _initialPriceUSD, + uint256 _priceDeviationThresholdBIPS, + uint256 _cyclicBufferSize +) public; +``` + +
+
+ +
+ +### `deactivateFtso` { #fn_deactivateftso } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function deactivateFtso( +) external; +``` + +Deactivates the contract. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +
+
+ +
+ +### `epochsConfiguration` { #fn_epochsconfiguration } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function epochsConfiguration( +) external view returns ( + uint256 _maxVotePowerNatThresholdFraction, + uint256 _maxVotePowerAssetThresholdFraction, + uint256 _lowAssetUSDThreshold, + uint256 _highAssetUSDThreshold, + uint256 _highAssetTurnoutThresholdBIPS, + uint256 _lowNatTurnoutThresholdBIPS, + uint256 _elasticBandRewardBIPS, + uint256 _elasticBandWidthPPM, + address[] _trustedAddresses); +``` + +Returns current configuration of epoch state. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_maxVotePowerNatThresholdFraction` | `uint256` | High threshold for native token vote power per voter. | +| `_maxVotePowerAssetThresholdFraction` | `uint256` | High threshold for asset vote power per voter. | +| `_lowAssetUSDThreshold` | `uint256` | Threshold for low asset vote power (in scaled USD). | +| `_highAssetUSDThreshold` | `uint256` | Threshold for high asset vote power (in scaled USD). | +| `_highAssetTurnoutThresholdBIPS` | `uint256` | Threshold for high asset turnout (in BIPS). | +| `_lowNatTurnoutThresholdBIPS` | `uint256` | Threshold for low nat turnout (in BIPS). | +| `_elasticBandRewardBIPS` | `uint256` | Percentage of the rewards (in BIPS) that go to the [secondary reward band](https://docs.flare.network/tech/ftso/#rewards). The rest go to the primary reward band. | +| `_elasticBandWidthPPM` | `uint256` | Width of the secondary reward band, in parts-per-milion of the median. | +| `_trustedAddresses` | `address[]` | Trusted voters that will be used if low voter turnout is detected. | +
+
+ +
+ +### `fallbackFinalizePriceEpoch` { #fn_fallbackfinalizepriceepoch } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function fallbackFinalizePriceEpoch( + uint256 _epochId +) external; +``` + +Forces finalization of a price epoch, calculating the median price from trusted addresses only. + +Used as a fallback method, for example, due to an unexpected error during normal epoch finalization or +because the [`ftsoManager`](#va_ftsomanager) enabled the fallback mode. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to finalize. | + +
+
+ +
+ +### `finalizePriceEpoch` { #fn_finalizepriceepoch } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function finalizePriceEpoch( + uint256 _epochId, + bool _returnRewardData +) external returns ( + address[] _eligibleAddresses, + uint256[] _natWeights, + uint256 _natWeightsSum); +``` + +Computes epoch price based on gathered votes. + +* If the price reveal window for the epoch has ended, finalize the epoch. +* Iterate list of price submissions. +* Find weighted median. +* Find adjacent 50% of price submissions. +* Allocate rewards for price submissions. + +Can only be called by the [`ftsoManager`](#va_ftsomanager), and only at the correct time. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to finalize. | +| `_returnRewardData` | `bool` | Parameter that determines if the reward data is returned. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_eligibleAddresses` | `address[]` | List of addresses eligible for reward. | +| `_natWeights` | `uint256[]` | List of native token weights corresponding to the eligible addresses. | +| `_natWeightsSum` | `uint256` | | +
+
+ +
+ +### `forceFinalizePriceEpoch` { #fn_forcefinalizepriceepoch } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function forceFinalizePriceEpoch( + uint256 _epochId +) external; +``` + +Forces finalization of a price epoch by copying the price from the previous epoch. + +Used as a fallback method if [`fallbackFinalizePriceEpoch`](#fn_fallbackfinalizepriceepoch) fails due to an exception. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to finalize. | + +
+
+ +
+ +### `ftsoManager` { #fn_ftsomanager } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function ftsoManager( +) external view returns ( + address); +``` + +Returns the FTSO manager's address. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of the FTSO manager contract. | +
+
+ +
+ +### `getAsset` { #fn_getasset } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getAsset( +) external view returns ( + contract IIVPToken); +``` + +Returns the FTSO asset. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IIVPToken` | Address of the [`IIVPToken`](./IIVPToken.md) tracked by this FTSO. `null` in case of multi-asset FTSO. | +
+
+ +
+ +### `getAssetFtsos` { #fn_getassetftsos } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getAssetFtsos( +) external view returns ( + contract IIFtso[]); +``` + +Returns the asset FTSOs. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IIFtso[]` | Array of [`IIFtso`](./IIFtso.md) contract addresses. `null` in case of single-asset FTSO. | +
+
+ +
+ +### `getCurrentEpochId` { #fn_getcurrentepochid } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getCurrentEpochId( +) public view returns ( + uint256); +``` + +Returns the current epoch ID. + +It never reverts. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Currently running epoch ID. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getCurrentPrice` { #fn_getcurrentprice } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getCurrentPrice( +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Returns the current asset price. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceDetails` { #fn_getcurrentpricedetails } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getCurrentPriceDetails( +) external view returns ( + uint256 _price, + uint256 _priceTimestamp, + enum IFtso.PriceFinalizationType _priceFinalizationType, + uint256 _lastPriceEpochFinalizationTimestamp, + enum IFtso.PriceFinalizationType _lastPriceEpochFinalizationType); +``` + +Returns asset's current price details. +All timestamps are in seconds from UNIX epoch. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_priceTimestamp` | `uint256` | Time when price was updated for the last time. | +| `_priceFinalizationType` | `enum IFtso.PriceFinalizationType` | Finalization type when price was updated for the last time. | +| `_lastPriceEpochFinalizationTimestamp` | `uint256` | Time when last price epoch was finalized. | +| `_lastPriceEpochFinalizationType` | `enum IFtso.PriceFinalizationType` | Finalization type of last finalized price epoch. | +
+
+ +
+ +### `getCurrentPriceFromTrustedProviders` { #fn_getcurrentpricefromtrustedproviders } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getCurrentPriceFromTrustedProviders( +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Returns current asset price calculated only using input from trusted providers. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceWithDecimals` { #fn_getcurrentpricewithdecimals } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimals( +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Returns current asset price and number of decimals. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`_assetPriceUsdDecimals`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the USD price. | +
+
+ +
+ +### `getCurrentPriceWithDecimalsFromTrustedProviders` { #fn_getcurrentpricewithdecimalsfromtrustedproviders } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimalsFromTrustedProviders( +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Returns current asset price calculated only using input from trusted providers and number of decimals. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the USD price. | +
+
+ +
+ +### `getCurrentRandom` { #fn_getcurrentrandom } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getCurrentRandom( +) external view returns ( + uint256); +``` + +Returns the random number for the previous price epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +It never reverts. + +
+
+ +
+ +### `getEpochId` { #fn_getepochid } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getEpochId( + uint256 _timestamp +) external view returns ( + uint256); +``` + +Returns the ID of the epoch that was opened for price submission at the specified timestamp. + +It never reverts. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_timestamp` | `uint256` | Queried timestamp in seconds from UNIX epoch. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Epoch ID corresponding to that timestamp. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getEpochPrice` { #fn_getepochprice } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getEpochPrice( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns agreed asset price in the specified epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch. Only the last 200 epochs can be queried. Out-of-bounds queries revert. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +
+
+ +
+ +### `getEpochPriceForVoter` { #fn_getepochpriceforvoter } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getEpochPriceForVoter( + uint256 _epochId, + address _voter +) external view returns ( + uint256); +``` + +Returns asset price submitted by a voter in the specified epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch being queried. Only the last 200 epochs can be queried. Out-of-bounds queries revert. | +| `_voter` | `address` | Address of the voter being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +
+
+ +
+ +### `getPriceEpochConfiguration` { #fn_getpriceepochconfiguration } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getPriceEpochConfiguration( +) external view returns ( + uint256 _firstEpochStartTs, + uint256 _submitPeriodSeconds, + uint256 _revealPeriodSeconds); +``` + +Returns current epoch's configuration. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstEpochStartTs` | `uint256` | First epoch start timestamp in seconds from UNIX epoch. | +| `_submitPeriodSeconds` | `uint256` | Submit period in seconds. | +| `_revealPeriodSeconds` | `uint256` | Reveal period in seconds. | +
+
+ +
+ +### `getPriceEpochData` { #fn_getpriceepochdata } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getPriceEpochData( +) external view returns ( + uint256 _epochId, + uint256 _epochSubmitEndTime, + uint256 _epochRevealEndTime, + uint256 _votePowerBlock, + bool _fallbackMode); +``` + +Returns current epoch data. +Intervals are open on the right: End times are not included. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_epochId` | `uint256` | Current epoch ID. | +| `_epochSubmitEndTime` | `uint256` | End time of the price submission window in seconds from UNIX epoch. | +| `_epochRevealEndTime` | `uint256` | End time of the price reveal window in seconds from UNIX epoch. | +| `_votePowerBlock` | `uint256` | Vote power block for the current epoch. | +| `_fallbackMode` | `bool` | Whether the current epoch is in fallback mode. Only votes from trusted addresses are used in this mode. | +
+
+ +
+ +### `getRandom` { #fn_getrandom } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function getRandom( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns the random number used in a specific past epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the queried epoch. Current epoch cannot be queried, and the previous epoch is constantly updated as data providers reveal their prices and random numbers. Only the last 50 epochs can be queried and there is no bounds checking for this parameter. Out-of-bounds queries return undefined values. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The random number used in that epoch. | +
+
+ +
+ +### `getVoteWeightingParameters` { #fn_getvoteweightingparameters } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function getVoteWeightingParameters( +) external view returns ( + contract IIVPToken[] _assets, + uint256[] _assetMultipliers, + uint256 _totalVotePowerNat, + uint256 _totalVotePowerAsset, + uint256 _assetWeightRatio, + uint256 _votePowerBlock); +``` + +Returns parameters necessary for replicating vote weighting (used in [`VoterWhitelister`](./VoterWhitelister.md)). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_assets` | `contract IIVPToken[]` | The list of assets that are accounted in vote. | +| `_assetMultipliers` | `uint256[]` | Weight multiplier of each asset in (multiasset) FTSO. | +| `_totalVotePowerNat` | `uint256` | Total native token vote power at block. | +| `_totalVotePowerAsset` | `uint256` | Total combined asset vote power at block. | +| `_assetWeightRatio` | `uint256` | Ratio of combined asset vote power vs. native token vp (in BIPS). | +| `_votePowerBlock` | `uint256` | Vote power block for the epoch. | +
+
+ +
+ +### `initializeCurrentEpochStateForReveal` { #fn_initializecurrentepochstateforreveal } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function initializeCurrentEpochStateForReveal( + uint256 _circulatingSupplyNat, + bool _fallbackMode +) external; +``` + +Initializes current epoch instance for reveal. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_circulatingSupplyNat` | `uint256` | Epoch native token circulating supply. | +| `_fallbackMode` | `bool` | Whether the current epoch is in fallback mode. | + +
+
+ +
+ +### `revealPriceSubmitter` { #fn_revealpricesubmitter } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function revealPriceSubmitter( + address _voter, + uint256 _epochId, + uint256 _price, + uint256 _voterWNatVP +) external; +``` + +Reveals the price submitted by a voter on a specific epoch. +The hash of _price and _random must be equal to the submitted hash + +Emits a [`PriceRevealed`](#ev_pricerevealed) event. +Can only be called by the [`priceSubmitter`](#va_pricesubmitter). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Voter address. | +| `_epochId` | `uint256` | ID of the epoch in which the price hash was submitted. | +| `_price` | `uint256` | Submitted price. | +| `_voterWNatVP` | `uint256` | Voter's vote power in [`WNat`](./WNat.md) units. | + +
+
+ +
+ +### `setAsset` { #fn_setasset } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function setAsset( + contract IIVPToken _asset +) external; +``` + +Sets asset for FTSO to operate as single-asset oracle. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_asset` | `contract IIVPToken` | Address of the [`IIVPToken`](./IIVPToken.md) contract that will be the asset tracked by this FTSO. | + +
+
+ +
+ +### `setAssetFtsos` { #fn_setassetftsos } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function setAssetFtsos( + contract IIFtso[] _assetFtsos +) external; +``` + +Sets an array of FTSOs for FTSO to operate as multi-asset oracle. +FTSOs implicitly determine the FTSO [`assets`](#va_assets). + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetFtsos` | `contract IIFtso[]` | Array of FTSOs. | + +
+
+ +
+ +### `setVotePowerBlock` { #fn_setvotepowerblock } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function setVotePowerBlock( + uint256 _votePowerBlock +) external; +``` + +Sets the current vote power block. +Current vote power block will update per reward epoch. +The FTSO doesn't have notion of reward epochs. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_votePowerBlock` | `uint256` | | + +
+
+ +
+ +### `symbol` { #fn_symbol } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function symbol( +) external view returns ( + string); +``` + +Returns the FTSO [`symbol`](#fn_symbol). + +
+
+ +
+ +### `updateInitialPrice` { #fn_updateinitialprice } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function updateInitialPrice( + uint256 _initialPriceUSD, + uint256 _initialPriceTimestamp +) external; +``` + +Updates initial asset price when the contract is not [`active`](#va_active) yet. + +Can only be called by the [`ftsoManager`](#va_ftsomanager). + +
+
+ +
+ +### `wNat` { #fn_wnat } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function wNat( +) external view returns ( + contract IIVPToken); +``` + +Address of the [`WNat`](./WNat.md) contract. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IIVPToken` | Address of the [`WNat`](./WNat.md) contract. | +
+
+ +
+ +### `wNatVotePowerCached` { #fn_wnatvotepowercached } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +function wNatVotePowerCached( + address _owner, + uint256 _epochId +) public returns ( + uint256); +``` + +Get and cache the vote power of a voter on a specific epoch, in [`WNat`](./WNat.md) units. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | | +| `_epochId` | `uint256` | ID of the epoch in which the price hash was submitted. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Voter's vote power in [`WNat`](./WNat.md) units. | +
+
+ +
+ +
+ +## Modifiers + +
+ +### `onlyFtsoManager` { #md_onlyftsomanager } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +modifier onlyFtsoManager() +``` + +Only the [`ftsoManager`](#va_ftsomanager) can call this method. + +
+
+ +
+ +### `onlyPriceSubmitter` { #md_onlypricesubmitter } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +modifier onlyPriceSubmitter() +``` + +Only the [`priceSubmitter`](#va_pricesubmitter) can call this method. + +
+
+ +
+ +### `whenActive` { #md_whenactive } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity +modifier whenActive() +``` + +This method can only be called when the FTSO is [`active`](#va_active). + +
+
+ +
+ +
+ +## Structures + +
+ +### `RewardData` { #st_rewarddata } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +
+```solidity +struct RewardData { + uint256[] weightIQR; + uint256[] weightElasticBand; + uint256 weightsIQRSum; + uint256 weightsElasticBandSum; + uint256 numberOfVotes; + uint256 elasticBandRewardBIPS; +} +``` + +
+ +
+ +
+ +## Variables + +
+ +### `ASSET_PRICE_USD_DECIMALS` { #va_asset_price_usd_decimals } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + uint256 ASSET_PRICE_USD_DECIMALS +``` + +Number of decimal places in an asset's USD price. +Actual USD price is the integer value divided by 10^[`ASSET_PRICE_USD_DECIMALS`](#va_asset_price_usd_decimals) + +
+
+ +
+ +### `active` { #va_active } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + bool active +``` + +Activation status of this FTSO. + +
+
+ +
+ +### `assetFtsos` { #va_assetftsos } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + contract IIFtso[] assetFtsos +``` + +Array of addresses of other [`Ftso`](./Ftso.md) contracts tracked by this multi-asset FTSO. + +
+
+ +
+ +### `assets` { #va_assets } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + contract IIVPToken[] assets +``` + +Array of addresses of the tracked [`assets`](#va_assets). + +
+
+ +
+ +### `ftsoManager` { #va_ftsomanager } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + address ftsoManager +``` + +Address of the [`FtsoManager`](./FtsoManager.md) contract. + +
+
+ +
+ +### `priceDeviationThresholdBIPS` { #va_pricedeviationthresholdbips } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + uint256 priceDeviationThresholdBIPS +``` + +Threshold for price deviation between consecutive epochs. + +
+
+ +
+ +### `priceEpochCyclicBufferSize` { #va_priceepochcyclicbuffersize } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + uint256 priceEpochCyclicBufferSize +``` + +Amount of stored prices for past epochs, set at construction time. + +
+
+ +
+ +### `priceSubmitter` { #va_pricesubmitter } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + contract IPriceSubmitter priceSubmitter +``` + +Address of the [`PriceSubmitter`](./PriceSubmitter.md) contract. + +
+
+ +
+ +### `symbol` { #va_symbol } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + string symbol +``` + +Asset [`symbol`](#va_symbol) that identifies this FTSO. + +
+
+ +
+ +### `wNat` { #va_wnat } + +
+Defined in `Ftso` ([Docs](./Ftso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/Ftso.sol)). +
+ +
+ +```solidity + contract IIVPToken wNat +``` + +Address of the wrapped native token ([`WNat`](./WNat.md)) contract. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/FtsoManager.md b/docs/apis/smart-contracts/FtsoManager.md new file mode 100644 index 000000000..996f46ec2 --- /dev/null +++ b/docs/apis/smart-contracts/FtsoManager.md @@ -0,0 +1,1973 @@ +--- +title: FtsoManager +--- + + + +# `FtsoManager` { #ct_ftsomanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol) | Inherits from [IIFtsoManager](./IIFtsoManager.md), [GovernedAndFlareDaemonized](./GovernedAndFlareDaemonized.md), [AddressUpdatable](./AddressUpdatable.md), [RevertErrorTracking](./RevertErrorTracking.md) +
+ +
+ +FTSO Manager contract. + +It is in charge of: + +- Defining reward epochs (few days). +- Choosing a single block each reward epoch that represents vote power of this epoch. +- Keeping track of all FTSO contracts. +- Every price epoch (few minutes): + - Randomly choose one FTSO for rewarding calculations. + - Trigger finalize price reveal epoch. + - Determine addresses and reward weights and triggers reward distribution. + +
+ +
+ +## Functions + +
+ +### `activate` { #fn_activate } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function activate( +) external; +``` + +Activates FTSO manager ([`daemonize`](#fn_daemonize) will run jobs). + +Only [`governance`](#fn_governance) can call this method. + +
+
+ +
+ +### `active` { #fn_active } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Returns whether the FTSO Manager is [`active`](#fn_active) or not. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Active status. | +
+
+ +
+ +### `addFtso` { #fn_addftso } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function addFtso( + contract IIFtso _ftso +) external; +``` + +Adds FTSO to the list of managed FTSOs, to support a new price pair. +All FTSOs in a multi-asset FTSO must be managed by the same FTSO manager. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | FTSO contract address to add. | + +
+
+ +
+ +### `addFtsosBulk` { #fn_addftsosbulk } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function addFtsosBulk( + contract IIFtso[] _ftsos +) external; +``` + +Adds a list of FTSOs to the list of managed FTSOs, to support new price pairs. +All FTSOs in a multi-asset FTSO must be managed by the same FTSO manager. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of FTSO contract addresses to add. | + +
+
+ +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + contract FlareDaemon _flareDaemon, + address _addressUpdater, + contract IIFtsoManagerV1 _oldFtsoManager, + uint256 _firstPriceEpochStartTs, + uint256 _priceEpochDurationSeconds, + uint256 _revealEpochDurationSeconds, + uint256 _firstRewardEpochStartTs, + uint256 _rewardEpochDurationSeconds, + uint256 _votePowerIntervalFraction +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `GovernedAndFlareDaemonized` ([Docs](./GovernedAndFlareDaemonized.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + contract FlareDaemon _flareDaemon +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `currentRewardEpochEnds` { #fn_currentrewardepochends } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function currentRewardEpochEnds( +) external view returns ( + uint256); +``` + +Returns when the current reward epoch finishes. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Time in seconds since the UNIX epoch when the current reward epoch will finish. | +
+
+ +
+ +### `daemonize` { #fn_daemonize } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function daemonize( +) external returns ( + bool); +``` + +Implement this function to receive a trigger from the [`FlareDaemon`](./FlareDaemon.md). +The trigger method is called by the validator right at the end of block state transition. + +Only [`flareDaemon`](#va_flaredaemon) can call this method. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Whether the contract is still active after the call. Currently unused. | +
+
+ +
+ +### `deactivateFtsos` { #fn_deactivateftsos } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function deactivateFtsos( + contract IIFtso[] _ftsos +) external; +``` + +Deactivates FTSOs that are no longer used on FTSO registry. +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of FTSO contract addresses to deactivate. | + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `ftsoRegistry` { #fn_ftsoregistry } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function ftsoRegistry( +) external view returns ( + contract IIFtsoRegistry); +``` + +Returns the [`FtsoRegistry`](./FtsoRegistry.md) contract address. + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getContractName` { #fn_getcontractname } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getContractName( +) external pure returns ( + string); +``` + +Implement this function to allow updating daemonized contracts through the [`AddressUpdater`](./AddressUpdater.md). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `string` | string Contract name. | +
+
+ +
+ +### `getCurrentPriceEpochData` { #fn_getcurrentpriceepochdata } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getCurrentPriceEpochData( +) external view returns ( + uint256 _priceEpochId, + uint256 _priceEpochStartTimestamp, + uint256 _priceEpochEndTimestamp, + uint256 _priceEpochRevealEndTimestamp, + uint256 _currentTimestamp); +``` + +Returns timing information for the current price epoch. +All intervals are half-closed: end time is not included. +All timestamps are in seconds since UNIX epoch. + +See the [FTSO page](https://docs.flare.network/tech/ftso/#data-submission-process) +for information about the different submission phases. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_priceEpochId` | `uint256` | Price epoch ID. | +| `_priceEpochStartTimestamp` | `uint256` | Beginning of the commit phase. | +| `_priceEpochEndTimestamp` | `uint256` | End of the commit phase. | +| `_priceEpochRevealEndTimestamp` | `uint256` | End of the reveal phase. | +| `_currentTimestamp` | `uint256` | Current time. | +
+
+ +
+ +### `getCurrentPriceEpochId` { #fn_getcurrentpriceepochid } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getCurrentPriceEpochId( +) external view returns ( + uint256 _priceEpochId); +``` + +Returns current price epoch ID. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_priceEpochId` | `uint256` | Currently running epoch ID. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getCurrentRewardEpoch` { #fn_getcurrentrewardepoch } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getCurrentRewardEpoch( +) external view returns ( + uint256); +``` + +Returns current reward epoch ID (the one currently running). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID. A monotonically increasing integer. | +
+
+ +
+ +### `getElasticBandWidthPPMFtso` { #fn_getelasticbandwidthppmftso } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getElasticBandWidthPPMFtso( + contract IIFtso _ftso +) external view returns ( + uint256); +``` + +Returns the secondary band's width in PPM (parts-per-million) of the median value, +for a given FTSO. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | The queried FTSO contract address. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Secondary band width in PPM. To obtain the actual band width, divide this number by 10^6 and multiply by the price median value. | +
+
+ +
+ +### `getFallbackMode` { #fn_getfallbackmode } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getFallbackMode( +) external view returns ( + bool _fallbackMode, + contract IIFtso[] _ftsos, + bool[] _ftsoInFallbackMode); +``` + +Returns whether the FTSO Manager is currently in fallback mode. + +In this mode only submissions from trusted providers are used. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_fallbackMode` | `bool` | True if fallback mode is enabled for the manager. | +| `_ftsos` | `contract IIFtso[]` | Array of all currently active FTSO assets. | +| `_ftsoInFallbackMode` | `bool[]` | Boolean array indicating which FTSO assets are in fallback mode. If the FTSO Manager is in fallback mode then ALL FTSOs are in fallback mode. | +
+
+ +
+ +### `getFtsos` { #fn_getftsos } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getFtsos( +) external view returns ( + contract IIFtso[] _ftsos); +``` + +Returns the list of currently [`active`](#va_active) FTSOs. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of contract addresses for the FTSOs. | +
+
+ +
+ +### `getGovernanceParameters` { #fn_getgovernanceparameters } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getGovernanceParameters( +) external view returns ( + uint256 _maxVotePowerNatThresholdFraction, + uint256 _maxVotePowerAssetThresholdFraction, + uint256 _lowAssetUSDThreshold, + uint256 _highAssetUSDThreshold, + uint256 _highAssetTurnoutThresholdBIPS, + uint256 _lowNatTurnoutThresholdBIPS, + uint256 _elasticBandRewardBIPS, + uint256 _rewardExpiryOffsetSeconds, + address[] _trustedAddresses, + bool _initialized, + bool _changed); +``` + +Returns [`governance`](#fn_governance) parameters for FTSOs. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_maxVotePowerNatThresholdFraction` | `uint256` | High threshold for native token vote power per voter. | +| `_maxVotePowerAssetThresholdFraction` | `uint256` | High threshold for asset vote power per voter | +| `_lowAssetUSDThreshold` | `uint256` | Threshold for low asset vote power (in scaled USD). | +| `_highAssetUSDThreshold` | `uint256` | Threshold for high asset vote power (in scaled USD). | +| `_highAssetTurnoutThresholdBIPS` | `uint256` | Threshold for high asset turnout (in BIPS). | +| `_lowNatTurnoutThresholdBIPS` | `uint256` | Threshold for low nat turnout (in BIPS). | +| `_elasticBandRewardBIPS` | `uint256` | Secondary reward band, where _elasticBandRewardBIPS goes to the secondary band and 10000 - _elasticBandRewardBIPS to the primary (IQR) band. | +| `_rewardExpiryOffsetSeconds` | `uint256` | Reward epochs closed earlier than block.timestamp - _rewardExpiryOffsetSeconds expire. | +| `_trustedAddresses` | `address[]` | Trusted addresses will be used as a fallback mechanism for setting the price. | +| `_initialized` | `bool` | | +| `_changed` | `bool` | | +
+
+ +
+ +### `getLastUnprocessedPriceEpochData` { #fn_getlastunprocessedpriceepochdata } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getLastUnprocessedPriceEpochData( +) external view returns ( + uint256 _lastUnprocessedPriceEpoch, + uint256 _lastUnprocessedPriceEpochRevealEnds, + bool _lastUnprocessedPriceEpochInitialized); +``` + +Returns information regarding the currently unprocessed price epoch. +This epoch is not necessarily the last one, in case the network halts for some +time due to validator node problems, for example. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lastUnprocessedPriceEpoch` | `uint256` | ID of the price epoch that is currently waiting finalization. | +| `_lastUnprocessedPriceEpochRevealEnds` | `uint256` | When that price epoch can be finalized, in seconds since UNIX epoch. | +| `_lastUnprocessedPriceEpochInitialized` | `bool` | Whether this price epoch has been already initialized and therefore it must be finalized before the corresponding reward epoch can be finalized. | +
+
+ +
+ +### `getPriceEpochConfiguration` { #fn_getpriceepochconfiguration } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getPriceEpochConfiguration( +) external view returns ( + uint256 _firstPriceEpochStartTs, + uint256 _priceEpochDurationSeconds, + uint256 _revealEpochDurationSeconds); +``` + +Returns the current values for price epoch timing configuration. + +See the [FTSO page](https://docs.flare.network/tech/ftso/#data-submission-process) +for information about the different submission phases. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstPriceEpochStartTs` | `uint256` | Timestamp, in seconds since UNIX epoch, of the first price epoch. | +| `_priceEpochDurationSeconds` | `uint256` | Duration in seconds of the commit phase. | +| `_revealEpochDurationSeconds` | `uint256` | Duration in seconds of the reveal phase. | +
+
+ +
+ +### `getPriceSubmitter` { #fn_getpricesubmitter } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getPriceSubmitter( +) external view returns ( + contract IIPriceSubmitter); +``` + +Returns the [`PriceSubmitter`](./PriceSubmitter.md) contract. + +
+
+ +
+ +### `getRewardEpochConfiguration` { #fn_getrewardepochconfiguration } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochConfiguration( +) external view returns ( + uint256 _firstRewardEpochStartTs, + uint256 _rewardEpochDurationSeconds); +``` + +Returns the current values for reward epoch timing configuration. + +See the [Reward epochs](https://docs.flare.network/tech/ftso/#vote-power) box. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstRewardEpochStartTs` | `uint256` | Timestamp, in seconds since UNIX epoch, of the first reward epoch. | +| `_rewardEpochDurationSeconds` | `uint256` | Duration in seconds of the reward epochs. | +
+
+ +
+ +### `getRewardEpochData` { #fn_getrewardepochdata } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochData( + uint256 _rewardEpochId +) public view returns ( + struct IIFtsoManager.RewardEpochData); +``` + +Returns data regarding a specific reward epoch ID. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpochId` | `uint256` | Epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IIFtsoManager.RewardEpochData` | RewardEpochData Its associated data. | +
+
+ +
+ +### `getRewardEpochToExpireNext` { #fn_getrewardepochtoexpirenext } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochToExpireNext( +) external view returns ( + uint256); +``` + +Return reward epoch that will expire next, when a new reward epoch is initialized. + +Reward epochs older than 90 days expire, and any unclaimed rewards in them become +inaccessible. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Reward epoch ID. | +
+
+ +
+ +### `getRewardEpochVotePowerBlock` { #fn_getrewardepochvotepowerblock } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochVotePowerBlock( + uint256 _rewardEpoch +) external view returns ( + uint256 _votepowerBlock); +``` + +Returns the [vote power block](https://docs.flare.network/tech/ftso/#vote-power) +that was used for a past reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | The queried reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_votepowerBlock` | `uint256` | uint256 The block number of that reward epoch's vote power block. | +
+
+ +
+ +### `getRewardExpiryOffsetSeconds` { #fn_getrewardexpiryoffsetseconds } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getRewardExpiryOffsetSeconds( +) external view returns ( + uint256); +``` + +Returns the currently configured reward expiration time. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Unclaimed rewards accrued in reward epochs more than this amount of seconds in the past expire and become inaccessible. | +
+
+ +
+ +### `getUpdateGovernanceParametersTs` { #fn_getupdategovernanceparametersts } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getUpdateGovernanceParametersTs( +) external view returns ( + uint256); +``` + +Returns the timestamp, in seconds since UNIX epoch, when the scheduled new settings +will take effect. + +
+
+ +
+ +### `getVotePowerIntervalFraction` { #fn_getvotepowerintervalfraction } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function getVotePowerIntervalFraction( +) external view returns ( + uint256); +``` + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `notInitializedFtsos` { #fn_notinitializedftsos } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function notInitializedFtsos( + contract IIFtso _ftso +) external view returns ( + bool); +``` + +Returns whether an FTSO has been initialized. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Initialization state. | +
+
+ +
+ +### `removeFtso` { #fn_removeftso } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function removeFtso( + contract IIFtso _ftso +) external; +``` + +Removes an FTSO from the list of managed FTSOs. +Reverts if FTSO is used in a multi-asset FTSO. +Deactivates the `_ftso`. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | FTSO contract address to remove. | + +
+
+ +
+ +### `replaceFtso` { #fn_replaceftso } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function replaceFtso( + contract IIFtso _ftsoToAdd, + bool _copyCurrentPrice, + bool _copyAssetOrAssetFtsos +) external; +``` + +Replaces one FTSO with another with the same symbol. +All FTSOs in a multi-asset FTSO must be managed by the same FTSO manager. +Deactivates the old FTSO. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoToAdd` | `contract IIFtso` | FTSO contract address to add. An existing FTSO with the same symbol will be removed. | +| `_copyCurrentPrice` | `bool` | | +| `_copyAssetOrAssetFtsos` | `bool` | | + +
+
+ +
+ +### `replaceFtsosBulk` { #fn_replaceftsosbulk } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function replaceFtsosBulk( + contract IIFtso[] _ftsosToAdd, + bool _copyCurrentPrice, + bool _copyAssetOrAssetFtsos +) external; +``` + +Replaces a list of FTSOs with other FTSOs with the same symbol. +All FTSOs in a multi-asset FTSO must be managed by the same FTSO manager. +Deactivates the old FTSOs. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsosToAdd` | `contract IIFtso[]` | Array of FTSO contract addresses to add. Every existing FTSO with the same symbols will be removed. | +| `_copyCurrentPrice` | `bool` | | +| `_copyAssetOrAssetFtsos` | `bool` | | + +
+
+ +
+ +### `rewardEpochDurationSeconds` { #fn_rewardepochdurationseconds } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function rewardEpochDurationSeconds( +) external view returns ( + uint256); +``` + +Currently configured reward epoch duration. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Reward epoch duration, in seconds. | +
+
+ +
+ +### `rewardEpochs` { #fn_rewardepochs } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function rewardEpochs( + uint256 _rewardEpochId +) external view returns ( + uint256 _votepowerBlock, + uint256 _startBlock, + uint256 _startTimestamp); +``` + +Returns information about a reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpochId` | `uint256` | The epoch ID to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_votepowerBlock` | `uint256` | The [vote power block](https://docs.flare.network/tech/ftso/#vote-power) of the epoch. | +| `_startBlock` | `uint256` | The first block of the epoch. | +| `_startTimestamp` | `uint256` | Timestamp of the epoch start, in seconds since UNIX epoch. | +
+
+ +
+ +### `rewardEpochsStartTs` { #fn_rewardepochsstartts } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function rewardEpochsStartTs( +) external view returns ( + uint256); +``` + +Time when the current reward epoch started. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Timestamp, in seconds since UNIX epoch. | +
+
+ +
+ +### `setElasticBandWidthPPMFtsos` { #fn_setelasticbandwidthppmftsos } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setElasticBandWidthPPMFtsos( + uint256 _updateTs, + contract IIFtso[] _ftsos, + uint256[] _widths +) external; +``` + +Sets elastic band widths in PPM (parts-per-million) for given FTSOs. +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_updateTs` | `uint256` | Timestamp when the changes will take effect, in seconds from UNIX epoch. | +| `_ftsos` | `contract IIFtso[]` | Array of FTSO contract addresses to update. | +| `_widths` | `uint256[]` | Array of secondary band widths in PPM. To obtain the actual band width, this number is divided by 10^6 and multiplied by the price median value. | + +
+
+ +
+ +### `setFallbackMode` { #fn_setfallbackmode } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setFallbackMode( + bool _fallbackMode +) external; +``` + +Sets whether the FTSO Manager is currently in fallback mode. +In this mode only submissions from trusted providers are used. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_fallbackMode` | `bool` | True if fallback mode is enabled. | + +
+
+ +
+ +### `setFtsoAsset` { #fn_setftsoasset } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setFtsoAsset( + contract IIFtso _ftso, + contract IIVPToken _asset +) external; +``` + +Sets the asset tracked by an FTSO. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | The FTSO contract address. | +| `_asset` | `contract IIVPToken` | The [`VPToken`](./VPToken.md) contract address of the asset to track. | + +
+
+ +
+ +### `setFtsoAssetFtsos` { #fn_setftsoassetftsos } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setFtsoAssetFtsos( + contract IIFtso _ftso, + contract IIFtso[] _assetFtsos +) external; +``` + +Sets an array of FTSOs to be tracked by a multi-asset FTSO. +FTSOs implicitly determine the FTSO assets. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | The multi-asset FTSO contract address. | +| `_assetFtsos` | `contract IIFtso[]` | Array of FTSOs to be tracked. | + +
+
+ +
+ +### `setFtsoFallbackMode` { #fn_setftsofallbackmode } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setFtsoFallbackMode( + contract IIFtso _ftso, + bool _fallbackMode +) external; +``` + +Sets whether an FTSO is currently in fallback mode. +In this mode only submissions from trusted providers are used. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | The FTSO contract address. | +| `_fallbackMode` | `bool` | Fallback mode. | + +
+
+ +
+ +### `setGovernanceParameters` { #fn_setgovernanceparameters } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setGovernanceParameters( + uint256 _updateTs, + uint256 _maxVotePowerNatThresholdFraction, + uint256 _maxVotePowerAssetThresholdFraction, + uint256 _lowAssetUSDThreshold, + uint256 _highAssetUSDThreshold, + uint256 _highAssetTurnoutThresholdBIPS, + uint256 _lowNatTurnoutThresholdBIPS, + uint256 _elasticBandRewardBIPS, + uint256 _rewardExpiryOffsetSeconds, + address[] _trustedAddresses +) external; +``` + +Sets [`governance`](#fn_governance) parameters for FTSOs + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_updateTs` | `uint256` | Time, in seconds since UNIX epoch, when updated settings should be pushed to FTSOs. | +| `_maxVotePowerNatThresholdFraction` | `uint256` | High threshold for native token vote power per voter. | +| `_maxVotePowerAssetThresholdFraction` | `uint256` | High threshold for asset vote power per voter | +| `_lowAssetUSDThreshold` | `uint256` | Threshold for low asset vote power (in scaled USD). | +| `_highAssetUSDThreshold` | `uint256` | Threshold for high asset vote power (in scaled USD). | +| `_highAssetTurnoutThresholdBIPS` | `uint256` | Threshold for high asset turnout (in BIPS). | +| `_lowNatTurnoutThresholdBIPS` | `uint256` | Threshold for low nat turnout (in BIPS). | +| `_elasticBandRewardBIPS` | `uint256` | Secondary reward band, where _elasticBandRewardBIPS goes to the secondary band and 10000 - _elasticBandRewardBIPS to the primary (IQR) band. | +| `_rewardExpiryOffsetSeconds` | `uint256` | Reward epochs closed earlier than block.timestamp - _rewardExpiryOffsetSeconds expire. | +| `_trustedAddresses` | `address[]` | Trusted addresses will be used as a fallback mechanism for setting the price. | + +
+
+ +
+ +### `setInitialRewardData` { #fn_setinitialrewarddata } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setInitialRewardData( + uint256 _nextRewardEpochToExpire, + uint256 _rewardEpochsLength, + uint256 _currentRewardEpochEnds +) external; +``` + +Set reward data to values from old ftso manager. +Can only be called before activation. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nextRewardEpochToExpire` | `uint256` | See `getRewardEpochToExpireNext`. | +| `_rewardEpochsLength` | `uint256` | See `getRewardEpochConfiguration`. | +| `_currentRewardEpochEnds` | `uint256` | See `getCurrentRewardEpoch`. | + +
+
+ +
+ +### `setRewardEpochDurationSeconds` { #fn_setrewardepochdurationseconds } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setRewardEpochDurationSeconds( + uint256 _rewardEpochDurationSeconds +) external; +``` + +Sets the reward epoch duration. +Only [`governance`](#fn_governance) can call this method. + +If the reward epoch is very short and the expiry offset is very long, the list of reward epochs +to be checked becomes very long. Therefore reward epoch time has to be capped to expiry offset. + +
+
+ +
+ +### `setUpdateOnRewardEpochSwitchover` { #fn_setupdateonrewardepochswitchover } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setUpdateOnRewardEpochSwitchover( + contract IUpdateValidators _updateValidators +) external; +``` + +Unused. + +
+
+ +
+ +### `setUseGoodRandom` { #fn_setusegoodrandom } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setUseGoodRandom( + bool _useGoodRandom, + uint256 _maxWaitForGoodRandomSeconds +) external; +``` + +Allow [`governance`](#fn_governance) to switch to good random numbers only. +Only [`governance`](#fn_governance) can call this method. + +See [`IFtsoManager`](./IFtsoManager.md).[`UseGoodRandomSet`](#ev_usegoodrandomset). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_useGoodRandom` | `bool` | Whether good random numbers should be used or not. | +| `_maxWaitForGoodRandomSeconds` | `uint256` | Max time in seconds to wait for the good random. If there is none after given time, reward epoch finalization should proceed anyway. | + +
+
+ +
+ +### `setVotePowerIntervalFraction` { #fn_setvotepowerintervalfraction } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function setVotePowerIntervalFraction( + uint256 _votePowerIntervalFraction +) external; +``` + +
+
+ +
+ +### `showLastRevertedError` { #fn_showlastrevertederror } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +```solidity +function showLastRevertedError( +) external view returns ( + uint256[] _lastErrorBlock, + uint256[] _numErrors, + string[] _errorString, + address[] _erroringContract, + uint256 _totalRevertedErrors); +``` + +Returns latest error information. All arrays will contain only one entry. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lastErrorBlock` | `uint256[]` | Array of block numbers where the errors occurred. | +| `_numErrors` | `uint256[]` | Array of number of times same error with same contract address has been reverted. | +| `_errorString` | `string[]` | Array of revert error messages. | +| `_erroringContract` | `address[]` | Array of addresses of the reverting contracts. | +| `_totalRevertedErrors` | `uint256` | Total number of revert errors across all contracts. | +
+
+ +
+ +### `showRevertedErrors` { #fn_showrevertederrors } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +```solidity +function showRevertedErrors( + uint256 startIndex, + uint256 numErrorTypesToShow +) public view returns ( + uint256[] _lastErrorBlock, + uint256[] _numErrors, + string[] _errorString, + address[] _erroringContract, + uint256 _totalRevertedErrors); +``` + +Returns latest errors. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `startIndex` | `uint256` | Starting index in the error list array. | +| `numErrorTypesToShow` | `uint256` | Number of errors to show. The total amount can be found in `errorData`. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lastErrorBlock` | `uint256[]` | Array of block numbers where the errors occurred. | +| `_numErrors` | `uint256[]` | Array of number of times same error with same contract address has been reverted. | +| `_errorString` | `string[]` | Array of revert error messages. | +| `_erroringContract` | `address[]` | Array of addresses of the reverting contracts. | +| `_totalRevertedErrors` | `uint256` | Total number of revert errors across all contracts. | +
+
+ +
+ +### `switchToFallbackMode` { #fn_switchtofallbackmode } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function switchToFallbackMode( +) external returns ( + bool); +``` + +This function will be called after an error is caught in [`daemonize`](#fn_daemonize). +It will switch the contract to a simpler fallback mode, which hopefully works when full mode doesn't. +Not every contract needs to support fallback mode ([`FtsoManager`](./FtsoManager.md) does), so this method may be empty. +Switching back to normal mode is left to the contract (typically a governed method call). +This function may be called due to low-gas error, so it shouldn't use more than ~30.000 gas. + +Only [`flareDaemon`](#va_flaredaemon) can call this method. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | True if switched to fallback mode, false if already in fallback mode or if fallback mode is not supported. | +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +### `voterWhitelister` { #fn_voterwhitelister } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity +function voterWhitelister( +) external view returns ( + contract IIVoterWhitelister); +``` + +Returns the [`VoterWhitelister`](./VoterWhitelister.md) contract address. + +
+
+ +
+ +
+ +## Variables + +
+ +### `MAX_TRUSTED_ADDRESSES_LENGTH` { #va_max_trusted_addresses_length } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + uint256 MAX_TRUSTED_ADDRESSES_LENGTH +``` + +Maximum number of trusted addresses allowed. + +
+
+ +
+ +### `active` { #va_active } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + bool active +``` + +Whether the FTSO Manager is [`active`](#va_active) or not. + +
+
+ +
+ +### `cleanupBlockNumberManager` { #va_cleanupblocknumbermanager } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + contract CleanupBlockNumberManager cleanupBlockNumberManager +``` + +Address of the [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md) contract. + +
+
+ +
+ +### `currentRewardEpochEnds` { #va_currentrewardepochends } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + uint256 currentRewardEpochEnds +``` + +Timestamp when the current reward epoch finishes, in seconds since UNIX epoch. + +
+
+ +
+ +### `errorData` { #va_errordata } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +```solidity + struct RevertErrorTracking.LastErrorData errorData +``` + +Most recent error information. + +
+
+ +
+ +### `flareDaemon` { #va_flaredaemon } + +
+Defined in `GovernedAndFlareDaemonized` ([Docs](./GovernedAndFlareDaemonized.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol)). +
+ +
+ +```solidity + contract FlareDaemon flareDaemon +``` + +The [`FlareDaemon`](./FlareDaemon.md) contract, set at construction time. + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `lastRewardedFtsoAddress` { #va_lastrewardedftsoaddress } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + address lastRewardedFtsoAddress +``` + +Address of the FTSO contract that was last chosen for reward calculations. + +
+
+ +
+ +### `maxWaitForGoodRandomSeconds` { #va_maxwaitforgoodrandomseconds } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + uint256 maxWaitForGoodRandomSeconds +``` + +Used only when [`useGoodRandom`](#va_usegoodrandom) flag is set. + +
+
+ +
+ +### `oldFtsoManager` { #va_oldftsomanager } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + contract IIFtsoManagerV1 oldFtsoManager +``` + +Previous FTSO Manager, in case of a redeployment. + +
+
+ +
+ +### `priceSubmitter` { #va_pricesubmitter } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + contract IIPriceSubmitter priceSubmitter +``` + +Address of the [`PriceSubmitter`](./PriceSubmitter.md) contract. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `rewardEpochDurationSeconds` { #va_rewardepochdurationseconds } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + uint256 rewardEpochDurationSeconds +``` + +Duration of reward epochs, in seconds. + +
+
+ +
+ +### `rewardEpochsStartTs` { #va_rewardepochsstartts } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + uint256 rewardEpochsStartTs +``` + +Timestamp when the first reward epoch started, in seconds since UNIX epoch. + +
+
+ +
+ +### `rewardManager` { #va_rewardmanager } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + contract IIFtsoRewardManager rewardManager +``` + +Address of the `RewardManager` contract. + +
+
+ +
+ +### `supply` { #va_supply } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + contract IISupply supply +``` + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ +### `updateOnRewardEpochSwitchover` { #va_updateonrewardepochswitchover } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + contract IUpdateValidators updateOnRewardEpochSwitchover +``` + +Unused. + +
+
+ +
+ +### `useGoodRandom` { #va_usegoodrandom } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + bool useGoodRandom +``` + +Whether use of good random numbers is enforced. See [`IFtsoManager`](./IFtsoManager.md).[`UseGoodRandomSet`](#ev_usegoodrandomset). + +
+
+ +
+ +### `waitingForGoodRandomSinceTs` { #va_waitingforgoodrandomsincets } + +
+Defined in `FtsoManager` ([Docs](./FtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/implementation/FtsoManager.sol)). +
+ +
+ +```solidity + uint256 waitingForGoodRandomSinceTs +``` + +Used only when [`useGoodRandom`](#va_usegoodrandom) flag is set. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/FtsoRegistry.md b/docs/apis/smart-contracts/FtsoRegistry.md new file mode 100644 index 000000000..c15233b51 --- /dev/null +++ b/docs/apis/smart-contracts/FtsoRegistry.md @@ -0,0 +1,972 @@ +--- +title: FtsoRegistry +--- + + + +# `FtsoRegistry` { #ct_ftsoregistry } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol) | Inherits from [IIFtsoRegistry](./IIFtsoRegistry.md), [AddressUpdatable](./AddressUpdatable.md), [GovernedBase](./GovernedBase.md) +
+ +
+ +Handles registration of assets to the [FTSO system](https://docs.flare.network/tech/ftso). + +
+ +
+ +## Functions + +
+ +### `addFtso` { #fn_addftso } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function addFtso( + contract IIFtso _ftsoContract +) external returns ( + uint256 _assetIndex); +``` + +Add a new FTSO contract to the registry. + +Only the [`ftsoManager`](#va_ftsomanager) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoContract` | `contract IIFtso` | New target FTSO contract. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_assetIndex` | `uint256` | The FTSO index assigned to the new asset. | +
+
+ +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +constructor( +) public; +``` + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getAllCurrentPrices` { #fn_getallcurrentprices } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getAllCurrentPrices( +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of all supported assets. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getAllFtsos` { #fn_getallftsos } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getAllFtsos( +) external view returns ( + contract IIFtso[] _ftsos); +``` + +Return all currently supported FTSO contracts. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of FTSO contract addresses. | +
+
+ +
+ +### `getCurrentPrice` { #fn_getcurrentprice } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPrice( + uint256 _assetIndex +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Public view function to get the current price of a given active FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetIndex` | `uint256` | | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Current price of the asset in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Timestamp for when this price was updated, in seconds since UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceWithDecimals` { #fn_getcurrentpricewithdecimals } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimals( + uint256 _assetIndex +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Public view function to get the current price and decimals of a given active FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetIndex` | `uint256` | Index to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Current price of the asset in USD multiplied by 10^`_assetPriceUsdDecimals`. | +| `_timestamp` | `uint256` | Timestamp for when this price was updated, in seconds since UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the `_price`. | +
+
+ +
+ +### `getCurrentPricesByIndices` { #fn_getcurrentpricesbyindices } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPricesByIndices( + uint256[] _indices +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of a list of indices. +Reverts if any of the indices is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_indices` | `uint256[]` | Array of indices to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getCurrentPricesBySymbols` { #fn_getcurrentpricesbysymbols } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPricesBySymbols( + string[] _symbols +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of a list of asset symbols. +Reverts if any of the symbols is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbols` | `string[]` | Array of symbols to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getFtso` { #fn_getftso } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtso( + uint256 _assetIndex +) external view returns ( + contract IIFtso _activeFtso); +``` + +Returns the address of the FTSO contract for a given index. +Reverts if unsupported index is passed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetIndex` | `uint256` | | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_activeFtso` | `contract IIFtso` | | +
+
+ +
+ +### `getFtsoBySymbol` { #fn_getftsobysymbol } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoBySymbol( + string _symbol +) external view returns ( + contract IIFtso _activeFtso); +``` + +Returns the address of the FTSO contract for a given symbol. +Reverts if unsupported symbol is passed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | The queried symbol. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_activeFtso` | `contract IIFtso` | | +
+
+ +
+ +### `getFtsoHistory` { #fn_getftsohistory } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoHistory( + uint256 _assetIndex +) external view returns ( + contract IIFtso[5] _ftsoAddressHistory); +``` + +Get the history of FTSOs for given index. +If there are less then MAX_HISTORY_LENGTH the remaining addresses will be 0 addresses. +Reverts if index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetIndex` | `uint256` | Asset index to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsoAddressHistory` | `contract IIFtso[5]` | History of FTSOs contract for provided index. | +
+
+ +
+ +### `getFtsoIndex` { #fn_getftsoindex } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoIndex( + string _symbol +) external view returns ( + uint256 _assetIndex); +``` + +Returns the FTSO index corresponding to a given asset symbol. +Reverts if the symbol is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | Symbol to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_assetIndex` | `uint256` | The corresponding asset index. | +
+
+ +
+ +### `getFtsoSymbol` { #fn_getftsosymbol } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoSymbol( + uint256 _assetIndex +) external view returns ( + string _symbol); +``` + +Returns the asset symbol corresponding to a given FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetIndex` | `uint256` | | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_symbol` | `string` | The corresponding asset symbol. | +
+
+ +
+ +### `getFtsos` { #fn_getftsos } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsos( + uint256[] _assetIndices +) external view returns ( + contract IFtsoGenesis[] _ftsos); +``` + +Get the addresses of the active FTSOs at the given indices. +Reverts if any of the provided indices is non-existing or inactive. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetIndices` | `uint256[]` | | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IFtsoGenesis[]` | The array of FTSO addresses. | +
+
+ +
+ +### `getSupportedFtsos` { #fn_getsupportedftsos } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedFtsos( +) external view returns ( + contract IIFtso[] _ftsos); +``` + +Get array of all FTSO contracts for all supported asset indices. +The index of FTSO in returned array does not necessarily correspond to the asset's index. +Due to deletion, some indices might be unsupported. + +Use [`getSupportedIndicesAndFtsos`](#fn_getsupportedindicesandftsos) to retrieve pairs of correct indices and FTSOs, +where possible "null" holes are readily apparent. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSOs. | +
+
+ +
+ +### `getSupportedIndices` { #fn_getsupportedindices } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndices( +) external view returns ( + uint256[] _supportedIndices); +``` + +Returns the indices of the currently supported FTSOs. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all active FTSO indices in increasing order. | +
+
+ +
+ +### `getSupportedIndicesAndFtsos` { #fn_getsupportedindicesandftsos } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesAndFtsos( +) external view returns ( + uint256[] _supportedIndices, + contract IIFtso[] _ftsos); +``` + +Get all supported indices and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +### `getSupportedIndicesAndSymbols` { #fn_getsupportedindicesandsymbols } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesAndSymbols( +) external view returns ( + uint256[] _supportedIndices, + string[] _supportedSymbols); +``` + +Get all supported indices and corresponding symbols. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +
+
+ +
+ +### `getSupportedIndicesSymbolsAndFtsos` { #fn_getsupportedindicessymbolsandftsos } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesSymbolsAndFtsos( +) external view returns ( + uint256[] _supportedIndices, + string[] _supportedSymbols, + contract IIFtso[] _ftsos); +``` + +Get all supported indices, symbols, and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +### `getSupportedSymbols` { #fn_getsupportedsymbols } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedSymbols( +) external view returns ( + string[] _supportedSymbols); +``` + +Returns the symbols of the currently supported FTSOs. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedSymbols` | `string[]` | Array of all active FTSO symbols in increasing order. | +
+
+ +
+ +### `getSupportedSymbolsAndFtsos` { #fn_getsupportedsymbolsandftsos } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedSymbolsAndFtsos( +) external view returns ( + string[] _supportedSymbols, + contract IIFtso[] _ftsos); +``` + +Get all supported symbols and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `initialiseRegistry` { #fn_initialiseregistry } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function initialiseRegistry( + address _addressUpdater +) external; +``` + +
+
+ +
+ +### `removeFtso` { #fn_removeftso } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +function removeFtso( + contract IIFtso _ftso +) external; +``` + +Removes the FTSO and keeps part of the history. +Reverts if the provided address is not supported. + +From now on, the index this asset was using is "reserved" and cannot be used again. +It will not be returned in any list of currently supported assets. + +Only the [`ftsoManager`](#va_ftsomanager) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | Address of the FTSO contract to remove. | + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +### `onlyFtsoManager` { #md_onlyftsomanager } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity +modifier onlyFtsoManager() +``` + +Only the [`ftsoManager`](#va_ftsomanager) can call this method. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +
+ +## Variables + +
+ +### `ftsoManager` { #va_ftsomanager } + +
+Defined in `FtsoRegistry` ([Docs](./FtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/FtsoRegistry.sol)). +
+ +
+ +```solidity + contract IIFtsoManager ftsoManager +``` + +[`FtsoManager`](./FtsoManager.md) contract that can add and remove assets to the registry. + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/FtsoRewardManager.md b/docs/apis/smart-contracts/FtsoRewardManager.md new file mode 100644 index 000000000..91aa27e49 --- /dev/null +++ b/docs/apis/smart-contracts/FtsoRewardManager.md @@ -0,0 +1,1911 @@ +--- +title: FtsoRewardManager +--- + + + +# `FtsoRewardManager` { #ct_ftsorewardmanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol) | Inherits from [IIFtsoRewardManager](./IIFtsoRewardManager.md), [Governed](./Governed.md), ReentrancyGuard, [AddressUpdatable](./AddressUpdatable.md) +
+ +
+ +Handles reward distribution and claiming related to the FTSO system. + +More specifically, this contract: + +* Distributes rewards according to instructions from the [`FtsoManager`](./FtsoManager.md). +* Allows data providers, delegators and executors to [`claim`](#fn_claim) rewards. + +
+ +
+ +## Functions + +
+ +### `accrueUnearnedRewards` { #fn_accrueunearnedrewards } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function accrueUnearnedRewards( + uint256 _epochId, + uint256 _priceEpochDurationSeconds, + uint256 _priceEpochEndTime +) external; +``` + +Accrue unearned rewards for a given price epoch. +Typically done when the FTSO is in fallback mode or because of insufficient vote power. +Simply accrue them so they will not be distributed and will be burned later. + +The amount of rewards that will be burned is calculated in the same way as in [`distributeRewards`](#fn_distributerewards). + +Only the FTSO Manager can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | | +| `_priceEpochDurationSeconds` | `uint256` | | +| `_priceEpochEndTime` | `uint256` | | + +
+
+ +
+ +### `activate` { #fn_activate } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function activate( +) external; +``` + +Activates reward manager (allows claiming rewards). + +Only [`governance`](#fn_governance) can call this method. + +
+
+ +
+ +### `active` { #fn_active } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Whether rewards can be claimed from this reward manager. + +
+
+ +
+ +### `autoClaim` { #fn_autoclaim } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function autoClaim( + address[] _rewardOwners, + uint256 _rewardEpoch +) external; +``` + +Allows claiming rewards simultaneously for a list of reward owners and all unclaimed epochs before the +specified one. + +This is meant as a convenience all-in-one reward claiming method to be used both by reward owners and +[registered executors](https://docs.flare.network/tech/automatic-claiming/#registered-claiming-process). +It performs a series of operations, besides claiming rewards: + +* If a reward owner has enabled its +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account), rewards are also +claimed for the PDA and the total claimed amount is sent to that PDA. +Otherwise, the claimed amount is sent to the reward owner's account. + +* Claimed amount is automatically wrapped through the [`WNat`](./WNat.md) contract. + +* If the caller is a registered executor with a non-zero fee, the fee is paid to the executor for each claimed +address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwners` | `address[]` | List of reward owners to claim for. | +| `_rewardEpoch` | `uint256` | Last reward epoch ID to claim for. All previous epochs with pending rewards will be claimed too. | + +
+
+ +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `claim` { #fn_claim } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function claim( + address _rewardOwner, + address payable _recipient, + uint256 _rewardEpoch, + bool _wrap +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards for a reward owner. +The caller does not have to be the owner of the rewards, but must be approved by the owner to [`claim`](#fn_claim) on his +behalf by using `setClaimExecutors` on the [`claimSetupManager`](#va_claimsetupmanager). + +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by percentage. +Reverts if `msg.sender` is delegating by amount. + +Anybody can call this method, but rewards can only be sent to the reward owner, therefore no funds can be +stolen. However, by limiting the authorized callers, the owner can control the timing of the calls. + +When the reward owner is the caller, rewards can be sent to any recipient set by `setAllowedClaimRecipients` on +the [`claimSetupManager`](#va_claimsetupmanager). +The reward owner's [Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) +is always an authorized recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner. | +| `_recipient` | `address payable` | Address to transfer claimed rewards to. | +| `_rewardEpoch` | `uint256` | Last reward epoch to claim for. All previous epochs with pending rewards will be claimed too. | +| `_wrap` | `bool` | Whether claimed rewards should be wrapped through the [`WNat`](./WNat.md) contract before transferring them to the `_recipient`. This parameter is offered as a convenience. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `claimFromDataProviders` { #fn_claimfromdataproviders } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimFromDataProviders( + address _rewardOwner, + address payable _recipient, + uint256[] _rewardEpochs, + address[] _dataProviders, + bool _wrap +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards for a reward owner from specific data providers. +The caller does not have to be the owner of the rewards, but must be approved by the owner to [`claim`](#fn_claim) on his +behalf by using `setClaimExecutors` on the [`claimSetupManager`](#va_claimsetupmanager). + +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by amount (explicit delegation). +Reverts if `msg.sender` is delegating by percentage. + +Anybody can call this method, but rewards can only be sent to the reward owner, therefore no funds can be +stolen. However, by limiting the authorized callers, the owner can control the timing of the calls. + +When the reward owner is the caller, rewards can be sent to any recipient set by `setAllowedClaimRecipients` on +the [`claimSetupManager`](#va_claimsetupmanager). +The reward owner's [Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) +is always an authorized recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner. | +| `_recipient` | `address payable` | Address to transfer claimed rewards to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch IDs to claim for. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to claim the reward from. | +| `_wrap` | `bool` | Whether claimed rewards should be wrapped through the [`WNat`](./WNat.md) contract before transferring them to the `_recipient`. This parameter is offered as a convenience. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `claimReward` { #fn_claimreward } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimReward( + address payable _recipient, + uint256[] _rewardEpochs +) external returns ( + uint256 _rewardAmount); +``` + +Allows a percentage delegator to [`claim`](#fn_claim) rewards. +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by percentage. + +**This function is deprecated**: use [`claim`](#fn_claim) instead. + +Reverts if `msg.sender` is delegating by amount. +Claims for all unclaimed reward epochs to the 'max(_rewardEpochs)'. +Retained for backward compatibility. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipient` | `address payable` | Address to transfer funds to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch numbers to claim for. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Amount of total claimed rewards (wei). | +
+
+ +
+ +### `claimRewardFromDataProviders` { #fn_claimrewardfromdataproviders } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimRewardFromDataProviders( + address payable _recipient, + uint256[] _rewardEpochs, + address[] _dataProviders +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards from specific data providers. +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by amount. + +**This function is deprecated**: use [`claimFromDataProviders`](#fn_claimfromdataproviders) instead. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipient` | `address payable` | Address to transfer funds to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch numbers to claim for. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to claim the reward from. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `closeExpiredRewardEpoch` { #fn_closeexpiredrewardepoch } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function closeExpiredRewardEpoch( + uint256 _rewardEpoch +) external; +``` + +Collects funds from expired reward epoch and calculates totals. + +Triggered by [`ftsoManager`](#va_ftsomanager) on finalization of a reward epoch. +Operation is irreversible: when some reward epoch is closed according to current +settings, it cannot be reopened even if new parameters would +allow it, because `nextRewardEpochToExpire` in [`ftsoManager`](#va_ftsomanager) never decreases. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + address _addressUpdater, + address _oldFtsoRewardManager, + uint256 _feePercentageUpdateOffset, + uint256 _defaultFeePercentage +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `deactivate` { #fn_deactivate } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function deactivate( +) external; +``` + +Deactivates reward manager (prevents claiming rewards). + +Only [`governance`](#fn_governance) can call this method. + +
+
+ +
+ +### `defaultFeePercentage` { #fn_defaultfeepercentage } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function defaultFeePercentage( +) external view returns ( + uint256); +``` + +Returns the configured default fee percentage. + +
+
+ +
+ +### `distributeRewards` { #fn_distributerewards } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function distributeRewards( + address[] _addresses, + uint256[] _weights, + uint256 _totalWeight, + uint256 _epochId, + address _ftso, + uint256 _priceEpochDurationSeconds, + uint256 _currentRewardEpoch, + uint256 _priceEpochEndTime, + uint256 _votePowerBlock +) external; +``` + +Distributes price epoch rewards to data provider accounts, according to input parameters. +Must be called with `totalWeight` > 0 and `addresses.length` > 0. + +The amount of rewards for a given price epoch ID are calculated in [`FtsoRewardManager`](./FtsoRewardManager.md) from +`priceEpochDurationSeconds`, `priceEpochEndTime` and inflation authorization data +(see `_getTotalPriceEpochRewardWei` in [`FtsoRewardManager`](./FtsoRewardManager.md). +Then each data provider address is given a portion of this amount according to corresponding weight +and total sum of weights. + +Parameters `epochId` and `ftso` are only needed so they can be passed onto the emitted event. + +Only the [`ftsoManager`](#va_ftsomanager) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_addresses` | `address[]` | | +| `_weights` | `uint256[]` | | +| `_totalWeight` | `uint256` | | +| `_epochId` | `uint256` | | +| `_ftso` | `address` | | +| `_priceEpochDurationSeconds` | `uint256` | | +| `_currentRewardEpoch` | `uint256` | | +| `_priceEpochEndTime` | `uint256` | | +| `_votePowerBlock` | `uint256` | | + +
+
+ +
+ +### `enableClaims` { #fn_enableclaims } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function enableClaims( +) external; +``` + +Enable claiming for current and all future reward epochs. + +Only [`governance`](#fn_governance) can call this method. + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `feePercentageUpdateOffset` { #fn_feepercentageupdateoffset } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function feePercentageUpdateOffset( +) external view returns ( + uint256); +``` + +Returns the amount of reward epoch that need to ellapse before a fee change takes effect. + +
+
+ +
+ +### `firstClaimableRewardEpoch` { #fn_firstclaimablerewardepoch } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function firstClaimableRewardEpoch( +) external view returns ( + uint256); +``` + +Epochs before the token distribution event at Flare launch were not be claimable. +Use this method to know the first reward epoch that was claimable. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 The first reward epoch that can be claimed. | +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getClaimedReward` { #fn_getclaimedreward } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getClaimedReward( + uint256 _rewardEpoch, + address _dataProvider, + address _claimer +) external view returns ( + bool _claimed, + uint256 _amount); +``` + +Returns information on the rewards accrued by a reward owner from a specific data provider at a specific +reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | +| `_dataProvider` | `address` | Address of the data provider to query. | +| `_claimer` | `address` | Address of the reward owner to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_claimed` | `bool` | Whether the reward has been claimed or not. | +| `_amount` | `uint256` | Accrued amount in wei. | +
+
+ +
+ +### `getContractName` { #fn_getcontractname } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getContractName( +) external pure returns ( + string); +``` + +Implement this function to allow updating inflation receiver contracts through [`AddressUpdater`](./AddressUpdater.md). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `string` | Contract name. | +
+
+ +
+ +### `getCurrentRewardEpoch` { #fn_getcurrentrewardepoch } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getCurrentRewardEpoch( +) external view returns ( + uint256); +``` + +Returns the current reward epoch ID. + +
+
+ +
+ +### `getDataProviderCurrentFeePercentage` { #fn_getdataprovidercurrentfeepercentage } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderCurrentFeePercentage( + address _dataProvider +) external view returns ( + uint256); +``` + +Returns the current [fee](https://docs.flare.network/tech/ftso/#rewards) percentage of a data provider. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | | +
+
+ +
+ +### `getDataProviderFeePercentage` { #fn_getdataproviderfeepercentage } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderFeePercentage( + address _dataProvider, + uint256 _rewardEpoch +) external view returns ( + uint256 _feePercentageBIPS); +``` + +Returns the [fee](https://docs.flare.network/tech/ftso/#rewards) percentage of a data provider at a +given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256` | Fee percentage in BIPS. | +
+
+ +
+ +### `getDataProviderPerformanceInfo` { #fn_getdataproviderperformanceinfo } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderPerformanceInfo( + uint256 _rewardEpoch, + address _dataProvider +) external view returns ( + uint256 _rewardAmount, + uint256 _votePowerIgnoringRevocation); +``` + +Returns information on rewards and vote power of a data provider at a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | +| `_dataProvider` | `address` | Address of the data provider to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Amount of rewards (wei). | +| `_votePowerIgnoringRevocation` | `uint256` | Vote power, not including revocations. | +
+
+ +
+ +### `getDataProviderScheduledFeePercentageChanges` { #fn_getdataproviderscheduledfeepercentagechanges } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderScheduledFeePercentageChanges( + address _dataProvider +) external view returns ( + uint256[] _feePercentageBIPS, + uint256[] _validFromEpoch, + bool[] _fixed); +``` + +Returns the scheduled [fee](https://docs.flare.network/tech/ftso/#rewards) percentage changes for a data +provider. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256[]` | Array of fee percentages in BIPS. | +| `_validFromEpoch` | `uint256[]` | Array of block numbers from which the fee settings are effective. | +| `_fixed` | `bool[]` | Array of boolean values indicating whether settings are subject to change or not. | +
+
+ +
+ +### `getEpochReward` { #fn_getepochreward } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochReward( + uint256 _rewardEpoch +) external view returns ( + uint256 _totalReward, + uint256 _claimedReward); +``` + +Returns information on an epoch's rewards. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_totalReward` | `uint256` | Total amount of rewards accrued on that epoch, in wei. | +| `_claimedReward` | `uint256` | Total amount of rewards that have already been claimed, in wei. | +
+
+ +
+ +### `getEpochsWithClaimableRewards` { #fn_getepochswithclaimablerewards } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochsWithClaimableRewards( +) external view returns ( + uint256 _startEpochId, + uint256 _endEpochId); +``` + +Returns the reward epoch range for which rewards can be claimed. +Rewards outside this range are unclaimable, either because they have expired or because the reward epoch is +still ongoing. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_startEpochId` | `uint256` | The oldest epoch ID that allows reward claiming. | +| `_endEpochId` | `uint256` | The newest epoch ID that allows reward claiming. | +
+
+ +
+ +### `getEpochsWithUnclaimedRewards` { #fn_getepochswithunclaimedrewards } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochsWithUnclaimedRewards( + address _beneficiary +) external view returns ( + uint256[] _epochIds); +``` + +Returns the array of claimable epoch IDs for which the rewards of a reward owner have not yet been claimed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of the reward owner to query. Reverts if it uses delegation by amount. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_epochIds` | `uint256[]` | Array of epoch IDs. | +
+
+ +
+ +### `getExpectedBalance` { #fn_getexpectedbalance } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getExpectedBalance( +) external view returns ( + uint256); +``` + +Returns the contract's expected balance +(actual balance may be higher due to self-destruct funds). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Expected native token balance. | +
+
+ +
+ +### `getInflationAddress` { #fn_getinflationaddress } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getInflationAddress( +) external view returns ( + address); +``` + +Returns the address of the [`Inflation`](./Inflation.md) contract. + +
+
+ +
+ +### `getInitialRewardEpoch` { #fn_getinitialrewardepoch } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getInitialRewardEpoch( +) external view returns ( + uint256 _initialRewardEpoch); +``` + +Returns the initial reward epoch ID for this reward manager contract. +This corresponds to the oldest reward epoch with claimable rewards in the previous reward manager when this +one took over. +Set by [`governance`](#fn_governance) through [`setInitialRewardData`](#fn_setinitialrewarddata). + +
+
+ +
+ +### `getRewardEpochToExpireNext` { #fn_getrewardepochtoexpirenext } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getRewardEpochToExpireNext( +) external view returns ( + uint256); +``` + +Returns the reward epoch that will expire next once a new reward epoch starts. + +
+
+ +
+ +### `getRewardEpochVotePowerBlock` { #fn_getrewardepochvotepowerblock } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getRewardEpochVotePowerBlock( + uint256 _rewardEpoch +) external view returns ( + uint256); +``` + +Returns the [vote power block](https://docs.flare.network/tech/ftso/#vote-power) of a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +
+
+ +
+ +### `getStateOfRewards` { #fn_getstateofrewards } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getStateOfRewards( + address _beneficiary, + uint256 _rewardEpoch +) external view returns ( + address[] _dataProviders, + uint256[] _rewardAmounts, + bool[] _claimed, + bool _claimable); +``` + +Returns the state of rewards for a given address at a specific reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of the beneficiary to query. It can be a data provider or a delegator, for example.
Reverts if the queried address is delegating by amount. | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_dataProviders` | `address[]` | Array of addresses of data providers. | +| `_rewardAmounts` | `uint256[]` | Array of reward amounts received from each provider, in wei. | +| `_claimed` | `bool[]` | Array of boolean values indicating whether each reward has been claimed or not. | +| `_claimable` | `bool` | Boolean value indicating whether rewards are claimable or not. | +
+
+ +
+ +### `getStateOfRewardsFromDataProviders` { #fn_getstateofrewardsfromdataproviders } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getStateOfRewardsFromDataProviders( + address _beneficiary, + uint256 _rewardEpoch, + address[] _dataProviders +) external view returns ( + uint256[] _rewardAmounts, + bool[] _claimed, + bool _claimable); +``` + +Returns the state of rewards for a given address coming from a specific set of data providers, at a specific +reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of beneficiary to query. | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmounts` | `uint256[]` | Array of reward amounts received from each provider, in wei. | +| `_claimed` | `bool[]` | Array of boolean values indicating whether each reward has been claimed or not. | +| `_claimable` | `bool` | Boolean value indicating whether rewards are claimable or not. | +
+
+ +
+ +### `getTokenPoolSupplyData` { #fn_gettokenpoolsupplydata } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getTokenPoolSupplyData( +) external view returns ( + uint256 _lockedFundsWei, + uint256 _totalInflationAuthorizedWei, + uint256 _totalClaimedWei); +``` + +Returns token pool supply data. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lockedFundsWei` | `uint256` | Total amount of funds ever locked in the token pool (wei). `_lockedFundsWei` - `_totalClaimedWei` is the amount currently locked and outside the circulating supply. | +| `_totalInflationAuthorizedWei` | `uint256` | Total inflation authorized amount (wei). | +| `_totalClaimedWei` | `uint256` | Total claimed amount (wei). | +
+
+ +
+ +### `getTotals` { #fn_gettotals } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getTotals( +) external view returns ( + uint256 _totalAwardedWei, + uint256 _totalClaimedWei, + uint256 _totalExpiredWei, + uint256 _totalUnearnedWei, + uint256 _totalBurnedWei, + uint256 _totalInflationAuthorizedWei, + uint256 _totalInflationReceivedWei, + uint256 _lastInflationAuthorizationReceivedTs, + uint256 _dailyAuthorizedInflation); +``` + +Returns statistics regarding rewards, accumulated over the whole lifespan of the reward manager contract. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_totalAwardedWei` | `uint256` | Rewards that were distributed (wei). | +| `_totalClaimedWei` | `uint256` | Distributed rewards that were claimed in time (wei). | +| `_totalExpiredWei` | `uint256` | Distributed rewards that were not claimed in time and expired (wei). | +| `_totalUnearnedWei` | `uint256` | Rewards that were unearned (due to FTSO being in fallback mode) and thus were not distributed (wei). | +| `_totalBurnedWei` | `uint256` | Rewards that were unearned or expired and thus burned (wei). | +| `_totalInflationAuthorizedWei` | `uint256` | Total inflation authorized amount (wei). | +| `_totalInflationReceivedWei` | `uint256` | Total inflation received amount (wei). | +| `_lastInflationAuthorizationReceivedTs` | `uint256` | UNIX timestamp of the last inflation authorization. | +| `_dailyAuthorizedInflation` | `uint256` | [`Inflation`](./Inflation.md) authorized amount (wei) at the time of last authorization. | +
+
+ +
+ +### `getUnclaimedReward` { #fn_getunclaimedreward } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function getUnclaimedReward( + uint256 _rewardEpoch, + address _dataProvider +) external view returns ( + uint256 _amount, + uint256 _weight); +``` + +Returns information on unclaimed rewards for a given data provider and epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Queried reward epoch ID. | +| `_dataProvider` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_amount` | `uint256` | Amount available to be claimed, in wei. | +| `_weight` | `uint256` | Portion of total vote power used in this reward epoch that has not yet claimed its reward, in BIPS. It decreases to 0 when all data providers have claimed their rewards. | +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `nextClaimableRewardEpoch` { #fn_nextclaimablerewardepoch } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function nextClaimableRewardEpoch( + address _rewardOwner +) external view returns ( + uint256); +``` + +Returns the next claimable reward epoch for a reward owner. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner to query. | + +
+
+ +
+ +### `receiveInflation` { #fn_receiveinflation } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function receiveInflation( +) external payable; +``` + +Receive native tokens from inflation. + +Only the `inflation` contract can call this method. + +
+
+ +
+ +### `setDailyAuthorizedInflation` { #fn_setdailyauthorizedinflation } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function setDailyAuthorizedInflation( + uint256 _toAuthorizeWei +) external; +``` + +Notify the receiver that it is entitled to receive a new inflation amount. + +Only the `inflation` contract can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_toAuthorizeWei` | `uint256` | The amount of inflation that can be awarded in the coming day, in wei. | + +
+
+ +
+ +### `setDataProviderFeePercentage` { #fn_setdataproviderfeepercentage } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function setDataProviderFeePercentage( + uint256 _feePercentageBIPS +) external returns ( + uint256); +``` + +Sets the [fee](https://docs.flare.network/tech/ftso/#rewards) a data provider keeps from all delegations. + +Takes effect after `feeValueUpdateOffset` reward epochs have elapsed. + +When called multiple times inside the same reward epoch, only the last value remains. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256` | Fee percentage in BIPS. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | | +
+
+ +
+ +### `setInitialRewardData` { #fn_setinitialrewarddata } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function setInitialRewardData( +) external; +``` + +Copy initial reward data from [`oldFtsoRewardManager`](#va_oldftsorewardmanager) before starting up this new reward manager. +Should be called at the time of switching to the new reward manager, can be called only once, and only +by [`governance`](#fn_governance). + +
+
+ +
+ +### `setNewFtsoRewardManager` { #fn_setnewftsorewardmanager } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +function setNewFtsoRewardManager( + address _newFtsoRewardManager +) external; +``` + +Sets new ftso reward manager which will take over closing expired reward epochs +Should be called at the time of switching to the new reward manager, can be called only once, and only +by [`governance`](#fn_governance). + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `mustBalance` { #md_mustbalance } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +modifier mustBalance() +``` + +
+
+ +
+ +### `nonReentrant` { #md_nonreentrant } + +
+Defined in `ReentrancyGuard` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/utils/ReentrancyGuard.sol)). +
+ +
+ +```solidity +modifier nonReentrant() +``` + +Prevents a contract from calling itself, directly or indirectly. +Calling a `nonReentrant` function from another `nonReentrant` +function is not supported. It is possible to prevent this from happening +by making the `nonReentrant` function external, and make it call a +`private` function that does the actual work. + +
+
+ +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +### `onlyExecutorAndAllowedRecipient` { #md_onlyexecutorandallowedrecipient } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +modifier onlyExecutorAndAllowedRecipient( address _rewardOwner, + address _recipient) +``` + +Only the reward owner and its authorized executors can call this method. +Executors can only send rewards to authorized recipients. +See [`ClaimSetupManager`](./ClaimSetupManager.md). + +
+
+ +
+ +### `onlyFtsoManager` { #md_onlyftsomanager } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +modifier onlyFtsoManager() +``` + +Only the [`ftsoManager`](#va_ftsomanager) contract can call this method. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyIfActive` { #md_onlyifactive } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +modifier onlyIfActive() +``` + +This method can only be called if the contract is [`active`](#va_active). + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +### `onlyInflation` { #md_onlyinflation } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity +modifier onlyInflation() +``` + +Only the [`Inflation`](./Inflation.md) contract can call this method. + +
+
+ +
+ +
+ +## Structures + +
+ +### `RewardClaim` { #st_rewardclaim } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +
+```solidity +struct RewardClaim { + bool claimed; + uint128 amount; +} +``` + +
+ +
+ +### `RewardState` { #st_rewardstate } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +
+```solidity +struct RewardState { + address[] dataProviders; + uint256[] weights; + uint256[] amounts; + bool[] claimed; +} +``` + +
+ +
+ +### `TimelockedCall` { #st_timelockedcall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +
+```solidity +struct TimelockedCall { + uint256 allowedAfterTimestamp; + bytes encodedCall; +} +``` + +
+ +
+ +### `UnclaimedRewardState` { #st_unclaimedrewardstate } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +
+```solidity +struct UnclaimedRewardState { + uint128 amount; + uint128 weight; +} +``` + +
+ +
+ +
+ +## Variables + +
+ +### `active` { #va_active } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity + bool active +``` + +Whether rewards can be claimed from this reward manager. + +
+
+ +
+ +### `claimSetupManager` { #va_claimsetupmanager } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity + contract IIClaimSetupManager claimSetupManager +``` + +The [`ClaimSetupManager`](./ClaimSetupManager.md) contract that helps automate reward claiming. + +
+
+ +
+ +### `firstClaimableRewardEpoch` { #va_firstclaimablerewardepoch } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity + uint256 firstClaimableRewardEpoch +``` + +Epochs before the token distribution event at Flare launch were not be claimable. +This variable holds the first reward epoch that was claimable. + +
+
+ +
+ +### `ftsoManager` { #va_ftsomanager } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity + contract IIFtsoManager ftsoManager +``` + +The [`FtsoManager`](./FtsoManager.md) contract that controls reward distribution. + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `newFtsoRewardManager` { #va_newftsorewardmanager } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity + address newFtsoRewardManager +``` + +Address of the new [`FtsoRewardManager`](./FtsoRewardManager.md) that replaced this one. + +
+
+ +
+ +### `oldFtsoRewardManager` { #va_oldftsorewardmanager } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity + address oldFtsoRewardManager +``` + +Address of the old [`FtsoRewardManager`](./FtsoRewardManager.md), replaced by this one. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ +### `wNat` { #va_wnat } + +
+Defined in `FtsoRewardManager` ([Docs](./FtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/implementation/FtsoRewardManager.sol)). +
+ +
+ +```solidity + contract WNat wNat +``` + +Address of the wrapped native token ([`WNat`](./WNat.md)) contract. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/GovernanceSettings.md b/docs/apis/smart-contracts/GovernanceSettings.md new file mode 100644 index 000000000..baad14674 --- /dev/null +++ b/docs/apis/smart-contracts/GovernanceSettings.md @@ -0,0 +1,362 @@ +--- +title: GovernanceSettings +--- + + + +# `GovernanceSettings` { #ct_governancesettings } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol) | Inherits from [IGovernanceSettings](./IGovernanceSettings.md) +
+ +
+ +A special contract that holds the Flare governance address and its timelock. + +All governance calls are delayed by the timelock specified in this contract. + +This contract enables updating governance address and timelock only by hard-forking the network, +this is, only by updating validator code. + +
+ +
+ +## Events + +
+ +### `GovernanceAddressUpdated` { #ev_governanceaddressupdated } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +event GovernanceAddressUpdated( + uint256 timestamp, + address oldGovernanceAddress, + address newGovernanceAddress +) +``` + +Emitted when the governance address has been changed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `timestamp` | `uint256` | Timestamp of the block where the change happened, in seconds from UNIX epoch. | +| `oldGovernanceAddress` | `address` | Governance address before the change. | +| `newGovernanceAddress` | `address` | Governance address after the change. | + +
+
+ +
+ +### `GovernanceExecutorsUpdated` { #ev_governanceexecutorsupdated } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +event GovernanceExecutorsUpdated( + uint256 timestamp, + address[] oldExecutors, + address[] newExecutors +) +``` + +The list of addresses that are allowed to perform governance calls has been changed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `timestamp` | `uint256` | Timestamp of the block where the change happened, in seconds from UNIX epoch. | +| `oldExecutors` | `address[]` | Array of executor addresses before the change. | +| `newExecutors` | `address[]` | Array of executor addresses after the change. | + +
+
+ +
+ +### `GovernanceTimelockUpdated` { #ev_governancetimelockupdated } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +event GovernanceTimelockUpdated( + uint256 timestamp, + uint256 oldTimelock, + uint256 newTimelock +) +``` + +Emitted when the timelock has been changed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `timestamp` | `uint256` | Timestamp of the block where the change happened, in seconds from UNIX epoch. | +| `oldTimelock` | `uint256` | Timelock before the change (in seconds). | +| `newTimelock` | `uint256` | Timelock after the change (in seconds). | + +
+
+ +
+ +
+ +## Functions + +
+ +### `getExecutors` { #fn_getexecutors } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +function getExecutors( +) external view returns ( + address[]); +``` + +Gets the addresses of the accounts that are allowed to execute the timelocked governance calls, +once the timelock period expires. +Executors can be changed without a hard fork, via a normal governance call. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | | +
+
+ +
+ +### `getGovernanceAddress` { #fn_getgovernanceaddress } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +function getGovernanceAddress( +) external view returns ( + address); +``` + +Gets the governance account address. +The governance address can only be changed by a hard fork. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | | +
+
+ +
+ +### `getTimelock` { #fn_gettimelock } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +function getTimelock( +) external view returns ( + uint256); +``` + +Gets the time in seconds that must pass between a governance call and its execution. +The timelock value can only be changed by a hard fork. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | | +
+
+ +
+ +### `initialise` { #fn_initialise } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +function initialise( + address _governanceAddress, + uint256 _timelock, + address[] _executors +) external; +``` + +Perform initialization, which cannot be done in constructor, since this is a genesis contract. +Can only be called once. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governanceAddress` | `address` | Initial governance address. | +| `_timelock` | `uint256` | Initial timelock value, in seconds. | +| `_executors` | `address[]` | Initial list of addresses allowed to perform governance calls. | + +
+
+ +
+ +### `isExecutor` { #fn_isexecutor } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +function isExecutor( + address _address +) external view returns ( + bool); +``` + +Checks whether an address is one of the allowed executors. See [`getExecutors`](#fn_getexecutors). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_address` | `address` | The address to check. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | True if `_address` is in the executors list. | +
+
+ +
+ +### `setExecutors` { #fn_setexecutors } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +function setExecutors( + address[] _newExecutors +) external; +``` + +Set the addresses of the accounts that are allowed to execute the timelocked governance calls +once the timelock period expires. +It isn't very dangerous to allow for anyone to execute timelocked calls, but we reserve the right to +make sure the timing of the execution is under control. +Can only be called by the governance. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_newExecutors` | `address[]` | New list of allowed executors. The previous list is replaced. | + +
+
+ +
+ +### `setGovernanceAddress` { #fn_setgovernanceaddress } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +function setGovernanceAddress( + address _newGovernance +) external; +``` + +Change the governance address. +Can only be called by validators via fork. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_newGovernance` | `address` | New governance address. | + +
+
+ +
+ +### `setTimelock` { #fn_settimelock } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity +function setTimelock( + uint256 _newTimelock +) external; +``` + +Change the timelock, this is, the amount of time between a governance call and +its execution. +Can only be called by validators via fork. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_newTimelock` | `uint256` | New timelock value, in seconds. | + +
+
+ +
+ +
+ +## Variables + +
+ +### `SIGNAL_COINBASE` { #va_signal_coinbase } + +
+Defined in `GovernanceSettings` ([Docs](./GovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/GovernanceSettings.sol)). +
+ +
+ +```solidity + address SIGNAL_COINBASE +``` + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/GovernanceVotePower.md b/docs/apis/smart-contracts/GovernanceVotePower.md new file mode 100644 index 000000000..93bd2762f --- /dev/null +++ b/docs/apis/smart-contracts/GovernanceVotePower.md @@ -0,0 +1,510 @@ +--- +title: GovernanceVotePower +--- + + + +# `GovernanceVotePower` { #ct_governancevotepower } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol) | Inherits from [IIGovernanceVotePower](./IIGovernanceVotePower.md) +
+ +
+ +Contract managing governance vote power and its delegation. + +
+ +
+ +## Functions + +
+ +### `constructor` { #fn_constructor } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +constructor( + contract IVPToken _ownerToken +) public; +``` + +Construct [`GovernanceVotePower`](./GovernanceVotePower.md) for given [`VPToken`](./VPToken.md). + +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function delegate( + address _to +) public; +``` + +Delegates all governance vote power of `msg.sender` to address `_to`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | + +
+
+ +
+ +### `delegatedGovernanceVotePowerHistoryCleanup` { #fn_delegatedgovernancevotepowerhistorycleanup } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function delegatedGovernanceVotePowerHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete governance vote power checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Vote power owner account address. | +| `_count` | `uint256` | Maximum number of checkpoints to delete. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The number of deleted checkpoints. | +
+
+ +
+ +### `delegatesHistoryCleanup` { #fn_delegateshistorycleanup } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function delegatesHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete delegates checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Vote power owner account address. | +| `_count` | `uint256` | Maximum number of checkpoints to delete. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The number of deleted checkpoints. | +
+
+ +
+ +### `getCleanupBlockNumber` { #fn_getcleanupblocknumber } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function getCleanupBlockNumber( +) external view returns ( + uint256); +``` + +Get the current cleanup block number set with [`setCleanupBlockNumber`](#fn_setcleanupblocknumber). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The currently set cleanup block number. | +
+
+ +
+ +### `getDelegateOfAt` { #fn_getdelegateofat } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function getDelegateOfAt( + address _who, + uint256 _blockNumber +) public view returns ( + address); +``` + +Gets the address an account is delegating its governance vote power to, at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number at which to fetch the address. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address where `_who` was delegating its governance vote power at block `_blockNumber`. | +
+
+ +
+ +### `getDelegateOfAtNow` { #fn_getdelegateofatnow } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function getDelegateOfAtNow( + address _who +) public view returns ( + address); +``` + +Gets the address an account is delegating its governance vote power to, at the latest block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address where `_who` is currently delegating its governance vote power. | +
+
+ +
+ +### `getVotes` { #fn_getvotes } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function getVotes( + address _who +) public view returns ( + uint256); +``` + +Gets the governance vote power of an address at the latest block, including +all delegations made to it. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Governance vote power of `account` at the lastest block. | +
+
+ +
+ +### `ownerToken` { #fn_ownertoken } + +
+Defined in `IIGovernanceVotePower` ([Docs](./IIGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol)). +
+ +
+ +```solidity +function ownerToken( +) external view returns ( + contract IVPToken); +``` + +Get the token that this governance vote power contract belongs to. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IVPToken` | The [`IVPToken`](./IVPToken.md) interface owning this contract. | +
+
+ +
+ +### `setCleanerContract` { #fn_setcleanercontract } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function setCleanerContract( + address _cleanerContract +) external; +``` + +Set the contract that is allowed to call history cleaning methods. + +This method can be called by the [`ownerToken`](#va_ownertoken) only. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanerContract` | `address` | Address of the cleanup contract. Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). | + +
+
+ +
+ +### `setCleanupBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumber( + uint256 _blockNumber +) 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. + +This method can be called by the [`ownerToken`](#va_ownertoken) only. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The new cleanup block number. | + +
+
+ +
+ +### `undelegate` { #fn_undelegate } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function undelegate( +) public; +``` + +Undelegates all governance vote power of `msg.sender`. + +
+
+ +
+ +### `updateAtTokenTransfer` { #fn_updateattokentransfer } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function updateAtTokenTransfer( + address _from, + address _to, + uint256, + uint256, + uint256 _amount +) external; +``` + +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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Source address of the transfer. | +| `_to` | `address` | Destination address of the transfer. | +| `` | `uint256` | | +| `` | `uint256` | | +| `_amount` | `uint256` | Amount being transferred. | + +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _who, + uint256 _blockNumber +) public view returns ( + uint256); +``` + +Gets the governance vote power of an address at a given block number, including +all delegations made to it. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number at which to fetch the vote power. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Governance vote power of `_who` at `_blockNumber`. | +
+
+ +
+ +
+ +## Modifiers + +
+ +### `onlyCleaner` { #md_onlycleaner } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +modifier onlyCleaner() +``` + +History cleaning methods can be called only from the cleaner address. + +
+
+ +
+ +### `onlyOwnerToken` { #md_onlyownertoken } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity +modifier onlyOwnerToken() +``` + +All external methods in [`GovernanceVotePower`](./GovernanceVotePower.md) can only be executed by the owner token. + +
+
+ +
+ +
+ +## Variables + +
+ +### `cleanerContract` { #va_cleanercontract } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity + address cleanerContract +``` + +Address of the contract that is allowed to call methods for history cleaning. +Set with [`setCleanerContract`](#fn_setcleanercontract). + +
+
+ +
+ +### `ownerToken` { #va_ownertoken } + +
+Defined in `GovernanceVotePower` ([Docs](./GovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/GovernanceVotePower.sol)). +
+ +
+ +```solidity + contract IVPToken ownerToken +``` + +The [`VPToken`](./VPToken.md) (or some other contract) that owns this [`GovernanceVotePower`](./GovernanceVotePower.md). +All state changing methods may be called only from this address. +This is because original `msg.sender` is typically sent in a parameter +and we must make sure that it cannot be faked by directly calling +[`GovernanceVotePower`](./GovernanceVotePower.md) methods. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/Governed.md b/docs/apis/smart-contracts/Governed.md new file mode 100644 index 000000000..23105bc61 --- /dev/null +++ b/docs/apis/smart-contracts/Governed.md @@ -0,0 +1,145 @@ +--- +title: Governed +--- + + + +# `Governed` { #ct_governed } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol) | Inherits from [GovernedBase](./GovernedBase.md) +
+ +
+ +Defines behaviors for governed contracts that must have a governor set at construction-time. + +
+ +
+ +## Functions + +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/GovernedAndFlareDaemonized.md b/docs/apis/smart-contracts/GovernedAndFlareDaemonized.md new file mode 100644 index 000000000..8fee2d656 --- /dev/null +++ b/docs/apis/smart-contracts/GovernedAndFlareDaemonized.md @@ -0,0 +1,308 @@ +--- +title: GovernedAndFlareDaemonized +--- + + + +# `GovernedAndFlareDaemonized` { #ct_governedandflaredaemonized } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol) | Inherits from [Governed](./Governed.md) +
+ +
+ +Base class for contracts that are governed and triggered from the [`FlareDaemon`](./FlareDaemon.md). + +See [`Governed`](./Governed.md) and [`IFlareDaemonize`](./IFlareDaemonize.md). + +
+ +
+ +## Functions + +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `GovernedAndFlareDaemonized` ([Docs](./GovernedAndFlareDaemonized.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + contract FlareDaemon _flareDaemon +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `onlyFlareDaemon` { #md_onlyflaredaemon } + +
+Defined in `GovernedAndFlareDaemonized` ([Docs](./GovernedAndFlareDaemonized.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol)). +
+ +
+ +```solidity +modifier onlyFlareDaemon() +``` + +Only the [`flareDaemon`](#va_flaredaemon) can call this method. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +
+ +## Variables + +
+ +### `flareDaemon` { #va_flaredaemon } + +
+Defined in `GovernedAndFlareDaemonized` ([Docs](./GovernedAndFlareDaemonized.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol)). +
+ +
+ +```solidity + contract FlareDaemon flareDaemon +``` + +The [`FlareDaemon`](./FlareDaemon.md) contract, set at construction time. + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/GovernedAtGenesis.md b/docs/apis/smart-contracts/GovernedAtGenesis.md new file mode 100644 index 000000000..fe14caeb0 --- /dev/null +++ b/docs/apis/smart-contracts/GovernedAtGenesis.md @@ -0,0 +1,172 @@ +--- +title: GovernedAtGenesis +--- + + + +# `GovernedAtGenesis` { #ct_governedatgenesis } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedAtGenesis.sol) | Inherits from [GovernedBase](./GovernedBase.md) +
+ +
+ +Defines behaviors for governed contracts that have their governor set at genesis. + +This contract enforces a fixed [`governance`](#fn_governance) address when the [`constructor`](#fn_constructor) +is not executed on a contract (for instance when directly loaded to the genesis block). +This is required to fix [`governance`](#fn_governance) on a contract when the network starts, at such point +where theoretically no accounts yet exist, and leaving it ungoverned could result in a race +to claim [`governance`](#fn_governance) by an unauthorized address. + +
+ +
+ +## Functions + +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `GovernedAtGenesis` ([Docs](./GovernedAtGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedAtGenesis.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `initialise` { #fn_initialise } + +
+Defined in `GovernedAtGenesis` ([Docs](./GovernedAtGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedAtGenesis.sol)). +
+ +
+ +```solidity +function initialise( + address _governance +) public pure; +``` + +Disallow [`initialise`](#fn_initialise) to be called. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | The governance address for initial claiming. | + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/GovernedBase.md b/docs/apis/smart-contracts/GovernedBase.md new file mode 100644 index 000000000..a11780c78 --- /dev/null +++ b/docs/apis/smart-contracts/GovernedBase.md @@ -0,0 +1,373 @@ +--- +title: GovernedBase +--- + + + +# `GovernedBase` { #ct_governedbase } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol) +
+ +
+ +Abstract base class that defines behaviors for governed contracts. + +This class is abstract so that specific behaviors can be defined for the constructor. +Contracts should not be left ungoverned, but not all contract will have a constructor +(for example those pre-defined in genesis). + +
+ +
+ +## Events + +
+ +### `GovernanceCallTimelocked` { #ev_governancecalltimelocked } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceCallTimelocked( + bytes4 selector, + uint256 allowedAfterTimestamp, + bytes encodedCall +) +``` + +Emitted when a new [`governance`](#fn_governance) call has been recorded and is now waiting for the time lock to expire. + +
+
+ +
+ +### `GovernanceInitialised` { #ev_governanceinitialised } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceInitialised( + address initialGovernance +) +``` + +Emitted when the [`governance`](#fn_governance) address is initialized. +This address will be used until production mode is entered (see [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered)). +At that point the [`governance`](#fn_governance) address is taken from [`GovernanceSettings`](./GovernanceSettings.md). + +
+
+ +
+ +### `GovernedProductionModeEntered` { #ev_governedproductionmodeentered } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernedProductionModeEntered( + address governanceSettings +) +``` + +Emitted when [`governance`](#fn_governance) is enabled and the [`governance`](#fn_governance) address cannot be changed anymore +(only through a network fork). + +
+
+ +
+ +### `TimelockedGovernanceCallCanceled` { #ev_timelockedgovernancecallcanceled } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallCanceled( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is canceled before execution. + +
+
+ +
+ +### `TimelockedGovernanceCallExecuted` { #ev_timelockedgovernancecallexecuted } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallExecuted( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is executed. + +
+
+ +
+ +
+ +## Functions + +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +
+ +## Structures + +
+ +### `TimelockedCall` { #st_timelockedcall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +
+```solidity +struct TimelockedCall { + uint256 allowedAfterTimestamp; + bytes encodedCall; +} +``` + +
+ +
+ +
+ +## Variables + +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IClaimSetupManager.md b/docs/apis/smart-contracts/IClaimSetupManager.md new file mode 100644 index 000000000..67accb800 --- /dev/null +++ b/docs/apis/smart-contracts/IClaimSetupManager.md @@ -0,0 +1,1000 @@ +--- +title: IClaimSetupManager +--- + + + +# `IClaimSetupManager` { #ct_iclaimsetupmanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol) +
+ +
+ +Public interface for the [`ClaimSetupManager`](./ClaimSetupManager.md) contract. + +
+ +
+ +## Events + +
+ +### `AllowedClaimRecipientsChanged` { #ev_allowedclaimrecipientschanged } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event AllowedClaimRecipientsChanged( + address owner, + address[] recipients +) +``` + +
+
+ +
+ +### `ClaimExecutorFeeValueChanged` { #ev_claimexecutorfeevaluechanged } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event ClaimExecutorFeeValueChanged( + address executor, + uint256 validFromRewardEpoch, + uint256 feeValueWei +) +``` + +
+
+ +
+ +### `ClaimExecutorsChanged` { #ev_claimexecutorschanged } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event ClaimExecutorsChanged( + address owner, + address[] executors +) +``` + +
+
+ +
+ +### `DelegationAccountCreated` { #ev_delegationaccountcreated } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event DelegationAccountCreated( + address owner, + contract IDelegationAccount delegationAccount +) +``` + +
+
+ +
+ +### `DelegationAccountUpdated` { #ev_delegationaccountupdated } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event DelegationAccountUpdated( + address owner, + contract IDelegationAccount delegationAccount, + bool enabled +) +``` + +
+
+ +
+ +### `ExecutorRegistered` { #ev_executorregistered } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event ExecutorRegistered( + address executor +) +``` + +
+
+ +
+ +### `ExecutorUnregistered` { #ev_executorunregistered } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event ExecutorUnregistered( + address executor, + uint256 validFromRewardEpoch +) +``` + +
+
+ +
+ +### `MaxFeeSet` { #ev_maxfeeset } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event MaxFeeSet( + uint256 maxFeeValueWei +) +``` + +
+
+ +
+ +### `MinFeeSet` { #ev_minfeeset } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event MinFeeSet( + uint256 minFeeValueWei +) +``` + +
+
+ +
+ +### `RegisterExecutorFeeSet` { #ev_registerexecutorfeeset } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event RegisterExecutorFeeSet( + uint256 registerExecutorFeeValueWei +) +``` + +
+
+ +
+ +### `SetExecutorsExcessAmountRefunded` { #ev_setexecutorsexcessamountrefunded } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event SetExecutorsExcessAmountRefunded( + address owner, + uint256 excessAmount +) +``` + +
+
+ +
+ +
+ +## Functions + +
+ +### `accountToDelegationAccount` { #fn_accounttodelegationaccount } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function accountToDelegationAccount( + address _owner +) external view returns ( + address); +``` + +Gets the [PDA](https://docs.flare.network/tech/personal-delegation-account) of an account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of its PDA or `address(0)` if it has not been created yet. | +
+
+ +
+ +### `allowedClaimRecipients` { #fn_allowedclaimrecipients } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function allowedClaimRecipients( + address _rewardOwner +) external view returns ( + address[]); +``` + +Gets the addresses of recipients allowed to receive rewards on behalf of an account. +Beside these, the owner of the rewards is always authorized. +See [`setAllowedClaimRecipients`](#fn_setallowedclaimrecipients). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | The account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Addresses of all set authorized recipients. | +
+
+ +
+ +### `batchDelegate` { #fn_batchdelegate } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function batchDelegate( + address[] _delegatees, + uint256[] _bips +) external; +``` + +Undelegates all percentage delegations from the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account) and then [`delegate`](#fn_delegate) to a list of accounts. + +See [`delegate`](#fn_delegate). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegatees` | `address[]` | The addresses of the new recipients. | +| `_bips` | `uint256[]` | The percentage of voting power to be delegated to each delegatee, expressed in basis points (1/100 of one percent). Total of all `_bips` values must be lower than 10000. | + +
+
+ +
+ +### `claimExecutors` { #fn_claimexecutors } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function claimExecutors( + address _owner +) external view returns ( + address[]); +``` + +Gets the addresses of executors authorized to claim for an account. +See [`setClaimExecutors`](#fn_setclaimexecutors). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Addresses of all set executors. | +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function delegate( + address _to, + uint256 _bips +) external; +``` + +Delegates a percentage of the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account)'s voting power to another address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_bips` | `uint256` | 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. A value of 0 revokes delegation. | + +
+
+ +
+ +### `delegateGovernance` { #fn_delegategovernance } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function delegateGovernance( + address _to +) external; +``` + +Delegates all the [governance](https://docs.flare.network/tech/governance/) vote power of the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account) to another account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | Address of the recipient of the delegation. | + +
+
+ +
+ +### `disableDelegationAccount` { #fn_disabledelegationaccount } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function disableDelegationAccount( +) external; +``` + +Disables the +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +When using automatic claiming, all airdrops and FTSO rewards will be sent to the owner's account. +Rewards accrued by the PDA will no longer be automatically claimed. + +Reverts if there is no PDA. + +
+
+ +
+ +### `enableDelegationAccount` { #fn_enabledelegationaccount } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function enableDelegationAccount( +) external returns ( + contract IDelegationAccount); +``` + +Enables (or creates) a +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +When using automatic claiming, all airdrops and FTSO rewards will be sent to the PDA, and any rewards +accrued by the PDA will be claimed too. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IDelegationAccount` | Address of the delegation account contract. | +
+
+ +
+ +### `getDelegationAccountData` { #fn_getdelegationaccountdata } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getDelegationAccountData( + address _owner +) external view returns ( + contract IDelegationAccount _delegationAccount, + bool _enabled); +``` + +Gets [PDA](https://docs.flare.network/tech/personal-delegation-account) data for an account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegationAccount` | `contract IDelegationAccount` | Account's PDA address or `address(0)` if it has not been created yet. | +| `_enabled` | `bool` | Whether the PDA is enabled. | +
+
+ +
+ +### `getExecutorCurrentFeeValue` { #fn_getexecutorcurrentfeevalue } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorCurrentFeeValue( + address _executor +) external view returns ( + uint256); +``` + +Returns the current fee of a registered executor. +Reverts if the executor is not registered. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Fee in wei. | +
+
+ +
+ +### `getExecutorFeeValue` { #fn_getexecutorfeevalue } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorFeeValue( + address _executor, + uint256 _rewardEpoch +) external view returns ( + uint256); +``` + +Returns the fee of an executor at a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | +| `_rewardEpoch` | `uint256` | Reward Epoch ID to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Fee in wei at that reward epoch. | +
+
+ +
+ +### `getExecutorInfo` { #fn_getexecutorinfo } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorInfo( + address _executor +) external view returns ( + bool _registered, + uint256 _currentFeeValue); +``` + +Returns information about an executor. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_registered` | `bool` | Whether the executor is registered. | +| `_currentFeeValue` | `uint256` | Executor's current fee value, if registered. | +
+
+ +
+ +### `getExecutorScheduledFeeValueChanges` { #fn_getexecutorscheduledfeevaluechanges } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorScheduledFeeValueChanges( + address _executor +) external view returns ( + uint256[] _feeValue, + uint256[] _validFromEpoch, + bool[] _fixed); +``` + +Returns the currently scheduled fee changes of an executor. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | Executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feeValue` | `uint256[]` | Array of scheduled fees. | +| `_validFromEpoch` | `uint256[]` | Array of reward epochs ID where the scheduled fees will become effective. | +| `_fixed` | `bool[]` | Array of booleans indicating if an scheduled fee change is fixed or it might still be changed. | +
+
+ +
+ +### `getRegisteredExecutors` { #fn_getregisteredexecutors } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getRegisteredExecutors( + uint256 _start, + uint256 _end +) external view returns ( + address[] _registeredExecutors, + uint256 _totalLength); +``` + +Returns the list of executors registered through [`registerExecutor`](#fn_registerexecutor). +Supports paging. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_start` | `uint256` | First executor to return. | +| `_end` | `uint256` | Last executor to return. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_registeredExecutors` | `address[]` | Addresses of the registered executors. | +| `_totalLength` | `uint256` | Total amount of executors. | +
+
+ +
+ +### `isClaimExecutor` { #fn_isclaimexecutor } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function isClaimExecutor( + address _owner, + address _executor +) external view returns ( + bool); +``` + +Returns whether an executor is authorized to claim on behalf of a reward owner. +See [`setClaimExecutors`](#fn_setclaimexecutors). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The reward owner to query. | +| `_executor` | `address` | The executor to query. | + +
+
+ +
+ +### `registerExecutor` { #fn_registerexecutor } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function registerExecutor( + uint256 _feeValue +) external payable returns ( + uint256); +``` + +Registers the caller as an executor and sets its initial fee value. + +If the executor was already registered, this method only updates the fee, which will take effect after +`feeValueUpdateOffset` reward epochs have elapsed. + +Executor must pay a fee in order to register. See `registerExecutorFeeValueWei`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feeValue` | `uint256` | Desired fee, in wei. Must be between `minFeeValueWei` and `maxFeeValueWei`. 0 means no fee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID when the changes become effective. | +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _who, + uint256 _blockNumber +) external; +``` + +Revokes all delegation from the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account) +to a given account at a given block. + +Only affects the reads via `votePowerOfAtCached()` in the specified block. + +This method should be used only to prevent rogue [`delegate`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) with percentage of 0 or [`undelegateAll`](#fn_undelegateall). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The account to revoke. | +| `_blockNumber` | `uint256` | Block number where the revoking will take place. Must be in the past. | + +
+
+ +
+ +### `setAllowedClaimRecipients` { #fn_setallowedclaimrecipients } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function setAllowedClaimRecipients( + address[] _recipients +) external; +``` + +Set the addresses of allowed recipients. +The reward owner is always an allowed recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipients` | `address[]` | The new allowed recipients. All old recipients will be deleted and replaced by these. | + +
+
+ +
+ +### `setAutoClaiming` { #fn_setautoclaiming } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function setAutoClaiming( + address[] _executors, + bool _enableDelegationAccount +) external payable; +``` + +Sets the addresses of executors and optionally enables (creates) a +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +If any of the executors is a registered executor, some fee needs to be paid. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executors` | `address[]` | The new executors. All old executors will be deleted and replaced by these. | +| `_enableDelegationAccount` | `bool` | Whether the PDA should be enabled. | + +
+
+ +
+ +### `setClaimExecutors` { #fn_setclaimexecutors } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function setClaimExecutors( + address[] _executors +) external payable; +``` + +Sets the addresses of executors. + +If any of the executors is a registered executor, some fee needs to be paid. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executors` | `address[]` | The new executors. All old executors will be deleted and replaced by these. | + +
+
+ +
+ +### `transferExternalToken` { #fn_transferexternaltoken } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function transferExternalToken( + contract IERC20 _token, + uint256 _amount +) external; +``` + +Allows the caller to transfer ERC-20 tokens from their +[PDA](https://docs.flare.network/tech/personal-delegation-account) to the owner account. + +The main use case is to move ERC-20 tokes received by mistake (by an airdrop, for example) out of the PDA +and into the main account, where they can be more easily managed. + +Reverts if the target token is the [`WNat`](./WNat.md) contract: use method [`withdraw`](#fn_withdraw) for that. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_token` | `contract IERC20` | Target token contract address. | +| `_amount` | `uint256` | Amount of tokens to transfer. | + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function undelegateAll( +) external; +``` + +Removes all delegations from the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account). + +
+
+ +
+ +### `undelegateGovernance` { #fn_undelegategovernance } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function undelegateGovernance( +) external; +``` + +Undelegates all [governance](https://docs.flare.network/tech/governance/) vote power currently delegated by +the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account). + +
+
+ +
+ +### `unregisterExecutor` { #fn_unregisterexecutor } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function unregisterExecutor( +) external returns ( + uint256); +``` + +Unregisters the caller as an executor. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID when the change becomes effective. | +
+
+ +
+ +### `updateExecutorFeeValue` { #fn_updateexecutorfeevalue } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function updateExecutorFeeValue( + uint256 _feeValue +) external returns ( + uint256); +``` + +Sets the caller's executor fee. The caller must be an executor registered through [`registerExecutor`](#fn_registerexecutor). + +When called multiple times inside the same reward epoch, only the last value remains. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feeValue` | `uint256` | Desired fee, in wei. Must be between `minFeeValueWei` and `maxFeeValueWei`. 0 means no fee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID when the changes become effective. | +
+
+ +
+ +### `withdraw` { #fn_withdraw } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function withdraw( + uint256 _amount +) external; +``` + +Allows the caller to transfer [`WNat`](./WNat.md) wrapped tokens from their +[PDA](https://docs.flare.network/tech/personal-delegation-account) to the owner account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_amount` | `uint256` | Amount of tokens to transfer, in wei. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IFlareContractRegistry.md b/docs/apis/smart-contracts/IFlareContractRegistry.md new file mode 100644 index 000000000..0190e2fc2 --- /dev/null +++ b/docs/apis/smart-contracts/IFlareContractRegistry.md @@ -0,0 +1,168 @@ +--- +title: IFlareContractRegistry +--- + + + +# `IFlareContractRegistry` { #ct_iflarecontractregistry } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFlareContractRegistry.sol) +
+ +
+ +Interface for the [`FlareContractRegistry`](./FlareContractRegistry.md). + +Entry point for all external dapps that need the latest contract addresses deployed by Flare. + +
+ +
+ +## Functions + +
+ +### `getAllContracts` { #fn_getallcontracts } + +
+Defined in `IFlareContractRegistry` ([Docs](./IFlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFlareContractRegistry.sol)). +
+ +
+ +```solidity +function getAllContracts( +) external view returns ( + string[] _names, + address[] _addresses); +``` + +Returns all contract names and their corresponding addresses. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_names` | `string[]` | Array of contract names. | +| `_addresses` | `address[]` | Array of corresponding contract addresses. | +
+
+ +
+ +### `getContractAddressByHash` { #fn_getcontractaddressbyhash } + +
+Defined in `IFlareContractRegistry` ([Docs](./IFlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFlareContractRegistry.sol)). +
+ +
+ +```solidity +function getContractAddressByHash( + bytes32 _nameHash +) external view returns ( + address); +``` + +Returns the address of a given contract hash. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nameHash` | `bytes32` | Hash of the contract name as: `keccak256(abi.encode(name))`. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of the contract, or `address(0)` if not found. | +
+
+ +
+ +### `getContractAddressByName` { #fn_getcontractaddressbyname } + +
+Defined in `IFlareContractRegistry` ([Docs](./IFlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFlareContractRegistry.sol)). +
+ +
+ +```solidity +function getContractAddressByName( + string _name +) external view returns ( + address); +``` + +Returns the address of a given contract name. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_name` | `string` | Name of the contract. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of the contract, or `address(0)` if not found. | +
+
+ +
+ +### `getContractAddressesByHash` { #fn_getcontractaddressesbyhash } + +
+Defined in `IFlareContractRegistry` ([Docs](./IFlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFlareContractRegistry.sol)). +
+ +
+ +```solidity +function getContractAddressesByHash( + bytes32[] _nameHashes +) external view returns ( + address[]); +``` + +Returns the addresses of a list of contract hashes. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nameHashes` | `bytes32[]` | Array of contract name hashes as: `keccak256(abi.encode(name))`. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the contracts. Any of them might be `address(0)` if not found. | +
+
+ +
+ +### `getContractAddressesByName` { #fn_getcontractaddressesbyname } + +
+Defined in `IFlareContractRegistry` ([Docs](./IFlareContractRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFlareContractRegistry.sol)). +
+ +
+ +```solidity +function getContractAddressesByName( + string[] _names +) external view returns ( + address[]); +``` + +Returns the addresses of a list of contract names. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_names` | `string[]` | Array of contract names. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the contracts. Any of them might be `address(0)` if not found. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IFlareDaemonize.md b/docs/apis/smart-contracts/IFlareDaemonize.md new file mode 100644 index 000000000..2201da7db --- /dev/null +++ b/docs/apis/smart-contracts/IFlareDaemonize.md @@ -0,0 +1,101 @@ +--- +title: IFlareDaemonize +--- + + + +# `IFlareDaemonize` { #ct_iflaredaemonize } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFlareDaemonize.sol) +
+ +
+ +Interface for contracts that receive triggers from the [`FlareDaemon`](./FlareDaemon.md) contract. + +
+ +
+ +## Functions + +
+ +### `daemonize` { #fn_daemonize } + +
+Defined in `IFlareDaemonize` ([Docs](./IFlareDaemonize.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFlareDaemonize.sol)). +
+ +
+ +```solidity +function daemonize( +) external returns ( + bool); +``` + +Implement this function to receive a trigger from the [`FlareDaemon`](./FlareDaemon.md). +The trigger method is called by the validator right at the end of block state transition. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Whether the contract is still active after the call. Currently unused. | +
+
+ +
+ +### `getContractName` { #fn_getcontractname } + +
+Defined in `IFlareDaemonize` ([Docs](./IFlareDaemonize.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFlareDaemonize.sol)). +
+ +
+ +```solidity +function getContractName( +) external view returns ( + string); +``` + +Implement this function to allow updating daemonized contracts through the [`AddressUpdater`](./AddressUpdater.md). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `string` | string Contract name. | +
+
+ +
+ +### `switchToFallbackMode` { #fn_switchtofallbackmode } + +
+Defined in `IFlareDaemonize` ([Docs](./IFlareDaemonize.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFlareDaemonize.sol)). +
+ +
+ +```solidity +function switchToFallbackMode( +) external returns ( + bool); +``` + +This function will be called after an error is caught in [`daemonize`](#fn_daemonize). +It will switch the contract to a simpler fallback mode, which hopefully works when full mode doesn't. +Not every contract needs to support fallback mode ([`FtsoManager`](./FtsoManager.md) does), so this method may be empty. +Switching back to normal mode is left to the contract (typically a governed method call). +This function may be called due to low-gas error, so it shouldn't use more than ~30.000 gas. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | True if switched to fallback mode, false if already in fallback mode or if fallback mode is not supported. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IFtso.md b/docs/apis/smart-contracts/IFtso.md new file mode 100644 index 000000000..a61f83ffa --- /dev/null +++ b/docs/apis/smart-contracts/IFtso.md @@ -0,0 +1,624 @@ +--- +title: IFtso +--- + + + +# `IFtso` { #ct_iftso } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol) +
+ +
+ +Interface for each of the FTSO contracts that handles an asset. +Read the [FTSO documentation page](https://docs.flare.network/tech/ftso/) +for general information about the FTSO system. + +
+ +
+ +## Enums + +
+ +### `PriceFinalizationType` { #en_pricefinalizationtype } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +
+```solidity +enum PriceFinalizationType { + NOT_FINALIZED, + WEIGHTED_MEDIAN, + TRUSTED_ADDRESSES, + PREVIOUS_PRICE_COPIED, + TRUSTED_ADDRESSES_EXCEPTION, + PREVIOUS_PRICE_COPIED_EXCEPTION +} +``` + +How did a price epoch finalize. + +* `NOT_FINALIZED`: The epoch has not been finalized yet. This is the initial state. +* `WEIGHTED_MEDIAN`: The median was used to calculate the final price. + This is the most common state in normal operation. +* `TRUSTED_ADDRESSES`: Due to low turnout, the final price was calculated using only + the median of trusted addresses. +* `PREVIOUS_PRICE_COPIED`: Due to low turnout and absence of votes from trusted addresses, + the final price was copied from the previous epoch. +* `TRUSTED_ADDRESSES_EXCEPTION`: Due to an exception, the final price was calculated + using only the median of trusted addresses. +* `PREVIOUS_PRICE_COPIED_EXCEPTION`: Due to an exception, the final price was copied + from the previous epoch. + +
+ +
+ +
+ +## Events + +
+ +### `LowTurnout` { #ev_lowturnout } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +event LowTurnout( + uint256 epochId, + uint256 natTurnout, + uint256 lowNatTurnoutThresholdBIPS, + uint256 timestamp +) +``` + +Not enough votes were received for this asset during a price epoch that has just ended. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `epochId` | `uint256` | The ID of the epoch. | +| `natTurnout` | `uint256` | Total received vote power, as a percentage of the circulating supply in BIPS. | +| `lowNatTurnoutThresholdBIPS` | `uint256` | Minimum required vote power, as a percentage of the circulating supply in BIPS. The fact that this number is higher than `natTurnout` is what triggered this event. | +| `timestamp` | `uint256` | Timestamp of the block where the price epoch ended. | + +
+
+ +
+ +### `PriceEpochInitializedOnFtso` { #ev_priceepochinitializedonftso } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +event PriceEpochInitializedOnFtso( + uint256 epochId, + uint256 endTime, + uint256 timestamp +) +``` + +All necessary parameters have been set for an epoch and prices can start being _revealed_. +Note that prices can already be _submitted_ immediately after the previous price epoch submit end time is over. + +This event is not emitted in fallback mode (see [`getPriceEpochData`](#fn_getpriceepochdata)). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `epochId` | `uint256` | The ID of the epoch that has just started. | +| `endTime` | `uint256` | Deadline to submit prices, in seconds since UNIX epoch. | +| `timestamp` | `uint256` | Current on-chain timestamp. | + +
+
+ +
+ +### `PriceFinalized` { #ev_pricefinalized } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +event PriceFinalized( + uint256 epochId, + uint256 price, + bool rewardedFtso, + uint256 lowIQRRewardPrice, + uint256 highIQRRewardPrice, + uint256 lowElasticBandRewardPrice, + uint256 highElasticBandRewardPrice, + enum IFtso.PriceFinalizationType finalizationType, + uint256 timestamp +) +``` + +An epoch has ended and the asset price is available. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `epochId` | `uint256` | The ID of the epoch that has just ended. | +| `price` | `uint256` | The asset's price for that epoch. | +| `rewardedFtso` | `bool` | Whether the next 4 parameters contain data. | +| `lowIQRRewardPrice` | `uint256` | Lowest price in the primary (inter-quartile) reward band. | +| `highIQRRewardPrice` | `uint256` | Highest price in the primary (inter-quartile) reward band. | +| `lowElasticBandRewardPrice` | `uint256` | Lowest price in the secondary (elastic) reward band. | +| `highElasticBandRewardPrice` | `uint256` | Highest price in the secondary (elastic) reward band. | +| `finalizationType` | `enum IFtso.PriceFinalizationType` | Reason for the finalization of the epoch. | +| `timestamp` | `uint256` | Timestamp of the block where the price has been finalized. | + +
+
+ +
+ +### `PriceRevealed` { #ev_pricerevealed } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +event PriceRevealed( + address voter, + uint256 epochId, + uint256 price, + uint256 timestamp, + uint256 votePowerNat, + uint256 votePowerAsset +) +``` + +A voter has revealed its price. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `voter` | `address` | The voter. | +| `epochId` | `uint256` | The ID of the epoch for which the price has been revealed. | +| `price` | `uint256` | The revealed price. | +| `timestamp` | `uint256` | Timestamp of the block where the reveal happened. | +| `votePowerNat` | `uint256` | Vote power of the voter in this epoch. This includes the vote power derived from its [`WNat`](./WNat.md) holdings and the delegations. | +| `votePowerAsset` | `uint256` | _Unused_. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `active` { #fn_active } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Returns whether FTSO is [`active`](#fn_active) or not. + +
+
+ +
+ +### `getCurrentEpochId` { #fn_getcurrentepochid } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentEpochId( +) external view returns ( + uint256); +``` + +Returns the current epoch ID. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Currently running epoch ID. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getCurrentPrice` { #fn_getcurrentprice } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPrice( +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Returns the current asset price. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceDetails` { #fn_getcurrentpricedetails } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPriceDetails( +) external view returns ( + uint256 _price, + uint256 _priceTimestamp, + enum IFtso.PriceFinalizationType _priceFinalizationType, + uint256 _lastPriceEpochFinalizationTimestamp, + enum IFtso.PriceFinalizationType _lastPriceEpochFinalizationType); +``` + +Returns asset's current price details. +All timestamps are in seconds from UNIX epoch. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_priceTimestamp` | `uint256` | Time when price was updated for the last time. | +| `_priceFinalizationType` | `enum IFtso.PriceFinalizationType` | Finalization type when price was updated for the last time. | +| `_lastPriceEpochFinalizationTimestamp` | `uint256` | Time when last price epoch was finalized. | +| `_lastPriceEpochFinalizationType` | `enum IFtso.PriceFinalizationType` | Finalization type of last finalized price epoch. | +
+
+ +
+ +### `getCurrentPriceFromTrustedProviders` { #fn_getcurrentpricefromtrustedproviders } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPriceFromTrustedProviders( +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Returns current asset price calculated only using input from trusted providers. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceWithDecimals` { #fn_getcurrentpricewithdecimals } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimals( +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Returns current asset price and number of decimals. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`_assetPriceUsdDecimals`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the USD price. | +
+
+ +
+ +### `getCurrentPriceWithDecimalsFromTrustedProviders` { #fn_getcurrentpricewithdecimalsfromtrustedproviders } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimalsFromTrustedProviders( +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Returns current asset price calculated only using input from trusted providers and number of decimals. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the USD price. | +
+
+ +
+ +### `getCurrentRandom` { #fn_getcurrentrandom } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentRandom( +) external view returns ( + uint256); +``` + +Returns the random number for the previous price epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +
+
+ +
+ +### `getEpochId` { #fn_getepochid } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getEpochId( + uint256 _timestamp +) external view returns ( + uint256); +``` + +Returns the ID of the epoch that was opened for price submission at the specified timestamp. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_timestamp` | `uint256` | Queried timestamp in seconds from UNIX epoch. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Epoch ID corresponding to that timestamp. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getEpochPrice` { #fn_getepochprice } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getEpochPrice( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns agreed asset price in the specified epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch. Only the last 200 epochs can be queried. Out-of-bounds queries revert. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +
+
+ +
+ +### `getEpochPriceForVoter` { #fn_getepochpriceforvoter } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getEpochPriceForVoter( + uint256 _epochId, + address _voter +) external view returns ( + uint256); +``` + +Returns asset price submitted by a voter in the specified epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch being queried. Only the last 200 epochs can be queried. Out-of-bounds queries revert. | +| `_voter` | `address` | Address of the voter being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +
+
+ +
+ +### `getPriceEpochConfiguration` { #fn_getpriceepochconfiguration } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getPriceEpochConfiguration( +) external view returns ( + uint256 _firstEpochStartTs, + uint256 _submitPeriodSeconds, + uint256 _revealPeriodSeconds); +``` + +Returns current epoch's configuration. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstEpochStartTs` | `uint256` | First epoch start timestamp in seconds from UNIX epoch. | +| `_submitPeriodSeconds` | `uint256` | Submit period in seconds. | +| `_revealPeriodSeconds` | `uint256` | Reveal period in seconds. | +
+
+ +
+ +### `getPriceEpochData` { #fn_getpriceepochdata } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getPriceEpochData( +) external view returns ( + uint256 _epochId, + uint256 _epochSubmitEndTime, + uint256 _epochRevealEndTime, + uint256 _votePowerBlock, + bool _fallbackMode); +``` + +Returns current epoch data. +Intervals are open on the right: End times are not included. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_epochId` | `uint256` | Current epoch ID. | +| `_epochSubmitEndTime` | `uint256` | End time of the price submission window in seconds from UNIX epoch. | +| `_epochRevealEndTime` | `uint256` | End time of the price reveal window in seconds from UNIX epoch. | +| `_votePowerBlock` | `uint256` | Vote power block for the current epoch. | +| `_fallbackMode` | `bool` | Whether the current epoch is in fallback mode. Only votes from trusted addresses are used in this mode. | +
+
+ +
+ +### `getRandom` { #fn_getrandom } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getRandom( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns the random number used in a specific past epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the queried epoch. Current epoch cannot be queried, and the previous epoch is constantly updated as data providers reveal their prices and random numbers. Only the last 50 epochs can be queried and there is no bounds checking for this parameter. Out-of-bounds queries return undefined values. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The random number used in that epoch. | +
+
+ +
+ +### `symbol` { #fn_symbol } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function symbol( +) external view returns ( + string); +``` + +Returns the FTSO [`symbol`](#fn_symbol). + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IFtsoGenesis.md b/docs/apis/smart-contracts/IFtsoGenesis.md new file mode 100644 index 000000000..7a93e4d4e --- /dev/null +++ b/docs/apis/smart-contracts/IFtsoGenesis.md @@ -0,0 +1,87 @@ +--- +title: IFtsoGenesis +--- + + + +# `IFtsoGenesis` { #ct_iftsogenesis } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoGenesis.sol) +
+ +
+ +Portion of the [`IFtso`](./IFtso.md) interface that is available to contracts deployed at genesis. + +
+ +
+ +## Functions + +
+ +### `revealPriceSubmitter` { #fn_revealpricesubmitter } + +
+Defined in `IFtsoGenesis` ([Docs](./IFtsoGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoGenesis.sol)). +
+ +
+ +```solidity +function revealPriceSubmitter( + address _voter, + uint256 _epochId, + uint256 _price, + uint256 _voterWNatVP +) external; +``` + +Reveals the price submitted by a voter on a specific epoch. +The hash of _price and _random must be equal to the submitted hash + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Voter address. | +| `_epochId` | `uint256` | ID of the epoch in which the price hash was submitted. | +| `_price` | `uint256` | Submitted price. | +| `_voterWNatVP` | `uint256` | Voter's vote power in [`WNat`](./WNat.md) units. | + +
+
+ +
+ +### `wNatVotePowerCached` { #fn_wnatvotepowercached } + +
+Defined in `IFtsoGenesis` ([Docs](./IFtsoGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoGenesis.sol)). +
+ +
+ +```solidity +function wNatVotePowerCached( + address _voter, + uint256 _epochId +) external returns ( + uint256); +``` + +Get and cache the vote power of a voter on a specific epoch, in [`WNat`](./WNat.md) units. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Voter address. | +| `_epochId` | `uint256` | ID of the epoch in which the price hash was submitted. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Voter's vote power in [`WNat`](./WNat.md) units. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IFtsoManager.md b/docs/apis/smart-contracts/IFtsoManager.md new file mode 100644 index 000000000..2e5964389 --- /dev/null +++ b/docs/apis/smart-contracts/IFtsoManager.md @@ -0,0 +1,593 @@ +--- +title: IFtsoManager +--- + + + +# `IFtsoManager` { #ct_iftsomanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol) | Inherits from [IFtsoManagerGenesis](./IFtsoManagerGenesis.md) +
+ +
+ +Interface for the [`FtsoManager`](./FtsoManager.md) contract. + +
+ +
+ +## Events + +
+ +### `AccruingUnearnedRewardsFailed` { #ev_accruingunearnedrewardsfailed } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event AccruingUnearnedRewardsFailed( + uint256 epochId +) +``` + +Unexpected failure while accruing unearned rewards. +This should be a rare occurrence. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `epochId` | `uint256` | Epoch ID of the failure. | + +
+
+ +
+ +### `DistributingRewardsFailed` { #ev_distributingrewardsfailed } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event DistributingRewardsFailed( + address ftso, + uint256 epochId +) +``` + +Unexpected failure while distributing rewards. +This should be a rare occurrence. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `address` | Contract address of the FTSO where the failure happened. | +| `epochId` | `uint256` | Epoch ID of the failure. | + +
+
+ +
+ +### `FallbackMode` { #ev_fallbackmode } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event FallbackMode( + bool fallbackMode +) +``` + +Emitted when the fallback mode of the FTSO manager changes its state. +Fallback mode is a recovery mode, where only data from a trusted subset of FTSO +data providers is used to calculate the final price. + +The FTSO Manager enters the fallback mode when ALL FTSOs are in fallback mode. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `fallbackMode` | `bool` | New state of the FTSO Manager fallback mode. | + +
+
+ +
+ +### `FinalizingPriceEpochFailed` { #ev_finalizingpriceepochfailed } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event FinalizingPriceEpochFailed( + contract IIFtso ftso, + uint256 epochId, + enum IFtso.PriceFinalizationType failingType +) +``` + +Unexpected failure while finalizing a price epoch. +This should be a rare occurrence. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `contract IIFtso` | Contract address of the FTSO where the failure happened. | +| `epochId` | `uint256` | Epoch ID of the failure. | +| `failingType` | `enum IFtso.PriceFinalizationType` | How was the epoch finalized. | + +
+
+ +
+ +### `FtsoAdded` { #ev_ftsoadded } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event FtsoAdded( + contract IIFtso ftso, + bool add +) +``` + +Emitted when a new FTSO has been added or an existing one has been removed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `contract IIFtso` | Contract address of the FTSO. | +| `add` | `bool` | True if added, removed otherwise. | + +
+
+ +
+ +### `FtsoFallbackMode` { #ev_ftsofallbackmode } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event FtsoFallbackMode( + contract IIFtso ftso, + bool fallbackMode +) +``` + +Emitted when the fallback mode of an FTSO changes its state. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `contract IIFtso` | Contract address of the FTSO. | +| `fallbackMode` | `bool` | New state of its fallback mode. | + +
+
+ +
+ +### `InitializingCurrentEpochStateForRevealFailed` { #ev_initializingcurrentepochstateforrevealfailed } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event InitializingCurrentEpochStateForRevealFailed( + contract IIFtso ftso, + uint256 epochId +) +``` + +Unexpected failure while initializing a price epoch. +This should be a rare occurrence. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `contract IIFtso` | Contract address of the FTSO where the failure happened. | +| `epochId` | `uint256` | Epoch ID that failed initialization. | + +
+
+ +
+ +### `PriceEpochFinalized` { #ev_priceepochfinalized } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event PriceEpochFinalized( + address chosenFtso, + uint256 rewardEpochId +) +``` + +Emitted when a [price epoch](https://docs.flare.network/tech/ftso/#procedure-overview) ends, this is, +after the reveal phase, when final prices are calculated. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `chosenFtso` | `address` | Contract address of the FTSO asset that was randomly chosen to be the basis for reward calculation. On this price epoch, rewards will be calculated based on how close each data provider was to the median of all submitted prices FOR THIS FTSO. | +| `rewardEpochId` | `uint256` | Reward epoch ID this price epoch belongs to. | + +
+
+ +
+ +### `RewardEpochFinalized` { #ev_rewardepochfinalized } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event RewardEpochFinalized( + uint256 votepowerBlock, + uint256 startBlock +) +``` + +Emitted when a [reward epoch](https://docs.flare.network/tech/ftso/#procedure-overview) +ends and rewards are available. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `votepowerBlock` | `uint256` | The [vote power block](https://docs.flare.network/tech/ftso/#vote-power) of the epoch. | +| `startBlock` | `uint256` | The first block of the epoch. | + +
+
+ +
+ +### `UseGoodRandomSet` { #ev_usegoodrandomset } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event UseGoodRandomSet( + bool useGoodRandom, + uint256 maxWaitForGoodRandomSeconds +) +``` + +Emitted when the requirement to provide good random numbers has changed. + +As part of [the FTSO protocol](https://docs.flare.network/tech/ftso/#data-submission-process), +data providers must submit a random number along with their price reveals. +When good random numbers are enforced, all providers that submit a hash must then +submit a reveal with a random number or they will be punished. +This is a measure against random number manipulation. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `useGoodRandom` | `bool` | Whether good random numbers are now enforced or not. | +| `maxWaitForGoodRandomSeconds` | `uint256` | Max number of seconds to wait for a good random number to be submitted. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `active` { #fn_active } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Returns whether the FTSO Manager is [`active`](#fn_active) or not. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Active status. | +
+
+ +
+ +### `getCurrentPriceEpochData` { #fn_getcurrentpriceepochdata } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getCurrentPriceEpochData( +) external view returns ( + uint256 _priceEpochId, + uint256 _priceEpochStartTimestamp, + uint256 _priceEpochEndTimestamp, + uint256 _priceEpochRevealEndTimestamp, + uint256 _currentTimestamp); +``` + +Returns timing information for the current price epoch. +All intervals are half-closed: end time is not included. +All timestamps are in seconds since UNIX epoch. + +See the [FTSO page](https://docs.flare.network/tech/ftso/#data-submission-process) +for information about the different submission phases. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_priceEpochId` | `uint256` | Price epoch ID. | +| `_priceEpochStartTimestamp` | `uint256` | Beginning of the commit phase. | +| `_priceEpochEndTimestamp` | `uint256` | End of the commit phase. | +| `_priceEpochRevealEndTimestamp` | `uint256` | End of the reveal phase. | +| `_currentTimestamp` | `uint256` | Current time. | +
+
+ +
+ +### `getCurrentPriceEpochId` { #fn_getcurrentpriceepochid } + +
+Defined in `IFtsoManagerGenesis` ([Docs](./IFtsoManagerGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoManagerGenesis.sol)). +
+ +
+ +```solidity +function getCurrentPriceEpochId( +) external view returns ( + uint256 _priceEpochId); +``` + +Returns current price epoch ID. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_priceEpochId` | `uint256` | Currently running epoch ID. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getCurrentRewardEpoch` { #fn_getcurrentrewardepoch } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getCurrentRewardEpoch( +) external view returns ( + uint256); +``` + +Returns current reward epoch ID (the one currently running). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID. A monotonically increasing integer. | +
+
+ +
+ +### `getFallbackMode` { #fn_getfallbackmode } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getFallbackMode( +) external view returns ( + bool _fallbackMode, + contract IIFtso[] _ftsos, + bool[] _ftsoInFallbackMode); +``` + +Returns whether the FTSO Manager is currently in fallback mode. + +In this mode only submissions from trusted providers are used. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_fallbackMode` | `bool` | True if fallback mode is enabled for the manager. | +| `_ftsos` | `contract IIFtso[]` | Array of all currently active FTSO assets. | +| `_ftsoInFallbackMode` | `bool[]` | Boolean array indicating which FTSO assets are in fallback mode. If the FTSO Manager is in fallback mode then ALL FTSOs are in fallback mode. | +
+
+ +
+ +### `getFtsos` { #fn_getftsos } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getFtsos( +) external view returns ( + contract IIFtso[] _ftsos); +``` + +Returns the list of currently [`active`](#fn_active) FTSOs. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of contract addresses for the FTSOs. | +
+
+ +
+ +### `getPriceEpochConfiguration` { #fn_getpriceepochconfiguration } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getPriceEpochConfiguration( +) external view returns ( + uint256 _firstPriceEpochStartTs, + uint256 _priceEpochDurationSeconds, + uint256 _revealEpochDurationSeconds); +``` + +Returns the current values for price epoch timing configuration. + +See the [FTSO page](https://docs.flare.network/tech/ftso/#data-submission-process) +for information about the different submission phases. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstPriceEpochStartTs` | `uint256` | Timestamp, in seconds since UNIX epoch, of the first price epoch. | +| `_priceEpochDurationSeconds` | `uint256` | Duration in seconds of the commit phase. | +| `_revealEpochDurationSeconds` | `uint256` | Duration in seconds of the reveal phase. | +
+
+ +
+ +### `getRewardEpochConfiguration` { #fn_getrewardepochconfiguration } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochConfiguration( +) external view returns ( + uint256 _firstRewardEpochStartTs, + uint256 _rewardEpochDurationSeconds); +``` + +Returns the current values for reward epoch timing configuration. + +See the [Reward epochs](https://docs.flare.network/tech/ftso/#vote-power) box. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstRewardEpochStartTs` | `uint256` | Timestamp, in seconds since UNIX epoch, of the first reward epoch. | +| `_rewardEpochDurationSeconds` | `uint256` | Duration in seconds of the reward epochs. | +
+
+ +
+ +### `getRewardEpochToExpireNext` { #fn_getrewardepochtoexpirenext } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochToExpireNext( +) external view returns ( + uint256); +``` + +Return reward epoch that will expire next, when a new reward epoch is initialized. + +Reward epochs older than 90 days expire, and any unclaimed rewards in them become +inaccessible. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Reward epoch ID. | +
+
+ +
+ +### `getRewardEpochVotePowerBlock` { #fn_getrewardepochvotepowerblock } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochVotePowerBlock( + uint256 _rewardEpoch +) external view returns ( + uint256); +``` + +Returns the [vote power block](https://docs.flare.network/tech/ftso/#vote-power) +that was used for a past reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | The queried reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 The block number of that reward epoch's vote power block. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IFtsoManagerGenesis.md b/docs/apis/smart-contracts/IFtsoManagerGenesis.md new file mode 100644 index 000000000..c4f6c7735 --- /dev/null +++ b/docs/apis/smart-contracts/IFtsoManagerGenesis.md @@ -0,0 +1,48 @@ +--- +title: IFtsoManagerGenesis +--- + + + +# `IFtsoManagerGenesis` { #ct_iftsomanagergenesis } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoManagerGenesis.sol) +
+ +
+ +Portion of the [`IFtsoManager`](./IFtsoManager.md) interface that is available to contracts deployed at genesis. + +
+ +
+ +## Functions + +
+ +### `getCurrentPriceEpochId` { #fn_getcurrentpriceepochid } + +
+Defined in `IFtsoManagerGenesis` ([Docs](./IFtsoManagerGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoManagerGenesis.sol)). +
+ +
+ +```solidity +function getCurrentPriceEpochId( +) external view returns ( + uint256 _priceEpochId); +``` + +Returns current price epoch ID. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_priceEpochId` | `uint256` | Currently running epoch ID. IDs are consecutive numbers starting from zero. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IFtsoRegistry.md b/docs/apis/smart-contracts/IFtsoRegistry.md new file mode 100644 index 000000000..d919ebb14 --- /dev/null +++ b/docs/apis/smart-contracts/IFtsoRegistry.md @@ -0,0 +1,541 @@ +--- +title: IFtsoRegistry +--- + + + +# `IFtsoRegistry` { #ct_iftsoregistry } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol) | Inherits from [IFtsoRegistryGenesis](./IFtsoRegistryGenesis.md) +
+ +
+ +Interface for the [`FtsoRegistry`](./FtsoRegistry.md) contract. + +
+ +
+ +## Functions + +
+ +### `getAllCurrentPrices` { #fn_getallcurrentprices } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getAllCurrentPrices( +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of all supported assets. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getCurrentPrice` { #fn_getcurrentprice } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPrice( + uint256 _ftsoIndex +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Public view function to get the current price of a given active FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Current price of the asset in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Timestamp for when this price was updated, in seconds since UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceWithDecimals` { #fn_getcurrentpricewithdecimals } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimals( + uint256 _assetIndex +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Public view function to get the current price and decimals of a given active FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetIndex` | `uint256` | Index to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Current price of the asset in USD multiplied by 10^`_assetPriceUsdDecimals`. | +| `_timestamp` | `uint256` | Timestamp for when this price was updated, in seconds since UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the `_price`. | +
+
+ +
+ +### `getCurrentPricesByIndices` { #fn_getcurrentpricesbyindices } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPricesByIndices( + uint256[] _indices +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of a list of indices. +Reverts if any of the indices is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_indices` | `uint256[]` | Array of indices to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getCurrentPricesBySymbols` { #fn_getcurrentpricesbysymbols } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPricesBySymbols( + string[] _symbols +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of a list of asset symbols. +Reverts if any of the symbols is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbols` | `string[]` | Array of symbols to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getFtso` { #fn_getftso } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtso( + uint256 _activeFtso +) external view returns ( + contract IIFtso _activeFtsoAddress); +``` + +Returns the address of the FTSO contract for a given index. +Reverts if unsupported index is passed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_activeFtso` | `uint256` | The queried index. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_activeFtsoAddress` | `contract IIFtso` | FTSO contract address for the queried index. | +
+
+ +
+ +### `getFtsoBySymbol` { #fn_getftsobysymbol } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoBySymbol( + string _symbol +) external view returns ( + contract IIFtso _activeFtsoAddress); +``` + +Returns the address of the FTSO contract for a given symbol. +Reverts if unsupported symbol is passed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | The queried symbol. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_activeFtsoAddress` | `contract IIFtso` | FTSO contract address for the queried symbol. | +
+
+ +
+ +### `getFtsoIndex` { #fn_getftsoindex } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoIndex( + string _symbol +) external view returns ( + uint256 _assetIndex); +``` + +Returns the FTSO index corresponding to a given asset symbol. +Reverts if the symbol is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | Symbol to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_assetIndex` | `uint256` | The corresponding asset index. | +
+
+ +
+ +### `getFtsoSymbol` { #fn_getftsosymbol } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoSymbol( + uint256 _ftsoIndex +) external view returns ( + string _symbol); +``` + +Returns the asset symbol corresponding to a given FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_symbol` | `string` | The corresponding asset symbol. | +
+
+ +
+ +### `getFtsos` { #fn_getftsos } + +
+Defined in `IFtsoRegistryGenesis` ([Docs](./IFtsoRegistryGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoRegistryGenesis.sol)). +
+ +
+ +```solidity +function getFtsos( + uint256[] _indices +) external view returns ( + contract IFtsoGenesis[] _ftsos); +``` + +Get the addresses of the active FTSOs at the given indices. +Reverts if any of the provided indices is non-existing or inactive. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_indices` | `uint256[]` | Array of FTSO indices to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IFtsoGenesis[]` | The array of FTSO addresses. | +
+
+ +
+ +### `getSupportedFtsos` { #fn_getsupportedftsos } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedFtsos( +) external view returns ( + contract IIFtso[] _ftsos); +``` + +Get array of all FTSO contracts for all supported asset indices. +The index of FTSO in returned array does not necessarily correspond to the asset's index. +Due to deletion, some indices might be unsupported. + +Use [`getSupportedIndicesAndFtsos`](#fn_getsupportedindicesandftsos) to retrieve pairs of correct indices and FTSOs, +where possible "null" holes are readily apparent. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSOs. | +
+
+ +
+ +### `getSupportedIndices` { #fn_getsupportedindices } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndices( +) external view returns ( + uint256[] _supportedIndices); +``` + +Returns the indices of the currently supported FTSOs. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all active FTSO indices in increasing order. | +
+
+ +
+ +### `getSupportedIndicesAndFtsos` { #fn_getsupportedindicesandftsos } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesAndFtsos( +) external view returns ( + uint256[] _supportedIndices, + contract IIFtso[] _ftsos); +``` + +Get all supported indices and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +### `getSupportedIndicesAndSymbols` { #fn_getsupportedindicesandsymbols } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesAndSymbols( +) external view returns ( + uint256[] _supportedIndices, + string[] _supportedSymbols); +``` + +Get all supported indices and corresponding symbols. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +
+
+ +
+ +### `getSupportedIndicesSymbolsAndFtsos` { #fn_getsupportedindicessymbolsandftsos } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesSymbolsAndFtsos( +) external view returns ( + uint256[] _supportedIndices, + string[] _supportedSymbols, + contract IIFtso[] _ftsos); +``` + +Get all supported indices, symbols, and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +### `getSupportedSymbols` { #fn_getsupportedsymbols } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedSymbols( +) external view returns ( + string[] _supportedSymbols); +``` + +Returns the symbols of the currently supported FTSOs. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedSymbols` | `string[]` | Array of all active FTSO symbols in increasing order. | +
+
+ +
+ +### `getSupportedSymbolsAndFtsos` { #fn_getsupportedsymbolsandftsos } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedSymbolsAndFtsos( +) external view returns ( + string[] _supportedSymbols, + contract IIFtso[] _ftsos); +``` + +Get all supported symbols and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +
+ +## Structures + +
+ +### `PriceInfo` { #st_priceinfo } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +
+```solidity +struct PriceInfo { + uint256 ftsoIndex; + uint256 price; + uint256 decimals; + uint256 timestamp; +} +``` + +
+ +
+ diff --git a/docs/apis/smart-contracts/IFtsoRegistryGenesis.md b/docs/apis/smart-contracts/IFtsoRegistryGenesis.md new file mode 100644 index 000000000..293960f5a --- /dev/null +++ b/docs/apis/smart-contracts/IFtsoRegistryGenesis.md @@ -0,0 +1,54 @@ +--- +title: IFtsoRegistryGenesis +--- + + + +# `IFtsoRegistryGenesis` { #ct_iftsoregistrygenesis } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoRegistryGenesis.sol) +
+ +
+ +Portion of the [`IFtsoRegistry`](./IFtsoRegistry.md) interface that is available to contracts deployed at genesis. + +
+ +
+ +## Functions + +
+ +### `getFtsos` { #fn_getftsos } + +
+Defined in `IFtsoRegistryGenesis` ([Docs](./IFtsoRegistryGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoRegistryGenesis.sol)). +
+ +
+ +```solidity +function getFtsos( + uint256[] _indices +) external view returns ( + contract IFtsoGenesis[] _ftsos); +``` + +Get the addresses of the active FTSOs at the given indices. +Reverts if any of the provided indices is non-existing or inactive. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_indices` | `uint256[]` | Array of FTSO indices to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IFtsoGenesis[]` | The array of FTSO addresses. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IFtsoRewardManager.md b/docs/apis/smart-contracts/IFtsoRewardManager.md new file mode 100644 index 000000000..cf3d15ac1 --- /dev/null +++ b/docs/apis/smart-contracts/IFtsoRewardManager.md @@ -0,0 +1,968 @@ +--- +title: IFtsoRewardManager +--- + + + +# `IFtsoRewardManager` { #ct_iftsorewardmanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol) +
+ +
+ +Interface for the [`FtsoRewardManager`](./FtsoRewardManager.md) contract. + +
+ +
+ +## Events + +
+ +### `FeePercentageChanged` { #ev_feepercentagechanged } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event FeePercentageChanged( + address dataProvider, + uint256 value, + uint256 validFromEpoch +) +``` + +Emitted when a data provider changes its fee. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `dataProvider` | `address` | Address of the data provider. | +| `value` | `uint256` | New fee, in BIPS. | +| `validFromEpoch` | `uint256` | Epoch ID where the new fee takes effect. | + +
+
+ +
+ +### `FtsoRewardManagerActivated` { #ev_ftsorewardmanageractivated } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event FtsoRewardManagerActivated( + address ftsoRewardManager +) +``` + +Emitted when the reward manager contract is activated. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftsoRewardManager` | `address` | The reward manager contract. | + +
+
+ +
+ +### `FtsoRewardManagerDeactivated` { #ev_ftsorewardmanagerdeactivated } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event FtsoRewardManagerDeactivated( + address ftsoRewardManager +) +``` + +Emitted when the reward manager contract is deactivated. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftsoRewardManager` | `address` | The reward manager contract. | + +
+
+ +
+ +### `RewardClaimed` { #ev_rewardclaimed } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardClaimed( + address dataProvider, + address whoClaimed, + address sentTo, + uint256 rewardEpoch, + uint256 amount +) +``` + +Emitted when a data provider claims its FTSO rewards. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `dataProvider` | `address` | Address of the data provider that accrued the reward. | +| `whoClaimed` | `address` | Address that actually performed the claim. | +| `sentTo` | `address` | Address that received the reward. | +| `rewardEpoch` | `uint256` | ID of the reward epoch where the reward was accrued. | +| `amount` | `uint256` | Amount of rewarded native tokens (wei). | + +
+
+ +
+ +### `RewardClaimsEnabled` { #ev_rewardclaimsenabled } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardClaimsEnabled( + uint256 rewardEpochId +) +``` + +Emitted when reward claims have been enabled. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `rewardEpochId` | `uint256` | First claimable reward epoch. | + +
+
+ +
+ +### `RewardClaimsExpired` { #ev_rewardclaimsexpired } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardClaimsExpired( + uint256 rewardEpochId +) +``` + +Unclaimed rewards have expired and are now inaccessible. + +`getUnclaimedReward()` can be used to retrieve more information. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `rewardEpochId` | `uint256` | ID of the reward epoch that has just expired. | + +
+
+ +
+ +### `RewardsDistributed` { #ev_rewardsdistributed } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardsDistributed( + address ftso, + uint256 epochId, + address[] addresses, + uint256[] rewards +) +``` + +Emitted every price epoch, when rewards have been distributed to each contributing data provider. +Note that rewards are not claimable until the reward epoch finishes. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `address` | Address of the FTSO that generated the rewards. | +| `epochId` | `uint256` | ID of the reward epoch where the rewards were accrued. | +| `addresses` | `address[]` | Data provider addresses that have rewards to claim. | +| `rewards` | `uint256[]` | Amounts available for claiming (wei). | + +
+
+ +
+ +### `UnearnedRewardsAccrued` { #ev_unearnedrewardsaccrued } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event UnearnedRewardsAccrued( + uint256 epochId, + uint256 reward +) +``` + +Emitted when rewards cannot be distributed during a reward epoch +(for example, because the FTSO went into fallback mode) and they are accrued +for later burning. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `epochId` | `uint256` | ID of the reward epoch where the reward was accrued. | +| `reward` | `uint256` | Total amount of accrued rewards (wei). | + +
+
+ +
+ +
+ +## Functions + +
+ +### `active` { #fn_active } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Whether rewards can be claimed from this reward manager. + +
+
+ +
+ +### `autoClaim` { #fn_autoclaim } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function autoClaim( + address[] _rewardOwners, + uint256 _rewardEpoch +) external; +``` + +Allows claiming rewards simultaneously for a list of reward owners and all unclaimed epochs before the +specified one. + +This is meant as a convenience all-in-one reward claiming method to be used both by reward owners and +[registered executors](https://docs.flare.network/tech/automatic-claiming/#registered-claiming-process). +It performs a series of operations, besides claiming rewards: + +* If a reward owner has enabled its +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account), rewards are also +claimed for the PDA and the total claimed amount is sent to that PDA. +Otherwise, the claimed amount is sent to the reward owner's account. + +* Claimed amount is automatically wrapped through the [`WNat`](./WNat.md) contract. + +* If the caller is a registered executor with a non-zero fee, the fee is paid to the executor for each claimed +address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwners` | `address[]` | List of reward owners to claim for. | +| `_rewardEpoch` | `uint256` | Last reward epoch ID to claim for. All previous epochs with pending rewards will be claimed too. | + +
+
+ +
+ +### `claim` { #fn_claim } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function claim( + address _rewardOwner, + address payable _recipient, + uint256 _rewardEpoch, + bool _wrap +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards for a reward owner. +The caller does not have to be the owner of the rewards, but must be approved by the owner to [`claim`](#fn_claim) on his +behalf by using `setClaimExecutors` on the `claimSetupManager`. + +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by percentage. +Reverts if `msg.sender` is delegating by amount. + +Anybody can call this method, but rewards can only be sent to the reward owner, therefore no funds can be +stolen. However, by limiting the authorized callers, the owner can control the timing of the calls. + +When the reward owner is the caller, rewards can be sent to any recipient set by `setAllowedClaimRecipients` on +the `claimSetupManager`. +The reward owner's [Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) +is always an authorized recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner. | +| `_recipient` | `address payable` | Address to transfer claimed rewards to. | +| `_rewardEpoch` | `uint256` | Last reward epoch to claim for. All previous epochs with pending rewards will be claimed too. | +| `_wrap` | `bool` | Whether claimed rewards should be wrapped through the [`WNat`](./WNat.md) contract before transferring them to the `_recipient`. This parameter is offered as a convenience. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `claimFromDataProviders` { #fn_claimfromdataproviders } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimFromDataProviders( + address _rewardOwner, + address payable _recipient, + uint256[] _rewardEpochs, + address[] _dataProviders, + bool _wrap +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards for a reward owner from specific data providers. +The caller does not have to be the owner of the rewards, but must be approved by the owner to [`claim`](#fn_claim) on his +behalf by using `setClaimExecutors` on the `claimSetupManager`. + +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by amount (explicit delegation). +Reverts if `msg.sender` is delegating by percentage. + +Anybody can call this method, but rewards can only be sent to the reward owner, therefore no funds can be +stolen. However, by limiting the authorized callers, the owner can control the timing of the calls. + +When the reward owner is the caller, rewards can be sent to any recipient set by `setAllowedClaimRecipients` on +the `claimSetupManager`. +The reward owner's [Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) +is always an authorized recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner. | +| `_recipient` | `address payable` | Address to transfer claimed rewards to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch IDs to claim for. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to claim the reward from. | +| `_wrap` | `bool` | Whether claimed rewards should be wrapped through the [`WNat`](./WNat.md) contract before transferring them to the `_recipient`. This parameter is offered as a convenience. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `claimReward` { #fn_claimreward } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimReward( + address payable _recipient, + uint256[] _rewardEpochs +) external returns ( + uint256 _rewardAmount); +``` + +Allows a percentage delegator to [`claim`](#fn_claim) rewards. +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by percentage. + +**This function is deprecated**: use [`claim`](#fn_claim) instead. + +Reverts if `msg.sender` is delegating by amount. +Claims for all unclaimed reward epochs to the 'max(_rewardEpochs)'. +Retained for backward compatibility. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipient` | `address payable` | Address to transfer funds to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch numbers to claim for. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Amount of total claimed rewards (wei). | +
+
+ +
+ +### `claimRewardFromDataProviders` { #fn_claimrewardfromdataproviders } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimRewardFromDataProviders( + address payable _recipient, + uint256[] _rewardEpochs, + address[] _dataProviders +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards from specific data providers. +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by amount. + +**This function is deprecated**: use [`claimFromDataProviders`](#fn_claimfromdataproviders) instead. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipient` | `address payable` | Address to transfer funds to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch numbers to claim for. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to claim the reward from. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `getClaimedReward` { #fn_getclaimedreward } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getClaimedReward( + uint256 _rewardEpoch, + address _dataProvider, + address _claimer +) external view returns ( + bool _claimed, + uint256 _amount); +``` + +Returns information on the rewards accrued by a reward owner from a specific data provider at a specific +reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | +| `_dataProvider` | `address` | Address of the data provider to query. | +| `_claimer` | `address` | Address of the reward owner to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_claimed` | `bool` | Whether the reward has been claimed or not. | +| `_amount` | `uint256` | Accrued amount in wei. | +
+
+ +
+ +### `getCurrentRewardEpoch` { #fn_getcurrentrewardepoch } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getCurrentRewardEpoch( +) external view returns ( + uint256); +``` + +Returns the current reward epoch ID. + +
+
+ +
+ +### `getDataProviderCurrentFeePercentage` { #fn_getdataprovidercurrentfeepercentage } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderCurrentFeePercentage( + address _dataProvider +) external view returns ( + uint256 _feePercentageBIPS); +``` + +Returns the current [fee](https://docs.flare.network/tech/ftso/#rewards) percentage of a data provider. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256` | Fee percentage in BIPS. | +
+
+ +
+ +### `getDataProviderFeePercentage` { #fn_getdataproviderfeepercentage } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderFeePercentage( + address _dataProvider, + uint256 _rewardEpoch +) external view returns ( + uint256 _feePercentageBIPS); +``` + +Returns the [fee](https://docs.flare.network/tech/ftso/#rewards) percentage of a data provider at a +given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256` | Fee percentage in BIPS. | +
+
+ +
+ +### `getDataProviderPerformanceInfo` { #fn_getdataproviderperformanceinfo } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderPerformanceInfo( + uint256 _rewardEpoch, + address _dataProvider +) external view returns ( + uint256 _rewardAmount, + uint256 _votePowerIgnoringRevocation); +``` + +Returns information on rewards and vote power of a data provider at a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | +| `_dataProvider` | `address` | Address of the data provider to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Amount of rewards (wei). | +| `_votePowerIgnoringRevocation` | `uint256` | Vote power, not including revocations. | +
+
+ +
+ +### `getDataProviderScheduledFeePercentageChanges` { #fn_getdataproviderscheduledfeepercentagechanges } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderScheduledFeePercentageChanges( + address _dataProvider +) external view returns ( + uint256[] _feePercentageBIPS, + uint256[] _validFromEpoch, + bool[] _fixed); +``` + +Returns the scheduled [fee](https://docs.flare.network/tech/ftso/#rewards) percentage changes for a data +provider. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256[]` | Array of fee percentages in BIPS. | +| `_validFromEpoch` | `uint256[]` | Array of block numbers from which the fee settings are effective. | +| `_fixed` | `bool[]` | Array of boolean values indicating whether settings are subject to change or not. | +
+
+ +
+ +### `getEpochReward` { #fn_getepochreward } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochReward( + uint256 _rewardEpoch +) external view returns ( + uint256 _totalReward, + uint256 _claimedReward); +``` + +Returns information on an epoch's rewards. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_totalReward` | `uint256` | Total amount of rewards accrued on that epoch, in wei. | +| `_claimedReward` | `uint256` | Total amount of rewards that have already been claimed, in wei. | +
+
+ +
+ +### `getEpochsWithClaimableRewards` { #fn_getepochswithclaimablerewards } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochsWithClaimableRewards( +) external view returns ( + uint256 _startEpochId, + uint256 _endEpochId); +``` + +Returns the reward epoch range for which rewards can be claimed. +Rewards outside this range are unclaimable, either because they have expired or because the reward epoch is +still ongoing. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_startEpochId` | `uint256` | The oldest epoch ID that allows reward claiming. | +| `_endEpochId` | `uint256` | The newest epoch ID that allows reward claiming. | +
+
+ +
+ +### `getEpochsWithUnclaimedRewards` { #fn_getepochswithunclaimedrewards } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochsWithUnclaimedRewards( + address _beneficiary +) external view returns ( + uint256[] _epochIds); +``` + +Returns the array of claimable epoch IDs for which the rewards of a reward owner have not yet been claimed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of the reward owner to query. Reverts if it uses delegation by amount. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_epochIds` | `uint256[]` | Array of epoch IDs. | +
+
+ +
+ +### `getInitialRewardEpoch` { #fn_getinitialrewardepoch } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getInitialRewardEpoch( +) external view returns ( + uint256); +``` + +Returns the initial reward epoch ID for this reward manager contract. +This corresponds to the oldest reward epoch with claimable rewards in the previous reward manager when this +one took over. +Set by governance through `setInitialRewardData`. + +
+
+ +
+ +### `getRewardEpochToExpireNext` { #fn_getrewardepochtoexpirenext } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getRewardEpochToExpireNext( +) external view returns ( + uint256); +``` + +Returns the reward epoch that will expire next once a new reward epoch starts. + +
+
+ +
+ +### `getRewardEpochVotePowerBlock` { #fn_getrewardepochvotepowerblock } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getRewardEpochVotePowerBlock( + uint256 _rewardEpoch +) external view returns ( + uint256); +``` + +Returns the [vote power block](https://docs.flare.network/tech/ftso/#vote-power) of a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +
+
+ +
+ +### `getStateOfRewards` { #fn_getstateofrewards } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getStateOfRewards( + address _beneficiary, + uint256 _rewardEpoch +) external view returns ( + address[] _dataProviders, + uint256[] _rewardAmounts, + bool[] _claimed, + bool _claimable); +``` + +Returns the state of rewards for a given address at a specific reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of the beneficiary to query. It can be a data provider or a delegator, for example.
Reverts if the queried address is delegating by amount. | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_dataProviders` | `address[]` | Array of addresses of data providers. | +| `_rewardAmounts` | `uint256[]` | Array of reward amounts received from each provider, in wei. | +| `_claimed` | `bool[]` | Array of boolean values indicating whether each reward has been claimed or not. | +| `_claimable` | `bool` | Boolean value indicating whether rewards are claimable or not. | +
+
+ +
+ +### `getStateOfRewardsFromDataProviders` { #fn_getstateofrewardsfromdataproviders } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getStateOfRewardsFromDataProviders( + address _beneficiary, + uint256 _rewardEpoch, + address[] _dataProviders +) external view returns ( + uint256[] _rewardAmounts, + bool[] _claimed, + bool _claimable); +``` + +Returns the state of rewards for a given address coming from a specific set of data providers, at a specific +reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of beneficiary to query. | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmounts` | `uint256[]` | Array of reward amounts received from each provider, in wei. | +| `_claimed` | `bool[]` | Array of boolean values indicating whether each reward has been claimed or not. | +| `_claimable` | `bool` | Boolean value indicating whether rewards are claimable or not. | +
+
+ +
+ +### `nextClaimableRewardEpoch` { #fn_nextclaimablerewardepoch } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function nextClaimableRewardEpoch( + address _rewardOwner +) external view returns ( + uint256); +``` + +Returns the next claimable reward epoch for a reward owner. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner to query. | + +
+
+ +
+ +### `setDataProviderFeePercentage` { #fn_setdataproviderfeepercentage } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function setDataProviderFeePercentage( + uint256 _feePercentageBIPS +) external returns ( + uint256 _validFromEpoch); +``` + +Sets the [fee](https://docs.flare.network/tech/ftso/#rewards) a data provider keeps from all delegations. + +Takes effect after `feeValueUpdateOffset` reward epochs have elapsed. + +When called multiple times inside the same reward epoch, only the last value remains. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256` | Fee percentage in BIPS. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_validFromEpoch` | `uint256` | Reward epoch number when the new fee percentage will become effective. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IGovernanceSettings.md b/docs/apis/smart-contracts/IGovernanceSettings.md new file mode 100644 index 000000000..b83bbaaa1 --- /dev/null +++ b/docs/apis/smart-contracts/IGovernanceSettings.md @@ -0,0 +1,134 @@ +--- +title: IGovernanceSettings +--- + + + +# `IGovernanceSettings` { #ct_igovernancesettings } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceSettings.sol) +
+ +
+ +Interface for the [`GovernanceSettings`](./GovernanceSettings.md) that hold the Flare governance address and its timelock. + +All governance calls are delayed by the timelock specified in this contract. + +**NOTE**: This contract enables updating the governance address and timelock only +by hard-forking the network, meaning only by updating validator code. + +
+ +
+ +## Functions + +
+ +### `getExecutors` { #fn_getexecutors } + +
+Defined in `IGovernanceSettings` ([Docs](./IGovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceSettings.sol)). +
+ +
+ +```solidity +function getExecutors( +) external view returns ( + address[] _addresses); +``` + +Gets the addresses of the accounts that are allowed to execute the timelocked governance calls, +once the timelock period expires. +Executors can be changed without a hard fork, via a normal governance call. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addresses` | `address[]` | Array of executor addresses. | +
+
+ +
+ +### `getGovernanceAddress` { #fn_getgovernanceaddress } + +
+Defined in `IGovernanceSettings` ([Docs](./IGovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceSettings.sol)). +
+ +
+ +```solidity +function getGovernanceAddress( +) external view returns ( + address _address); +``` + +Gets the governance account address. +The governance address can only be changed by a hard fork. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_address` | `address` | The governance account address. | +
+
+ +
+ +### `getTimelock` { #fn_gettimelock } + +
+Defined in `IGovernanceSettings` ([Docs](./IGovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceSettings.sol)). +
+ +
+ +```solidity +function getTimelock( +) external view returns ( + uint256 _timelock); +``` + +Gets the time in seconds that must pass between a governance call and its execution. +The timelock value can only be changed by a hard fork. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_timelock` | `uint256` | Time in seconds that passes between the governance call and execution. | +
+
+ +
+ +### `isExecutor` { #fn_isexecutor } + +
+Defined in `IGovernanceSettings` ([Docs](./IGovernanceSettings.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceSettings.sol)). +
+ +
+ +```solidity +function isExecutor( + address _address +) external view returns ( + bool); +``` + +Checks whether an address is one of the allowed executors. See [`getExecutors`](#fn_getexecutors). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_address` | `address` | The address to check. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | True if `_address` is in the executors list. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IGovernanceVotePower.md b/docs/apis/smart-contracts/IGovernanceVotePower.md new file mode 100644 index 000000000..1207d554a --- /dev/null +++ b/docs/apis/smart-contracts/IGovernanceVotePower.md @@ -0,0 +1,191 @@ +--- +title: IGovernanceVotePower +--- + + + +# `IGovernanceVotePower` { #ct_igovernancevotepower } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol) +
+ +
+ +Interface for contracts delegating their governance vote power. + +
+ +
+ +## Functions + +
+ +### `delegate` { #fn_delegate } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function delegate( + address _to +) external; +``` + +Delegates all governance vote power of `msg.sender` to address `_to`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | + +
+
+ +
+ +### `getDelegateOfAt` { #fn_getdelegateofat } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function getDelegateOfAt( + address _who, + uint256 _blockNumber +) external view returns ( + address); +``` + +Gets the address an account is delegating its governance vote power to, at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number at which to fetch the address. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address where `_who` was delegating its governance vote power at block `_blockNumber`. | +
+
+ +
+ +### `getDelegateOfAtNow` { #fn_getdelegateofatnow } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function getDelegateOfAtNow( + address _who +) external view returns ( + address); +``` + +Gets the address an account is delegating its governance vote power to, at the latest block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address where `_who` is currently delegating its governance vote power. | +
+
+ +
+ +### `getVotes` { #fn_getvotes } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function getVotes( + address _who +) external view returns ( + uint256); +``` + +Gets the governance vote power of an address at the latest block, including +all delegations made to it. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Governance vote power of `account` at the lastest block. | +
+
+ +
+ +### `undelegate` { #fn_undelegate } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function undelegate( +) external; +``` + +Undelegates all governance vote power of `msg.sender`. + +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _who, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Gets the governance vote power of an address at a given block number, including +all delegations made to it. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number at which to fetch the vote power. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Governance vote power of `_who` at `_blockNumber`. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIAddressUpdatable.md b/docs/apis/smart-contracts/IIAddressUpdatable.md new file mode 100644 index 000000000..c0582c141 --- /dev/null +++ b/docs/apis/smart-contracts/IIAddressUpdatable.md @@ -0,0 +1,54 @@ +--- +title: IIAddressUpdatable +--- + + + +# `IIAddressUpdatable` { #ct_iiaddressupdatable } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/interface/IIAddressUpdatable.sol) +
+ +
+ +Internal interface for contracts that depend on other contracts whose addresses can change. + +See [`AddressUpdatable`](./AddressUpdatable.md). + +
+ +
+ +## Functions + +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `IIAddressUpdatable` ([Docs](./IIAddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/interface/IIAddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +Updates contract addresses. +Can only be called from the [`AddressUpdater`](./AddressUpdater.md) contract typically set at construction time. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_contractNameHashes` | `bytes32[]` | List of keccak256(abi.encode(...)) contract names. | +| `_contractAddresses` | `address[]` | List of contract addresses corresponding to the contract names. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIAddressUpdater.md b/docs/apis/smart-contracts/IIAddressUpdater.md new file mode 100644 index 000000000..62fc5a88a --- /dev/null +++ b/docs/apis/smart-contracts/IIAddressUpdater.md @@ -0,0 +1,166 @@ +--- +title: IIAddressUpdater +--- + + + +# `IIAddressUpdater` { #ct_iiaddressupdater } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/interface/IIAddressUpdater.sol) +
+ +
+ +Internal interface for [`AddressUpdater`](./AddressUpdater.md). + +
+ +
+ +## Functions + +
+ +### `getContractAddress` { #fn_getcontractaddress } + +
+Defined in `IIAddressUpdater` ([Docs](./IIAddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/interface/IIAddressUpdater.sol)). +
+ +
+ +```solidity +function getContractAddress( + string _name +) external view returns ( + address); +``` + +Returns contract address for the given name, which might be address(0). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_name` | `string` | Name of the contract to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Current address for the queried contract. | +
+
+ +
+ +### `getContractAddressByHash` { #fn_getcontractaddressbyhash } + +
+Defined in `IIAddressUpdater` ([Docs](./IIAddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/interface/IIAddressUpdater.sol)). +
+ +
+ +```solidity +function getContractAddressByHash( + bytes32 _nameHash +) external view returns ( + address); +``` + +Returns contract address for the given name hash, which might be address(0). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nameHash` | `bytes32` | Hash of the contract name: `keccak256(abi.encode(name))` | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Current address for the queried contract. | +
+
+ +
+ +### `getContractAddresses` { #fn_getcontractaddresses } + +
+Defined in `IIAddressUpdater` ([Docs](./IIAddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/interface/IIAddressUpdater.sol)). +
+ +
+ +```solidity +function getContractAddresses( + string[] _names +) external view returns ( + address[]); +``` + +Returns contract addresses for the given names, which might be address(0). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_names` | `string[]` | Names of the contracts to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Current addresses for the queried contracts. | +
+
+ +
+ +### `getContractAddressesByHash` { #fn_getcontractaddressesbyhash } + +
+Defined in `IIAddressUpdater` ([Docs](./IIAddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/interface/IIAddressUpdater.sol)). +
+ +
+ +```solidity +function getContractAddressesByHash( + bytes32[] _nameHashes +) external view returns ( + address[]); +``` + +Returns contract addresses for the given name hashes, which might be address(0). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nameHashes` | `bytes32[]` | Hashes of the contract names: `keccak256(abi.encode(name))` | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Current addresses for the queried contracts. | +
+
+ +
+ +### `getContractNamesAndAddresses` { #fn_getcontractnamesandaddresses } + +
+Defined in `IIAddressUpdater` ([Docs](./IIAddressUpdater.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/interface/IIAddressUpdater.sol)). +
+ +
+ +```solidity +function getContractNamesAndAddresses( +) external view returns ( + string[] _contractNames, + address[] _contractAddresses); +``` + +Returns all contract names and corresponding addresses currently being tracked. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_contractNames` | `string[]` | Array of contract names. | +| `_contractAddresses` | `address[]` | Array of contract addresses. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIClaimSetupManager.md b/docs/apis/smart-contracts/IIClaimSetupManager.md new file mode 100644 index 000000000..1c25f017d --- /dev/null +++ b/docs/apis/smart-contracts/IIClaimSetupManager.md @@ -0,0 +1,1192 @@ +--- +title: IIClaimSetupManager +--- + + + +# `IIClaimSetupManager` { #ct_iiclaimsetupmanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol) | Inherits from [IClaimSetupManager](./IClaimSetupManager.md) +
+ +
+ +Internal interface for the [`ClaimSetupManager`](./ClaimSetupManager.md) contract. + +
+ +
+ +## Events + +
+ +### `AllowedClaimRecipientsChanged` { #ev_allowedclaimrecipientschanged } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event AllowedClaimRecipientsChanged( + address owner, + address[] recipients +) +``` + +
+
+ +
+ +### `ClaimExecutorFeeValueChanged` { #ev_claimexecutorfeevaluechanged } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event ClaimExecutorFeeValueChanged( + address executor, + uint256 validFromRewardEpoch, + uint256 feeValueWei +) +``` + +
+
+ +
+ +### `ClaimExecutorsChanged` { #ev_claimexecutorschanged } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event ClaimExecutorsChanged( + address owner, + address[] executors +) +``` + +
+
+ +
+ +### `DelegationAccountCreated` { #ev_delegationaccountcreated } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event DelegationAccountCreated( + address owner, + contract IDelegationAccount delegationAccount +) +``` + +
+
+ +
+ +### `DelegationAccountUpdated` { #ev_delegationaccountupdated } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event DelegationAccountUpdated( + address owner, + contract IDelegationAccount delegationAccount, + bool enabled +) +``` + +
+
+ +
+ +### `ExecutorRegistered` { #ev_executorregistered } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event ExecutorRegistered( + address executor +) +``` + +
+
+ +
+ +### `ExecutorUnregistered` { #ev_executorunregistered } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event ExecutorUnregistered( + address executor, + uint256 validFromRewardEpoch +) +``` + +
+
+ +
+ +### `MaxFeeSet` { #ev_maxfeeset } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event MaxFeeSet( + uint256 maxFeeValueWei +) +``` + +
+
+ +
+ +### `MinFeeSet` { #ev_minfeeset } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event MinFeeSet( + uint256 minFeeValueWei +) +``` + +
+
+ +
+ +### `RegisterExecutorFeeSet` { #ev_registerexecutorfeeset } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event RegisterExecutorFeeSet( + uint256 registerExecutorFeeValueWei +) +``` + +
+
+ +
+ +### `SetExecutorsExcessAmountRefunded` { #ev_setexecutorsexcessamountrefunded } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +event SetExecutorsExcessAmountRefunded( + address owner, + uint256 excessAmount +) +``` + +
+
+ +
+ +### `SetLibraryAddress` { #ev_setlibraryaddress } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +event SetLibraryAddress( + address libraryAddress +) +``` + +Emitted when the `libraryAddress` has been set. + +
+
+ +
+ +
+ +## Functions + +
+ +### `accountToDelegationAccount` { #fn_accounttodelegationaccount } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function accountToDelegationAccount( + address _owner +) external view returns ( + address); +``` + +Gets the [PDA](https://docs.flare.network/tech/personal-delegation-account) of an account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of its PDA or `address(0)` if it has not been created yet. | +
+
+ +
+ +### `allowedClaimRecipients` { #fn_allowedclaimrecipients } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function allowedClaimRecipients( + address _rewardOwner +) external view returns ( + address[]); +``` + +Gets the addresses of recipients allowed to receive rewards on behalf of an account. +Beside these, the owner of the rewards is always authorized. +See [`setAllowedClaimRecipients`](#fn_setallowedclaimrecipients). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | The account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Addresses of all set authorized recipients. | +
+
+ +
+ +### `batchDelegate` { #fn_batchdelegate } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function batchDelegate( + address[] _delegatees, + uint256[] _bips +) external; +``` + +Undelegates all percentage delegations from the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account) and then [`delegate`](#fn_delegate) to a list of accounts. + +See [`delegate`](#fn_delegate). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegatees` | `address[]` | The addresses of the new recipients. | +| `_bips` | `uint256[]` | The percentage of voting power to be delegated to each delegatee, expressed in basis points (1/100 of one percent). Total of all `_bips` values must be lower than 10000. | + +
+
+ +
+ +### `checkExecutorAndAllowedRecipient` { #fn_checkexecutorandallowedrecipient } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +function checkExecutorAndAllowedRecipient( + address _executor, + address _owner, + address _recipient +) external view; +``` + +Checks if an executor can claim on behalf of a given account and send funds to a given recipient address. + +Reverts if claiming is not possible, does nothing otherwise. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | +| `_owner` | `address` | The reward owner to query. | +| `_recipient` | `address` | The address where the reward would be sent. | + +
+
+ +
+ +### `claimExecutors` { #fn_claimexecutors } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function claimExecutors( + address _owner +) external view returns ( + address[]); +``` + +Gets the addresses of executors authorized to claim for an account. +See [`setClaimExecutors`](#fn_setclaimexecutors). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Addresses of all set executors. | +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function delegate( + address _to, + uint256 _bips +) external; +``` + +Delegates a percentage of the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account)'s voting power to another address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_bips` | `uint256` | 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. A value of 0 revokes delegation. | + +
+
+ +
+ +### `delegateGovernance` { #fn_delegategovernance } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function delegateGovernance( + address _to +) external; +``` + +Delegates all the [governance](https://docs.flare.network/tech/governance/) vote power of the caller's +[PDA](https://docs.flare.network/tech/personal-delegation-account) to another account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | Address of the recipient of the delegation. | + +
+
+ +
+ +### `disableDelegationAccount` { #fn_disabledelegationaccount } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function disableDelegationAccount( +) external; +``` + +Disables the +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +When using automatic claiming, all airdrops and FTSO rewards will be sent to the owner's account. +Rewards accrued by the PDA will no longer be automatically claimed. + +Reverts if there is no PDA. + +
+
+ +
+ +### `enableDelegationAccount` { #fn_enabledelegationaccount } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function enableDelegationAccount( +) external returns ( + contract IDelegationAccount); +``` + +Enables (or creates) a +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +When using automatic claiming, all airdrops and FTSO rewards will be sent to the PDA, and any rewards +accrued by the PDA will be claimed too. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IDelegationAccount` | Address of the delegation account contract. | +
+
+ +
+ +### `getAutoClaimAddressesAndExecutorFee` { #fn_getautoclaimaddressesandexecutorfee } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +function getAutoClaimAddressesAndExecutorFee( + address _executor, + address[] _owners +) external view returns ( + address[] _recipients, + uint256 _executorFeeValue); +``` + +Gets the [Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA) for +a list of accounts for which an executor is claiming. +Returns owner address instead if the PDA is not created yet or not enabled. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | Executor to query. | +| `_owners` | `address[]` | Array of reward owners which must have set `_executor` as their executor. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_recipients` | `address[]` | Addresses which will receive the claimed rewards. Can be the reward owners or their PDAs. | +| `_executorFeeValue` | `uint256` | Executor's fee value, in wei. | +
+
+ +
+ +### `getDelegationAccountData` { #fn_getdelegationaccountdata } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getDelegationAccountData( + address _owner +) external view returns ( + contract IDelegationAccount _delegationAccount, + bool _enabled); +``` + +Gets [PDA](https://docs.flare.network/tech/personal-delegation-account) data for an account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Account to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegationAccount` | `contract IDelegationAccount` | Account's PDA address or `address(0)` if it has not been created yet. | +| `_enabled` | `bool` | Whether the PDA is enabled. | +
+
+ +
+ +### `getExecutorCurrentFeeValue` { #fn_getexecutorcurrentfeevalue } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorCurrentFeeValue( + address _executor +) external view returns ( + uint256); +``` + +Returns the current fee of a registered executor. +Reverts if the executor is not registered. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Fee in wei. | +
+
+ +
+ +### `getExecutorFeeValue` { #fn_getexecutorfeevalue } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorFeeValue( + address _executor, + uint256 _rewardEpoch +) external view returns ( + uint256); +``` + +Returns the fee of an executor at a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | +| `_rewardEpoch` | `uint256` | Reward Epoch ID to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Fee in wei at that reward epoch. | +
+
+ +
+ +### `getExecutorInfo` { #fn_getexecutorinfo } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorInfo( + address _executor +) external view returns ( + bool _registered, + uint256 _currentFeeValue); +``` + +Returns information about an executor. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | The executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_registered` | `bool` | Whether the executor is registered. | +| `_currentFeeValue` | `uint256` | Executor's current fee value, if registered. | +
+
+ +
+ +### `getExecutorScheduledFeeValueChanges` { #fn_getexecutorscheduledfeevaluechanges } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getExecutorScheduledFeeValueChanges( + address _executor +) external view returns ( + uint256[] _feeValue, + uint256[] _validFromEpoch, + bool[] _fixed); +``` + +Returns the currently scheduled fee changes of an executor. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executor` | `address` | Executor to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feeValue` | `uint256[]` | Array of scheduled fees. | +| `_validFromEpoch` | `uint256[]` | Array of reward epochs ID where the scheduled fees will become effective. | +| `_fixed` | `bool[]` | Array of booleans indicating if an scheduled fee change is fixed or it might still be changed. | +
+
+ +
+ +### `getRegisteredExecutors` { #fn_getregisteredexecutors } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function getRegisteredExecutors( + uint256 _start, + uint256 _end +) external view returns ( + address[] _registeredExecutors, + uint256 _totalLength); +``` + +Returns the list of executors registered through [`registerExecutor`](#fn_registerexecutor). +Supports paging. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_start` | `uint256` | First executor to return. | +| `_end` | `uint256` | Last executor to return. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_registeredExecutors` | `address[]` | Addresses of the registered executors. | +| `_totalLength` | `uint256` | Total amount of executors. | +
+
+ +
+ +### `isClaimExecutor` { #fn_isclaimexecutor } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function isClaimExecutor( + address _owner, + address _executor +) external view returns ( + bool); +``` + +Returns whether an executor is authorized to claim on behalf of a reward owner. +See [`setClaimExecutors`](#fn_setclaimexecutors). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The reward owner to query. | +| `_executor` | `address` | The executor to query. | + +
+
+ +
+ +### `registerExecutor` { #fn_registerexecutor } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function registerExecutor( + uint256 _feeValue +) external payable returns ( + uint256); +``` + +Registers the caller as an executor and sets its initial fee value. + +If the executor was already registered, this method only updates the fee, which will take effect after +`feeValueUpdateOffset` reward epochs have elapsed. + +Executor must pay a fee in order to register. See `registerExecutorFeeValueWei`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feeValue` | `uint256` | Desired fee, in wei. Must be between `minFeeValueWei` and `maxFeeValueWei`. 0 means no fee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID when the changes become effective. | +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _who, + uint256 _blockNumber +) external; +``` + +Revokes all delegation from the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account) +to a given account at a given block. + +Only affects the reads via `votePowerOfAtCached()` in the specified block. + +This method should be used only to prevent rogue [`delegate`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) with percentage of 0 or [`undelegateAll`](#fn_undelegateall). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The account to revoke. | +| `_blockNumber` | `uint256` | Block number where the revoking will take place. Must be in the past. | + +
+
+ +
+ +### `setAllowedClaimRecipients` { #fn_setallowedclaimrecipients } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function setAllowedClaimRecipients( + address[] _recipients +) external; +``` + +Set the addresses of allowed recipients. +The reward owner is always an allowed recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipients` | `address[]` | The new allowed recipients. All old recipients will be deleted and replaced by these. | + +
+
+ +
+ +### `setAutoClaiming` { #fn_setautoclaiming } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function setAutoClaiming( + address[] _executors, + bool _enableDelegationAccount +) external payable; +``` + +Sets the addresses of executors and optionally enables (creates) a +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) (PDA). + +If any of the executors is a registered executor, some fee needs to be paid. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executors` | `address[]` | The new executors. All old executors will be deleted and replaced by these. | +| `_enableDelegationAccount` | `bool` | Whether the PDA should be enabled. | + +
+
+ +
+ +### `setClaimExecutors` { #fn_setclaimexecutors } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function setClaimExecutors( + address[] _executors +) external payable; +``` + +Sets the addresses of executors. + +If any of the executors is a registered executor, some fee needs to be paid. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_executors` | `address[]` | The new executors. All old executors will be deleted and replaced by these. | + +
+
+ +
+ +### `setLibraryAddress` { #fn_setlibraryaddress } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +function setLibraryAddress( + address _libraryAddress +) external; +``` + +Sets new library address. + +
+
+ +
+ +### `setMaxFeeValueWei` { #fn_setmaxfeevaluewei } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +function setMaxFeeValueWei( + uint256 _maxFeeValueWei +) external; +``` + +Sets maximum fee allowed for executors, in wei. + +
+
+ +
+ +### `setMinFeeValueWei` { #fn_setminfeevaluewei } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +function setMinFeeValueWei( + uint256 _minFeeValueWei +) external; +``` + +Sets minimum fee allowed for executors, in wei. + +
+
+ +
+ +### `setRegisterExecutorFeeValueWei` { #fn_setregisterexecutorfeevaluewei } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +function setRegisterExecutorFeeValueWei( + uint256 _registerExecutorFeeValueWei +) external; +``` + +Sets the fee required to register an executor, which must be higher than 0. + +
+
+ +
+ +### `transferExternalToken` { #fn_transferexternaltoken } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function transferExternalToken( + contract IERC20 _token, + uint256 _amount +) external; +``` + +Allows the caller to transfer ERC-20 tokens from their +[PDA](https://docs.flare.network/tech/personal-delegation-account) to the owner account. + +The main use case is to move ERC-20 tokes received by mistake (by an airdrop, for example) out of the PDA +and into the main account, where they can be more easily managed. + +Reverts if the target token is the [`WNat`](./WNat.md) contract: use method [`withdraw`](#fn_withdraw) for that. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_token` | `contract IERC20` | Target token contract address. | +| `_amount` | `uint256` | Amount of tokens to transfer. | + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function undelegateAll( +) external; +``` + +Removes all delegations from the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account). + +
+
+ +
+ +### `undelegateGovernance` { #fn_undelegategovernance } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function undelegateGovernance( +) external; +``` + +Undelegates all [governance](https://docs.flare.network/tech/governance/) vote power currently delegated by +the caller's [PDA](https://docs.flare.network/tech/personal-delegation-account). + +
+
+ +
+ +### `unregisterExecutor` { #fn_unregisterexecutor } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function unregisterExecutor( +) external returns ( + uint256); +``` + +Unregisters the caller as an executor. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID when the change becomes effective. | +
+
+ +
+ +### `updateExecutorFeeValue` { #fn_updateexecutorfeevalue } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function updateExecutorFeeValue( + uint256 _feeValue +) external returns ( + uint256); +``` + +Sets the caller's executor fee. The caller must be an executor registered through [`registerExecutor`](#fn_registerexecutor). + +When called multiple times inside the same reward epoch, only the last value remains. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feeValue` | `uint256` | Desired fee, in wei. Must be between `minFeeValueWei` and `maxFeeValueWei`. 0 means no fee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID when the changes become effective. | +
+
+ +
+ +### `wNat` { #fn_wnat } + +
+Defined in `IIClaimSetupManager` ([Docs](./IIClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/claiming/interface/IIClaimSetupManager.sol)). +
+ +
+ +```solidity +function wNat( +) external view returns ( + contract WNat); +``` + +Returns the [`WNat`](./WNat.md) contract. + +
+
+ +
+ +### `withdraw` { #fn_withdraw } + +
+Defined in `IClaimSetupManager` ([Docs](./IClaimSetupManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IClaimSetupManager.sol)). +
+ +
+ +```solidity +function withdraw( + uint256 _amount +) external; +``` + +Allows the caller to transfer [`WNat`](./WNat.md) wrapped tokens from their +[PDA](https://docs.flare.network/tech/personal-delegation-account) to the owner account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_amount` | `uint256` | Amount of tokens to transfer, in wei. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IICleanable.md b/docs/apis/smart-contracts/IICleanable.md new file mode 100644 index 000000000..1c33e589d --- /dev/null +++ b/docs/apis/smart-contracts/IICleanable.md @@ -0,0 +1,101 @@ +--- +title: IICleanable +--- + + + +# `IICleanable` { #ct_iicleanable } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol) +
+ +
+ +Internal interface for entities that can have their block history cleaned. + +
+ +
+ +## Functions + +
+ +### `cleanupBlockNumber` { #fn_cleanupblocknumber } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function cleanupBlockNumber( +) external view returns ( + uint256); +``` + +Get the current cleanup block number set with [`setCleanupBlockNumber`](#fn_setcleanupblocknumber). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The currently set cleanup block number. | +
+
+ +
+ +### `setCleanerContract` { #fn_setcleanercontract } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function setCleanerContract( + address _cleanerContract +) external; +``` + +Set the contract that is allowed to call history cleaning methods. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanerContract` | `address` | Address of the cleanup contract. Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). | + +
+
+ +
+ +### `setCleanupBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumber( + uint256 _blockNumber +) external; +``` + +Set the cleanup block number. +Historic data for the blocks before [`cleanupBlockNumber`](#fn_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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The new cleanup block number. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIFtso.md b/docs/apis/smart-contracts/IIFtso.md new file mode 100644 index 000000000..7a5901fc7 --- /dev/null +++ b/docs/apis/smart-contracts/IIFtso.md @@ -0,0 +1,981 @@ +--- +title: IIFtso +--- + + + +# `IIFtso` { #ct_iiftso } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol) | Inherits from [IFtso](./IFtso.md), [IFtsoGenesis](./IFtsoGenesis.md) +
+ +
+ +Internal interface for each of the FTSO contracts that handles an asset. +Read the [FTSO documentation page](https://docs.flare.network/tech/ftso/) +for general information about the FTSO system. + +
+ +
+ +## Functions + +
+ +### `activateFtso` { #fn_activateftso } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function activateFtso( + uint256 _firstEpochStartTs, + uint256 _submitPeriodSeconds, + uint256 _revealPeriodSeconds +) external; +``` + +Initializes FTSO immutable settings and activates the contract. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_firstEpochStartTs` | `uint256` | Timestamp of the first epoch in seconds from UNIX epoch. | +| `_submitPeriodSeconds` | `uint256` | Duration of epoch submission window in seconds. | +| `_revealPeriodSeconds` | `uint256` | Duration of epoch reveal window in seconds. | + +
+
+ +
+ +### `active` { #fn_active } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Returns whether FTSO is [`active`](#fn_active) or not. + +
+
+ +
+ +### `configureEpochs` { #fn_configureepochs } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function configureEpochs( + uint256 _maxVotePowerNatThresholdFraction, + uint256 _maxVotePowerAssetThresholdFraction, + uint256 _lowAssetUSDThreshold, + uint256 _highAssetUSDThreshold, + uint256 _highAssetTurnoutThresholdBIPS, + uint256 _lowNatTurnoutThresholdBIPS, + uint256 _elasticBandRewardBIPS, + uint256 _elasticBandWidthPPM, + address[] _trustedAddresses +) external; +``` + +Sets configurable settings related to epochs. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_maxVotePowerNatThresholdFraction` | `uint256` | High threshold for native token vote power per voter. | +| `_maxVotePowerAssetThresholdFraction` | `uint256` | High threshold for asset vote power per voter. | +| `_lowAssetUSDThreshold` | `uint256` | Threshold for low asset vote power (in scaled USD). | +| `_highAssetUSDThreshold` | `uint256` | Threshold for high asset vote power (in scaled USD). | +| `_highAssetTurnoutThresholdBIPS` | `uint256` | Threshold for high asset turnout (in BIPS). | +| `_lowNatTurnoutThresholdBIPS` | `uint256` | Threshold for low nat turnout (in BIPS). | +| `_elasticBandRewardBIPS` | `uint256` | Percentage of the rewards (in BIPS) that go to the [secondary reward band](https://docs.flare.network/tech/ftso/#rewards). The rest go to the primary reward band. | +| `_elasticBandWidthPPM` | `uint256` | Width of the secondary reward band, in parts-per-milion of the median. | +| `_trustedAddresses` | `address[]` | Trusted voters that will be used if low voter turnout is detected. | + +
+
+ +
+ +### `deactivateFtso` { #fn_deactivateftso } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function deactivateFtso( +) external; +``` + +Deactivates the contract. + +
+
+ +
+ +### `epochsConfiguration` { #fn_epochsconfiguration } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function epochsConfiguration( +) external view returns ( + uint256 _maxVotePowerNatThresholdFraction, + uint256 _maxVotePowerAssetThresholdFraction, + uint256 _lowAssetUSDThreshold, + uint256 _highAssetUSDThreshold, + uint256 _highAssetTurnoutThresholdBIPS, + uint256 _lowNatTurnoutThresholdBIPS, + uint256 _elasticBandRewardBIPS, + uint256 _elasticBandWidthPPM, + address[] _trustedAddresses); +``` + +Returns current configuration of epoch state. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_maxVotePowerNatThresholdFraction` | `uint256` | High threshold for native token vote power per voter. | +| `_maxVotePowerAssetThresholdFraction` | `uint256` | High threshold for asset vote power per voter. | +| `_lowAssetUSDThreshold` | `uint256` | Threshold for low asset vote power (in scaled USD). | +| `_highAssetUSDThreshold` | `uint256` | Threshold for high asset vote power (in scaled USD). | +| `_highAssetTurnoutThresholdBIPS` | `uint256` | Threshold for high asset turnout (in BIPS). | +| `_lowNatTurnoutThresholdBIPS` | `uint256` | Threshold for low nat turnout (in BIPS). | +| `_elasticBandRewardBIPS` | `uint256` | Percentage of the rewards (in BIPS) that go to the [secondary reward band](https://docs.flare.network/tech/ftso/#rewards). The rest go to the primary reward band. | +| `_elasticBandWidthPPM` | `uint256` | Width of the secondary reward band, in parts-per-milion of the median. | +| `_trustedAddresses` | `address[]` | Trusted voters that will be used if low voter turnout is detected. | +
+
+ +
+ +### `fallbackFinalizePriceEpoch` { #fn_fallbackfinalizepriceepoch } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function fallbackFinalizePriceEpoch( + uint256 _epochId +) external; +``` + +Forces finalization of a price epoch, calculating the median price from trusted addresses only. + +Used as a fallback method, for example, due to an unexpected error during normal epoch finalization or +because the [`ftsoManager`](#fn_ftsomanager) enabled the fallback mode. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to finalize. | + +
+
+ +
+ +### `finalizePriceEpoch` { #fn_finalizepriceepoch } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function finalizePriceEpoch( + uint256 _epochId, + bool _returnRewardData +) external returns ( + address[] _eligibleAddresses, + uint256[] _natWeights, + uint256 _totalNatWeight); +``` + +Computes epoch price based on gathered votes. + +* If the price reveal window for the epoch has ended, finalize the epoch. +* Iterate list of price submissions. +* Find weighted median. +* Find adjacent 50% of price submissions. +* Allocate rewards for price submissions. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to finalize. | +| `_returnRewardData` | `bool` | Parameter that determines if the reward data is returned. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_eligibleAddresses` | `address[]` | List of addresses eligible for reward. | +| `_natWeights` | `uint256[]` | List of native token weights corresponding to the eligible addresses. | +| `_totalNatWeight` | `uint256` | Sum of weights in `_natWeights`. | +
+
+ +
+ +### `forceFinalizePriceEpoch` { #fn_forcefinalizepriceepoch } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function forceFinalizePriceEpoch( + uint256 _epochId +) external; +``` + +Forces finalization of a price epoch by copying the price from the previous epoch. + +Used as a fallback method if [`fallbackFinalizePriceEpoch`](#fn_fallbackfinalizepriceepoch) fails due to an exception. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to finalize. | + +
+
+ +
+ +### `ftsoManager` { #fn_ftsomanager } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function ftsoManager( +) external view returns ( + address); +``` + +Returns the FTSO manager's address. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address of the FTSO manager contract. | +
+
+ +
+ +### `getAsset` { #fn_getasset } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function getAsset( +) external view returns ( + contract IIVPToken); +``` + +Returns the FTSO asset. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IIVPToken` | Address of the [`IIVPToken`](./IIVPToken.md) tracked by this FTSO. `null` in case of multi-asset FTSO. | +
+
+ +
+ +### `getAssetFtsos` { #fn_getassetftsos } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function getAssetFtsos( +) external view returns ( + contract IIFtso[]); +``` + +Returns the asset FTSOs. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IIFtso[]` | Array of [`IIFtso`](./IIFtso.md) contract addresses. `null` in case of single-asset FTSO. | +
+
+ +
+ +### `getCurrentEpochId` { #fn_getcurrentepochid } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentEpochId( +) external view returns ( + uint256); +``` + +Returns the current epoch ID. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Currently running epoch ID. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getCurrentPrice` { #fn_getcurrentprice } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPrice( +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Returns the current asset price. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceDetails` { #fn_getcurrentpricedetails } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPriceDetails( +) external view returns ( + uint256 _price, + uint256 _priceTimestamp, + enum IFtso.PriceFinalizationType _priceFinalizationType, + uint256 _lastPriceEpochFinalizationTimestamp, + enum IFtso.PriceFinalizationType _lastPriceEpochFinalizationType); +``` + +Returns asset's current price details. +All timestamps are in seconds from UNIX epoch. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_priceTimestamp` | `uint256` | Time when price was updated for the last time. | +| `_priceFinalizationType` | `enum IFtso.PriceFinalizationType` | Finalization type when price was updated for the last time. | +| `_lastPriceEpochFinalizationTimestamp` | `uint256` | Time when last price epoch was finalized. | +| `_lastPriceEpochFinalizationType` | `enum IFtso.PriceFinalizationType` | Finalization type of last finalized price epoch. | +
+
+ +
+ +### `getCurrentPriceFromTrustedProviders` { #fn_getcurrentpricefromtrustedproviders } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPriceFromTrustedProviders( +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Returns current asset price calculated only using input from trusted providers. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceWithDecimals` { #fn_getcurrentpricewithdecimals } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimals( +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Returns current asset price and number of decimals. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`_assetPriceUsdDecimals`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the USD price. | +
+
+ +
+ +### `getCurrentPriceWithDecimalsFromTrustedProviders` { #fn_getcurrentpricewithdecimalsfromtrustedproviders } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimalsFromTrustedProviders( +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Returns current asset price calculated only using input from trusted providers and number of decimals. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Time when price was updated for the last time, in seconds from UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the USD price. | +
+
+ +
+ +### `getCurrentRandom` { #fn_getcurrentrandom } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getCurrentRandom( +) external view returns ( + uint256); +``` + +Returns the random number for the previous price epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +
+
+ +
+ +### `getEpochId` { #fn_getepochid } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getEpochId( + uint256 _timestamp +) external view returns ( + uint256); +``` + +Returns the ID of the epoch that was opened for price submission at the specified timestamp. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_timestamp` | `uint256` | Queried timestamp in seconds from UNIX epoch. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Epoch ID corresponding to that timestamp. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getEpochPrice` { #fn_getepochprice } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getEpochPrice( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns agreed asset price in the specified epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch. Only the last 200 epochs can be queried. Out-of-bounds queries revert. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +
+
+ +
+ +### `getEpochPriceForVoter` { #fn_getepochpriceforvoter } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getEpochPriceForVoter( + uint256 _epochId, + address _voter +) external view returns ( + uint256); +``` + +Returns asset price submitted by a voter in the specified epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch being queried. Only the last 200 epochs can be queried. Out-of-bounds queries revert. | +| `_voter` | `address` | Address of the voter being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Price in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +
+
+ +
+ +### `getPriceEpochConfiguration` { #fn_getpriceepochconfiguration } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getPriceEpochConfiguration( +) external view returns ( + uint256 _firstEpochStartTs, + uint256 _submitPeriodSeconds, + uint256 _revealPeriodSeconds); +``` + +Returns current epoch's configuration. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstEpochStartTs` | `uint256` | First epoch start timestamp in seconds from UNIX epoch. | +| `_submitPeriodSeconds` | `uint256` | Submit period in seconds. | +| `_revealPeriodSeconds` | `uint256` | Reveal period in seconds. | +
+
+ +
+ +### `getPriceEpochData` { #fn_getpriceepochdata } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getPriceEpochData( +) external view returns ( + uint256 _epochId, + uint256 _epochSubmitEndTime, + uint256 _epochRevealEndTime, + uint256 _votePowerBlock, + bool _fallbackMode); +``` + +Returns current epoch data. +Intervals are open on the right: End times are not included. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_epochId` | `uint256` | Current epoch ID. | +| `_epochSubmitEndTime` | `uint256` | End time of the price submission window in seconds from UNIX epoch. | +| `_epochRevealEndTime` | `uint256` | End time of the price reveal window in seconds from UNIX epoch. | +| `_votePowerBlock` | `uint256` | Vote power block for the current epoch. | +| `_fallbackMode` | `bool` | Whether the current epoch is in fallback mode. Only votes from trusted addresses are used in this mode. | +
+
+ +
+ +### `getRandom` { #fn_getrandom } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function getRandom( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns the random number used in a specific past epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the queried epoch. Current epoch cannot be queried, and the previous epoch is constantly updated as data providers reveal their prices and random numbers. Only the last 50 epochs can be queried and there is no bounds checking for this parameter. Out-of-bounds queries return undefined values. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The random number used in that epoch. | +
+
+ +
+ +### `getVoteWeightingParameters` { #fn_getvoteweightingparameters } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function getVoteWeightingParameters( +) external view returns ( + contract IIVPToken[] _assets, + uint256[] _assetMultipliers, + uint256 _totalVotePowerNat, + uint256 _totalVotePowerAsset, + uint256 _assetWeightRatio, + uint256 _votePowerBlock); +``` + +Returns parameters necessary for replicating vote weighting (used in [`VoterWhitelister`](./VoterWhitelister.md)). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_assets` | `contract IIVPToken[]` | The list of assets that are accounted in vote. | +| `_assetMultipliers` | `uint256[]` | Weight multiplier of each asset in (multiasset) FTSO. | +| `_totalVotePowerNat` | `uint256` | Total native token vote power at block. | +| `_totalVotePowerAsset` | `uint256` | Total combined asset vote power at block. | +| `_assetWeightRatio` | `uint256` | Ratio of combined asset vote power vs. native token vp (in BIPS). | +| `_votePowerBlock` | `uint256` | Vote power block for the epoch. | +
+
+ +
+ +### `initializeCurrentEpochStateForReveal` { #fn_initializecurrentepochstateforreveal } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function initializeCurrentEpochStateForReveal( + uint256 _circulatingSupplyNat, + bool _fallbackMode +) external; +``` + +Initializes current epoch instance for reveal. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_circulatingSupplyNat` | `uint256` | Epoch native token circulating supply. | +| `_fallbackMode` | `bool` | Whether the current epoch is in fallback mode. | + +
+
+ +
+ +### `revealPriceSubmitter` { #fn_revealpricesubmitter } + +
+Defined in `IFtsoGenesis` ([Docs](./IFtsoGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoGenesis.sol)). +
+ +
+ +```solidity +function revealPriceSubmitter( + address _voter, + uint256 _epochId, + uint256 _price, + uint256 _voterWNatVP +) external; +``` + +Reveals the price submitted by a voter on a specific epoch. +The hash of _price and _random must be equal to the submitted hash + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Voter address. | +| `_epochId` | `uint256` | ID of the epoch in which the price hash was submitted. | +| `_price` | `uint256` | Submitted price. | +| `_voterWNatVP` | `uint256` | Voter's vote power in [`WNat`](./WNat.md) units. | + +
+
+ +
+ +### `setAsset` { #fn_setasset } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function setAsset( + contract IIVPToken _asset +) external; +``` + +Sets asset for FTSO to operate as single-asset oracle. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_asset` | `contract IIVPToken` | Address of the [`IIVPToken`](./IIVPToken.md) contract that will be the asset tracked by this FTSO. | + +
+
+ +
+ +### `setAssetFtsos` { #fn_setassetftsos } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function setAssetFtsos( + contract IIFtso[] _assetFtsos +) external; +``` + +Sets an array of FTSOs for FTSO to operate as multi-asset oracle. +FTSOs implicitly determine the FTSO assets. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetFtsos` | `contract IIFtso[]` | Array of FTSOs. | + +
+
+ +
+ +### `setVotePowerBlock` { #fn_setvotepowerblock } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function setVotePowerBlock( + uint256 _blockNumber +) external; +``` + +Sets the current vote power block. +Current vote power block will update per reward epoch. +The FTSO doesn't have notion of reward epochs. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | Vote power block. | + +
+
+ +
+ +### `symbol` { #fn_symbol } + +
+Defined in `IFtso` ([Docs](./IFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtso.sol)). +
+ +
+ +```solidity +function symbol( +) external view returns ( + string); +``` + +Returns the FTSO [`symbol`](#fn_symbol). + +
+
+ +
+ +### `updateInitialPrice` { #fn_updateinitialprice } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function updateInitialPrice( + uint256 _initialPriceUSD, + uint256 _initialPriceTimestamp +) external; +``` + +Updates initial asset price when the contract is not [`active`](#fn_active) yet. + +
+
+ +
+ +### `wNat` { #fn_wnat } + +
+Defined in `IIFtso` ([Docs](./IIFtso.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtso.sol)). +
+ +
+ +```solidity +function wNat( +) external view returns ( + contract IIVPToken); +``` + +Address of the [`WNat`](./WNat.md) contract. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IIVPToken` | Address of the [`WNat`](./WNat.md) contract. | +
+
+ +
+ +### `wNatVotePowerCached` { #fn_wnatvotepowercached } + +
+Defined in `IFtsoGenesis` ([Docs](./IFtsoGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoGenesis.sol)). +
+ +
+ +```solidity +function wNatVotePowerCached( + address _voter, + uint256 _epochId +) external returns ( + uint256); +``` + +Get and cache the vote power of a voter on a specific epoch, in [`WNat`](./WNat.md) units. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Voter address. | +| `_epochId` | `uint256` | ID of the epoch in which the price hash was submitted. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Voter's vote power in [`WNat`](./WNat.md) units. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIFtsoManager.md b/docs/apis/smart-contracts/IIFtsoManager.md new file mode 100644 index 000000000..beadd0b33 --- /dev/null +++ b/docs/apis/smart-contracts/IIFtsoManager.md @@ -0,0 +1,1387 @@ +--- +title: IIFtsoManager +--- + + + +# `IIFtsoManager` { #ct_iiftsomanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol) | Inherits from [IFtsoManager](./IFtsoManager.md), [IFlareDaemonize](./IFlareDaemonize.md) +
+ +
+ +Internal interface for the [`FtsoManager`](./FtsoManager.md) contract. + +
+ +
+ +## Events + +
+ +### `AccruingUnearnedRewardsFailed` { #ev_accruingunearnedrewardsfailed } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event AccruingUnearnedRewardsFailed( + uint256 epochId +) +``` + +Unexpected failure while accruing unearned rewards. +This should be a rare occurrence. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `epochId` | `uint256` | Epoch ID of the failure. | + +
+
+ +
+ +### `ChillingNonrevealingDataProvidersFailed` { #ev_chillingnonrevealingdataprovidersfailed } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +event ChillingNonrevealingDataProvidersFailed( +) +``` + +Unexpected failure. This should be a rare occurrence. + +
+
+ +
+ +### `CleanupBlockNumberManagerFailedForBlock` { #ev_cleanupblocknumbermanagerfailedforblock } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +event CleanupBlockNumberManagerFailedForBlock( + uint256 blockNumber +) +``` + +Unexpected failure. This should be a rare occurrence. + +
+
+ +
+ +### `ClosingExpiredRewardEpochFailed` { #ev_closingexpiredrewardepochfailed } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +event ClosingExpiredRewardEpochFailed( + uint256 rewardEpoch +) +``` + +Unexpected failure. This should be a rare occurrence. + +
+
+ +
+ +### `DistributingRewardsFailed` { #ev_distributingrewardsfailed } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event DistributingRewardsFailed( + address ftso, + uint256 epochId +) +``` + +Unexpected failure while distributing rewards. +This should be a rare occurrence. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `address` | Contract address of the FTSO where the failure happened. | +| `epochId` | `uint256` | Epoch ID of the failure. | + +
+
+ +
+ +### `FallbackMode` { #ev_fallbackmode } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event FallbackMode( + bool fallbackMode +) +``` + +Emitted when the fallback mode of the FTSO manager changes its state. +Fallback mode is a recovery mode, where only data from a trusted subset of FTSO +data providers is used to calculate the final price. + +The FTSO Manager enters the fallback mode when ALL FTSOs are in fallback mode. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `fallbackMode` | `bool` | New state of the FTSO Manager fallback mode. | + +
+
+ +
+ +### `FinalizingPriceEpochFailed` { #ev_finalizingpriceepochfailed } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event FinalizingPriceEpochFailed( + contract IIFtso ftso, + uint256 epochId, + enum IFtso.PriceFinalizationType failingType +) +``` + +Unexpected failure while finalizing a price epoch. +This should be a rare occurrence. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `contract IIFtso` | Contract address of the FTSO where the failure happened. | +| `epochId` | `uint256` | Epoch ID of the failure. | +| `failingType` | `enum IFtso.PriceFinalizationType` | How was the epoch finalized. | + +
+
+ +
+ +### `FtsoAdded` { #ev_ftsoadded } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event FtsoAdded( + contract IIFtso ftso, + bool add +) +``` + +Emitted when a new FTSO has been added or an existing one has been removed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `contract IIFtso` | Contract address of the FTSO. | +| `add` | `bool` | True if added, removed otherwise. | + +
+
+ +
+ +### `FtsoDeactivationFailed` { #ev_ftsodeactivationfailed } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +event FtsoDeactivationFailed( + contract IIFtso ftso +) +``` + +Unexpected failure. This should be a rare occurrence. + +
+
+ +
+ +### `FtsoFallbackMode` { #ev_ftsofallbackmode } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event FtsoFallbackMode( + contract IIFtso ftso, + bool fallbackMode +) +``` + +Emitted when the fallback mode of an FTSO changes its state. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `contract IIFtso` | Contract address of the FTSO. | +| `fallbackMode` | `bool` | New state of its fallback mode. | + +
+
+ +
+ +### `InitializingCurrentEpochStateForRevealFailed` { #ev_initializingcurrentepochstateforrevealfailed } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event InitializingCurrentEpochStateForRevealFailed( + contract IIFtso ftso, + uint256 epochId +) +``` + +Unexpected failure while initializing a price epoch. +This should be a rare occurrence. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `contract IIFtso` | Contract address of the FTSO where the failure happened. | +| `epochId` | `uint256` | Epoch ID that failed initialization. | + +
+
+ +
+ +### `PriceEpochFinalized` { #ev_priceepochfinalized } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event PriceEpochFinalized( + address chosenFtso, + uint256 rewardEpochId +) +``` + +Emitted when a [price epoch](https://docs.flare.network/tech/ftso/#procedure-overview) ends, this is, +after the reveal phase, when final prices are calculated. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `chosenFtso` | `address` | Contract address of the FTSO asset that was randomly chosen to be the basis for reward calculation. On this price epoch, rewards will be calculated based on how close each data provider was to the median of all submitted prices FOR THIS FTSO. | +| `rewardEpochId` | `uint256` | Reward epoch ID this price epoch belongs to. | + +
+
+ +
+ +### `RewardEpochFinalized` { #ev_rewardepochfinalized } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event RewardEpochFinalized( + uint256 votepowerBlock, + uint256 startBlock +) +``` + +Emitted when a [reward epoch](https://docs.flare.network/tech/ftso/#procedure-overview) +ends and rewards are available. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `votepowerBlock` | `uint256` | The [vote power block](https://docs.flare.network/tech/ftso/#vote-power) of the epoch. | +| `startBlock` | `uint256` | The first block of the epoch. | + +
+
+ +
+ +### `UpdatingActiveValidatorsTriggerFailed` { #ev_updatingactivevalidatorstriggerfailed } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +event UpdatingActiveValidatorsTriggerFailed( + uint256 rewardEpoch +) +``` + +Unexpected failure. This should be a rare occurrence. + +
+
+ +
+ +### `UseGoodRandomSet` { #ev_usegoodrandomset } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +event UseGoodRandomSet( + bool useGoodRandom, + uint256 maxWaitForGoodRandomSeconds +) +``` + +Emitted when the requirement to provide good random numbers has changed. + +As part of [the FTSO protocol](https://docs.flare.network/tech/ftso/#data-submission-process), +data providers must submit a random number along with their price reveals. +When good random numbers are enforced, all providers that submit a hash must then +submit a reveal with a random number or they will be punished. +This is a measure against random number manipulation. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `useGoodRandom` | `bool` | Whether good random numbers are now enforced or not. | +| `maxWaitForGoodRandomSeconds` | `uint256` | Max number of seconds to wait for a good random number to be submitted. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `activate` { #fn_activate } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function activate( +) external; +``` + +Activates FTSO manager ([`daemonize`](#fn_daemonize) will run jobs). + +
+
+ +
+ +### `active` { #fn_active } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Returns whether the FTSO Manager is [`active`](#fn_active) or not. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Active status. | +
+
+ +
+ +### `addFtso` { #fn_addftso } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function addFtso( + contract IIFtso _ftso +) external; +``` + +Adds FTSO to the list of managed FTSOs, to support a new price pair. +All FTSOs in a multi-asset FTSO must be managed by the same FTSO manager. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | FTSO contract address to add. | + +
+
+ +
+ +### `addFtsosBulk` { #fn_addftsosbulk } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function addFtsosBulk( + contract IIFtso[] _ftsos +) external; +``` + +Adds a list of FTSOs to the list of managed FTSOs, to support new price pairs. +All FTSOs in a multi-asset FTSO must be managed by the same FTSO manager. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of FTSO contract addresses to add. | + +
+
+ +
+ +### `currentRewardEpochEnds` { #fn_currentrewardepochends } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function currentRewardEpochEnds( +) external view returns ( + uint256); +``` + +Returns when the current reward epoch finishes. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Time in seconds since the UNIX epoch when the current reward epoch will finish. | +
+
+ +
+ +### `daemonize` { #fn_daemonize } + +
+Defined in `IFlareDaemonize` ([Docs](./IFlareDaemonize.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFlareDaemonize.sol)). +
+ +
+ +```solidity +function daemonize( +) external returns ( + bool); +``` + +Implement this function to receive a trigger from the [`FlareDaemon`](./FlareDaemon.md). +The trigger method is called by the validator right at the end of block state transition. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Whether the contract is still active after the call. Currently unused. | +
+
+ +
+ +### `getContractName` { #fn_getcontractname } + +
+Defined in `IFlareDaemonize` ([Docs](./IFlareDaemonize.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFlareDaemonize.sol)). +
+ +
+ +```solidity +function getContractName( +) external view returns ( + string); +``` + +Implement this function to allow updating daemonized contracts through the [`AddressUpdater`](./AddressUpdater.md). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `string` | string Contract name. | +
+
+ +
+ +### `getCurrentPriceEpochData` { #fn_getcurrentpriceepochdata } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getCurrentPriceEpochData( +) external view returns ( + uint256 _priceEpochId, + uint256 _priceEpochStartTimestamp, + uint256 _priceEpochEndTimestamp, + uint256 _priceEpochRevealEndTimestamp, + uint256 _currentTimestamp); +``` + +Returns timing information for the current price epoch. +All intervals are half-closed: end time is not included. +All timestamps are in seconds since UNIX epoch. + +See the [FTSO page](https://docs.flare.network/tech/ftso/#data-submission-process) +for information about the different submission phases. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_priceEpochId` | `uint256` | Price epoch ID. | +| `_priceEpochStartTimestamp` | `uint256` | Beginning of the commit phase. | +| `_priceEpochEndTimestamp` | `uint256` | End of the commit phase. | +| `_priceEpochRevealEndTimestamp` | `uint256` | End of the reveal phase. | +| `_currentTimestamp` | `uint256` | Current time. | +
+
+ +
+ +### `getCurrentPriceEpochId` { #fn_getcurrentpriceepochid } + +
+Defined in `IFtsoManagerGenesis` ([Docs](./IFtsoManagerGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoManagerGenesis.sol)). +
+ +
+ +```solidity +function getCurrentPriceEpochId( +) external view returns ( + uint256 _priceEpochId); +``` + +Returns current price epoch ID. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_priceEpochId` | `uint256` | Currently running epoch ID. IDs are consecutive numbers starting from zero. | +
+
+ +
+ +### `getCurrentRewardEpoch` { #fn_getcurrentrewardepoch } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getCurrentRewardEpoch( +) external view returns ( + uint256); +``` + +Returns current reward epoch ID (the one currently running). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Reward epoch ID. A monotonically increasing integer. | +
+
+ +
+ +### `getElasticBandWidthPPMFtso` { #fn_getelasticbandwidthppmftso } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function getElasticBandWidthPPMFtso( + contract IIFtso _ftso +) external view returns ( + uint256); +``` + +Returns the secondary band's width in PPM (parts-per-million) of the median value, +for a given FTSO. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | The queried FTSO contract address. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Secondary band width in PPM. To obtain the actual band width, divide this number by 10^6 and multiply by the price median value. | +
+
+ +
+ +### `getFallbackMode` { #fn_getfallbackmode } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getFallbackMode( +) external view returns ( + bool _fallbackMode, + contract IIFtso[] _ftsos, + bool[] _ftsoInFallbackMode); +``` + +Returns whether the FTSO Manager is currently in fallback mode. + +In this mode only submissions from trusted providers are used. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_fallbackMode` | `bool` | True if fallback mode is enabled for the manager. | +| `_ftsos` | `contract IIFtso[]` | Array of all currently active FTSO assets. | +| `_ftsoInFallbackMode` | `bool[]` | Boolean array indicating which FTSO assets are in fallback mode. If the FTSO Manager is in fallback mode then ALL FTSOs are in fallback mode. | +
+
+ +
+ +### `getFtsos` { #fn_getftsos } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getFtsos( +) external view returns ( + contract IIFtso[] _ftsos); +``` + +Returns the list of currently [`active`](#fn_active) FTSOs. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of contract addresses for the FTSOs. | +
+
+ +
+ +### `getLastUnprocessedPriceEpochData` { #fn_getlastunprocessedpriceepochdata } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function getLastUnprocessedPriceEpochData( +) external view returns ( + uint256 _lastUnprocessedPriceEpoch, + uint256 _lastUnprocessedPriceEpochRevealEnds, + bool _lastUnprocessedPriceEpochInitialized); +``` + +Returns information regarding the currently unprocessed price epoch. +This epoch is not necessarily the last one, in case the network halts for some +time due to validator node problems, for example. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lastUnprocessedPriceEpoch` | `uint256` | ID of the price epoch that is currently waiting finalization. | +| `_lastUnprocessedPriceEpochRevealEnds` | `uint256` | When that price epoch can be finalized, in seconds since UNIX epoch. | +| `_lastUnprocessedPriceEpochInitialized` | `bool` | Whether this price epoch has been already initialized and therefore it must be finalized before the corresponding reward epoch can be finalized. | +
+
+ +
+ +### `getPriceEpochConfiguration` { #fn_getpriceepochconfiguration } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getPriceEpochConfiguration( +) external view returns ( + uint256 _firstPriceEpochStartTs, + uint256 _priceEpochDurationSeconds, + uint256 _revealEpochDurationSeconds); +``` + +Returns the current values for price epoch timing configuration. + +See the [FTSO page](https://docs.flare.network/tech/ftso/#data-submission-process) +for information about the different submission phases. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstPriceEpochStartTs` | `uint256` | Timestamp, in seconds since UNIX epoch, of the first price epoch. | +| `_priceEpochDurationSeconds` | `uint256` | Duration in seconds of the commit phase. | +| `_revealEpochDurationSeconds` | `uint256` | Duration in seconds of the reveal phase. | +
+
+ +
+ +### `getRewardEpochConfiguration` { #fn_getrewardepochconfiguration } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochConfiguration( +) external view returns ( + uint256 _firstRewardEpochStartTs, + uint256 _rewardEpochDurationSeconds); +``` + +Returns the current values for reward epoch timing configuration. + +See the [Reward epochs](https://docs.flare.network/tech/ftso/#vote-power) box. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_firstRewardEpochStartTs` | `uint256` | Timestamp, in seconds since UNIX epoch, of the first reward epoch. | +| `_rewardEpochDurationSeconds` | `uint256` | Duration in seconds of the reward epochs. | +
+
+ +
+ +### `getRewardEpochData` { #fn_getrewardepochdata } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochData( + uint256 _rewardEpochId +) external view returns ( + struct IIFtsoManager.RewardEpochData); +``` + +Returns data regarding a specific reward epoch ID. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpochId` | `uint256` | Epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IIFtsoManager.RewardEpochData` | RewardEpochData Its associated data. | +
+
+ +
+ +### `getRewardEpochToExpireNext` { #fn_getrewardepochtoexpirenext } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochToExpireNext( +) external view returns ( + uint256); +``` + +Return reward epoch that will expire next, when a new reward epoch is initialized. + +Reward epochs older than 90 days expire, and any unclaimed rewards in them become +inaccessible. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Reward epoch ID. | +
+
+ +
+ +### `getRewardEpochVotePowerBlock` { #fn_getrewardepochvotepowerblock } + +
+Defined in `IFtsoManager` ([Docs](./IFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoManager.sol)). +
+ +
+ +```solidity +function getRewardEpochVotePowerBlock( + uint256 _rewardEpoch +) external view returns ( + uint256); +``` + +Returns the [vote power block](https://docs.flare.network/tech/ftso/#vote-power) +that was used for a past reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | The queried reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 The block number of that reward epoch's vote power block. | +
+
+ +
+ +### `getRewardExpiryOffsetSeconds` { #fn_getrewardexpiryoffsetseconds } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function getRewardExpiryOffsetSeconds( +) external view returns ( + uint256); +``` + +Returns the currently configured reward expiration time. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Unclaimed rewards accrued in reward epochs more than this amount of seconds in the past expire and become inaccessible. | +
+
+ +
+ +### `notInitializedFtsos` { #fn_notinitializedftsos } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function notInitializedFtsos( + contract IIFtso +) external view returns ( + bool); +``` + +Returns whether an FTSO has been initialized. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Initialization state. | +
+
+ +
+ +### `removeFtso` { #fn_removeftso } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function removeFtso( + contract IIFtso _ftso +) external; +``` + +Removes an FTSO from the list of managed FTSOs. +Reverts if FTSO is used in a multi-asset FTSO. +Deactivates the `_ftso`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | FTSO contract address to remove. | + +
+
+ +
+ +### `replaceFtso` { #fn_replaceftso } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function replaceFtso( + contract IIFtso _ftsoToAdd, + bool copyCurrentPrice, + bool copyAssetOrAssetFtsos +) external; +``` + +Replaces one FTSO with another with the same symbol. +All FTSOs in a multi-asset FTSO must be managed by the same FTSO manager. +Deactivates the old FTSO. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoToAdd` | `contract IIFtso` | FTSO contract address to add. An existing FTSO with the same symbol will be removed. | +| `copyCurrentPrice` | `bool` | When true, initializes the new FTSO with the current price of the previous FTSO. | +| `copyAssetOrAssetFtsos` | `bool` | When true, initializes the new FTSO with the current asset or asset FTSOs of the previous FTSO. | + +
+
+ +
+ +### `replaceFtsosBulk` { #fn_replaceftsosbulk } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function replaceFtsosBulk( + contract IIFtso[] _ftsosToAdd, + bool copyCurrentPrice, + bool copyAssetOrAssetFtsos +) external; +``` + +Replaces a list of FTSOs with other FTSOs with the same symbol. +All FTSOs in a multi-asset FTSO must be managed by the same FTSO manager. +Deactivates the old FTSOs. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsosToAdd` | `contract IIFtso[]` | Array of FTSO contract addresses to add. Every existing FTSO with the same symbols will be removed. | +| `copyCurrentPrice` | `bool` | When true, initializes the new FTSOs with the current price of the previous FTSOs. | +| `copyAssetOrAssetFtsos` | `bool` | When true, initializes the new FTSOs with the current asset or asset FTSOs of the previous FTSOs. | + +
+
+ +
+ +### `rewardEpochDurationSeconds` { #fn_rewardepochdurationseconds } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function rewardEpochDurationSeconds( +) external view returns ( + uint256); +``` + +Currently configured reward epoch duration. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Reward epoch duration, in seconds. | +
+
+ +
+ +### `rewardEpochs` { #fn_rewardepochs } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function rewardEpochs( + uint256 _rewardEpochId +) external view returns ( + uint256 _votepowerBlock, + uint256 _startBlock, + uint256 _startTimestamp); +``` + +Returns information about a reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpochId` | `uint256` | The epoch ID to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_votepowerBlock` | `uint256` | The [vote power block](https://docs.flare.network/tech/ftso/#vote-power) of the epoch. | +| `_startBlock` | `uint256` | The first block of the epoch. | +| `_startTimestamp` | `uint256` | Timestamp of the epoch start, in seconds since UNIX epoch. | +
+
+ +
+ +### `rewardEpochsStartTs` { #fn_rewardepochsstartts } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function rewardEpochsStartTs( +) external view returns ( + uint256); +``` + +Time when the current reward epoch started. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Timestamp, in seconds since UNIX epoch. | +
+
+ +
+ +### `setFallbackMode` { #fn_setfallbackmode } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function setFallbackMode( + bool _fallbackMode +) external; +``` + +Sets whether the FTSO Manager is currently in fallback mode. +In this mode only submissions from trusted providers are used. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_fallbackMode` | `bool` | True if fallback mode is enabled. | + +
+
+ +
+ +### `setFtsoAsset` { #fn_setftsoasset } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function setFtsoAsset( + contract IIFtso _ftso, + contract IIVPToken _asset +) external; +``` + +Sets the asset tracked by an FTSO. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | The FTSO contract address. | +| `_asset` | `contract IIVPToken` | The [`VPToken`](./VPToken.md) contract address of the asset to track. | + +
+
+ +
+ +### `setFtsoAssetFtsos` { #fn_setftsoassetftsos } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function setFtsoAssetFtsos( + contract IIFtso _ftso, + contract IIFtso[] _assetFtsos +) external; +``` + +Sets an array of FTSOs to be tracked by a multi-asset FTSO. +FTSOs implicitly determine the FTSO assets. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | The multi-asset FTSO contract address. | +| `_assetFtsos` | `contract IIFtso[]` | Array of FTSOs to be tracked. | + +
+
+ +
+ +### `setFtsoFallbackMode` { #fn_setftsofallbackmode } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function setFtsoFallbackMode( + contract IIFtso _ftso, + bool _fallbackMode +) external; +``` + +Sets whether an FTSO is currently in fallback mode. +In this mode only submissions from trusted providers are used. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | The FTSO contract address. | +| `_fallbackMode` | `bool` | Fallback mode. | + +
+
+ +
+ +### `setGovernanceParameters` { #fn_setgovernanceparameters } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function setGovernanceParameters( + uint256 _updateTs, + uint256 _maxVotePowerNatThresholdFraction, + uint256 _maxVotePowerAssetThresholdFraction, + uint256 _lowAssetUSDThreshold, + uint256 _highAssetUSDThreshold, + uint256 _highAssetTurnoutThresholdBIPS, + uint256 _lowNatTurnoutThresholdBIPS, + uint256 _elasticBandRewardBIPS, + uint256 _rewardExpiryOffsetSeconds, + address[] _trustedAddresses +) external; +``` + +Sets governance parameters for FTSOs + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_updateTs` | `uint256` | Time, in seconds since UNIX epoch, when updated settings should be pushed to FTSOs. | +| `_maxVotePowerNatThresholdFraction` | `uint256` | High threshold for native token vote power per voter. | +| `_maxVotePowerAssetThresholdFraction` | `uint256` | High threshold for asset vote power per voter | +| `_lowAssetUSDThreshold` | `uint256` | Threshold for low asset vote power (in scaled USD). | +| `_highAssetUSDThreshold` | `uint256` | Threshold for high asset vote power (in scaled USD). | +| `_highAssetTurnoutThresholdBIPS` | `uint256` | Threshold for high asset turnout (in BIPS). | +| `_lowNatTurnoutThresholdBIPS` | `uint256` | Threshold for low nat turnout (in BIPS). | +| `_elasticBandRewardBIPS` | `uint256` | Secondary reward band, where _elasticBandRewardBIPS goes to the secondary band and 10000 - _elasticBandRewardBIPS to the primary (IQR) band. | +| `_rewardExpiryOffsetSeconds` | `uint256` | Reward epochs closed earlier than block.timestamp - _rewardExpiryOffsetSeconds expire. | +| `_trustedAddresses` | `address[]` | Trusted addresses will be used as a fallback mechanism for setting the price. | + +
+
+ +
+ +### `setInitialRewardData` { #fn_setinitialrewarddata } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +```solidity +function setInitialRewardData( + uint256 _nextRewardEpochToExpire, + uint256 _rewardEpochsLength, + uint256 _currentRewardEpochEnds +) external; +``` + +Set reward data to values from old ftso manager. +Can only be called before activation. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_nextRewardEpochToExpire` | `uint256` | See `getRewardEpochToExpireNext`. | +| `_rewardEpochsLength` | `uint256` | See `getRewardEpochConfiguration`. | +| `_currentRewardEpochEnds` | `uint256` | See `getCurrentRewardEpoch`. | + +
+
+ +
+ +### `switchToFallbackMode` { #fn_switchtofallbackmode } + +
+Defined in `IFlareDaemonize` ([Docs](./IFlareDaemonize.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFlareDaemonize.sol)). +
+ +
+ +```solidity +function switchToFallbackMode( +) external returns ( + bool); +``` + +This function will be called after an error is caught in [`daemonize`](#fn_daemonize). +It will switch the contract to a simpler fallback mode, which hopefully works when full mode doesn't. +Not every contract needs to support fallback mode ([`FtsoManager`](./FtsoManager.md) does), so this method may be empty. +Switching back to normal mode is left to the contract (typically a governed method call). +This function may be called due to low-gas error, so it shouldn't use more than ~30.000 gas. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | True if switched to fallback mode, false if already in fallback mode or if fallback mode is not supported. | +
+
+ +
+ +
+ +## Structures + +
+ +### `RewardEpochData` { #st_rewardepochdata } + +
+Defined in `IIFtsoManager` ([Docs](./IIFtsoManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/ftso/interface/IIFtsoManager.sol)). +
+ +
+ +
+```solidity +struct RewardEpochData { + uint256 votepowerBlock; + uint256 startBlock; + uint256 startTimestamp; +} +``` + +
+ +
+ diff --git a/docs/apis/smart-contracts/IIFtsoRegistry.md b/docs/apis/smart-contracts/IIFtsoRegistry.md new file mode 100644 index 000000000..d0673b1fd --- /dev/null +++ b/docs/apis/smart-contracts/IIFtsoRegistry.md @@ -0,0 +1,571 @@ +--- +title: IIFtsoRegistry +--- + + + +# `IIFtsoRegistry` { #ct_iiftsoregistry } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIFtsoRegistry.sol) | Inherits from [IFtsoRegistry](./IFtsoRegistry.md) +
+ +
+ +Internal interface for the [`FtsoRegistry`](./FtsoRegistry.md) contract. + +
+ +
+ +## Functions + +
+ +### `addFtso` { #fn_addftso } + +
+Defined in `IIFtsoRegistry` ([Docs](./IIFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIFtsoRegistry.sol)). +
+ +
+ +```solidity +function addFtso( + contract IIFtso _ftsoContract +) external returns ( + uint256); +``` + +Add a new FTSO contract to the registry. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoContract` | `contract IIFtso` | New target FTSO contract. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The FTSO index assigned to the new asset. | +
+
+ +
+ +### `getAllCurrentPrices` { #fn_getallcurrentprices } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getAllCurrentPrices( +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of all supported assets. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getCurrentPrice` { #fn_getcurrentprice } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPrice( + uint256 _ftsoIndex +) external view returns ( + uint256 _price, + uint256 _timestamp); +``` + +Public view function to get the current price of a given active FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Current price of the asset in USD multiplied by 10^`ASSET_PRICE_USD_DECIMALS`. | +| `_timestamp` | `uint256` | Timestamp for when this price was updated, in seconds since UNIX epoch. | +
+
+ +
+ +### `getCurrentPriceWithDecimals` { #fn_getcurrentpricewithdecimals } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPriceWithDecimals( + uint256 _assetIndex +) external view returns ( + uint256 _price, + uint256 _timestamp, + uint256 _assetPriceUsdDecimals); +``` + +Public view function to get the current price and decimals of a given active FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_assetIndex` | `uint256` | Index to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_price` | `uint256` | Current price of the asset in USD multiplied by 10^`_assetPriceUsdDecimals`. | +| `_timestamp` | `uint256` | Timestamp for when this price was updated, in seconds since UNIX epoch. | +| `_assetPriceUsdDecimals` | `uint256` | Number of decimals used to return the `_price`. | +
+
+ +
+ +### `getCurrentPricesByIndices` { #fn_getcurrentpricesbyindices } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPricesByIndices( + uint256[] _indices +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of a list of indices. +Reverts if any of the indices is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_indices` | `uint256[]` | Array of indices to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getCurrentPricesBySymbols` { #fn_getcurrentpricesbysymbols } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getCurrentPricesBySymbols( + string[] _symbols +) external view returns ( + struct IFtsoRegistry.PriceInfo[]); +``` + +Returns the current price of a list of asset symbols. +Reverts if any of the symbols is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbols` | `string[]` | Array of symbols to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct IFtsoRegistry.PriceInfo[]` | Array of `PriceInfo` structures. | +
+
+ +
+ +### `getFtso` { #fn_getftso } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtso( + uint256 _activeFtso +) external view returns ( + contract IIFtso _activeFtsoAddress); +``` + +Returns the address of the FTSO contract for a given index. +Reverts if unsupported index is passed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_activeFtso` | `uint256` | The queried index. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_activeFtsoAddress` | `contract IIFtso` | FTSO contract address for the queried index. | +
+
+ +
+ +### `getFtsoBySymbol` { #fn_getftsobysymbol } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoBySymbol( + string _symbol +) external view returns ( + contract IIFtso _activeFtsoAddress); +``` + +Returns the address of the FTSO contract for a given symbol. +Reverts if unsupported symbol is passed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | The queried symbol. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_activeFtsoAddress` | `contract IIFtso` | FTSO contract address for the queried symbol. | +
+
+ +
+ +### `getFtsoIndex` { #fn_getftsoindex } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoIndex( + string _symbol +) external view returns ( + uint256 _assetIndex); +``` + +Returns the FTSO index corresponding to a given asset symbol. +Reverts if the symbol is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | Symbol to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_assetIndex` | `uint256` | The corresponding asset index. | +
+
+ +
+ +### `getFtsoSymbol` { #fn_getftsosymbol } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getFtsoSymbol( + uint256 _ftsoIndex +) external view returns ( + string _symbol); +``` + +Returns the asset symbol corresponding to a given FTSO index. +Reverts if the index is not supported. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_symbol` | `string` | The corresponding asset symbol. | +
+
+ +
+ +### `getFtsos` { #fn_getftsos } + +
+Defined in `IFtsoRegistryGenesis` ([Docs](./IFtsoRegistryGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFtsoRegistryGenesis.sol)). +
+ +
+ +```solidity +function getFtsos( + uint256[] _indices +) external view returns ( + contract IFtsoGenesis[] _ftsos); +``` + +Get the addresses of the active FTSOs at the given indices. +Reverts if any of the provided indices is non-existing or inactive. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_indices` | `uint256[]` | Array of FTSO indices to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IFtsoGenesis[]` | The array of FTSO addresses. | +
+
+ +
+ +### `getSupportedFtsos` { #fn_getsupportedftsos } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedFtsos( +) external view returns ( + contract IIFtso[] _ftsos); +``` + +Get array of all FTSO contracts for all supported asset indices. +The index of FTSO in returned array does not necessarily correspond to the asset's index. +Due to deletion, some indices might be unsupported. + +Use [`getSupportedIndicesAndFtsos`](#fn_getsupportedindicesandftsos) to retrieve pairs of correct indices and FTSOs, +where possible "null" holes are readily apparent. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSOs. | +
+
+ +
+ +### `getSupportedIndices` { #fn_getsupportedindices } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndices( +) external view returns ( + uint256[] _supportedIndices); +``` + +Returns the indices of the currently supported FTSOs. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all active FTSO indices in increasing order. | +
+
+ +
+ +### `getSupportedIndicesAndFtsos` { #fn_getsupportedindicesandftsos } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesAndFtsos( +) external view returns ( + uint256[] _supportedIndices, + contract IIFtso[] _ftsos); +``` + +Get all supported indices and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +### `getSupportedIndicesAndSymbols` { #fn_getsupportedindicesandsymbols } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesAndSymbols( +) external view returns ( + uint256[] _supportedIndices, + string[] _supportedSymbols); +``` + +Get all supported indices and corresponding symbols. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +
+
+ +
+ +### `getSupportedIndicesSymbolsAndFtsos` { #fn_getsupportedindicessymbolsandftsos } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedIndicesSymbolsAndFtsos( +) external view returns ( + uint256[] _supportedIndices, + string[] _supportedSymbols, + contract IIFtso[] _ftsos); +``` + +Get all supported indices, symbols, and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of all supported indices. | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +### `getSupportedSymbols` { #fn_getsupportedsymbols } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedSymbols( +) external view returns ( + string[] _supportedSymbols); +``` + +Returns the symbols of the currently supported FTSOs. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedSymbols` | `string[]` | Array of all active FTSO symbols in increasing order. | +
+
+ +
+ +### `getSupportedSymbolsAndFtsos` { #fn_getsupportedsymbolsandftsos } + +
+Defined in `IFtsoRegistry` ([Docs](./IFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRegistry.sol)). +
+ +
+ +```solidity +function getSupportedSymbolsAndFtsos( +) external view returns ( + string[] _supportedSymbols, + contract IIFtso[] _ftsos); +``` + +Get all supported symbols and corresponding FTSO addresses. +Active FTSOs are ones that currently receive price feeds. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedSymbols` | `string[]` | Array of all supported symbols. | +| `_ftsos` | `contract IIFtso[]` | Array of all supported FTSO addresses. | +
+
+ +
+ +### `removeFtso` { #fn_removeftso } + +
+Defined in `IIFtsoRegistry` ([Docs](./IIFtsoRegistry.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIFtsoRegistry.sol)). +
+ +
+ +```solidity +function removeFtso( + contract IIFtso _ftso +) external; +``` + +Removes the FTSO and keeps part of the history. +Reverts if the provided address is not supported. + +From now on, the index this asset was using is "reserved" and cannot be used again. +It will not be returned in any list of currently supported assets. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftso` | `contract IIFtso` | Address of the FTSO contract to remove. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIFtsoRewardManager.md b/docs/apis/smart-contracts/IIFtsoRewardManager.md new file mode 100644 index 000000000..bcbced69c --- /dev/null +++ b/docs/apis/smart-contracts/IIFtsoRewardManager.md @@ -0,0 +1,1417 @@ +--- +title: IIFtsoRewardManager +--- + + + +# `IIFtsoRewardManager` { #ct_iiftsorewardmanager } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol) | Inherits from [IFtsoRewardManager](./IFtsoRewardManager.md), [IIInflationReceiver](./IIInflationReceiver.md), [IITokenPool](./IITokenPool.md) +
+ +
+ +Internal interface for the [`FtsoRewardManager`](./FtsoRewardManager.md). + +
+ +
+ +## Events + +
+ +### `DailyAuthorizedInflationSet` { #ev_dailyauthorizedinflationset } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +event DailyAuthorizedInflationSet( + uint256 authorizedAmountWei +) +``` + +Emitted when the contract's daily authorized inflation has been set. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `authorizedAmountWei` | `uint256` | Authorized amount of native tokens, in wei. | + +
+
+ +
+ +### `FeePercentageChanged` { #ev_feepercentagechanged } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event FeePercentageChanged( + address dataProvider, + uint256 value, + uint256 validFromEpoch +) +``` + +Emitted when a data provider changes its fee. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `dataProvider` | `address` | Address of the data provider. | +| `value` | `uint256` | New fee, in BIPS. | +| `validFromEpoch` | `uint256` | Epoch ID where the new fee takes effect. | + +
+
+ +
+ +### `FtsoRewardManagerActivated` { #ev_ftsorewardmanageractivated } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event FtsoRewardManagerActivated( + address ftsoRewardManager +) +``` + +Emitted when the reward manager contract is activated. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftsoRewardManager` | `address` | The reward manager contract. | + +
+
+ +
+ +### `FtsoRewardManagerDeactivated` { #ev_ftsorewardmanagerdeactivated } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event FtsoRewardManagerDeactivated( + address ftsoRewardManager +) +``` + +Emitted when the reward manager contract is deactivated. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftsoRewardManager` | `address` | The reward manager contract. | + +
+
+ +
+ +### `InflationReceived` { #ev_inflationreceived } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +event InflationReceived( + uint256 amountReceivedWei +) +``` + +Emitted when the contract has received the daily inflation amount. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `amountReceivedWei` | `uint256` | Received amount of native tokens, in wei. | + +
+
+ +
+ +### `RewardClaimed` { #ev_rewardclaimed } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardClaimed( + address dataProvider, + address whoClaimed, + address sentTo, + uint256 rewardEpoch, + uint256 amount +) +``` + +Emitted when a data provider claims its FTSO rewards. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `dataProvider` | `address` | Address of the data provider that accrued the reward. | +| `whoClaimed` | `address` | Address that actually performed the claim. | +| `sentTo` | `address` | Address that received the reward. | +| `rewardEpoch` | `uint256` | ID of the reward epoch where the reward was accrued. | +| `amount` | `uint256` | Amount of rewarded native tokens (wei). | + +
+
+ +
+ +### `RewardClaimsEnabled` { #ev_rewardclaimsenabled } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardClaimsEnabled( + uint256 rewardEpochId +) +``` + +Emitted when reward claims have been enabled. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `rewardEpochId` | `uint256` | First claimable reward epoch. | + +
+
+ +
+ +### `RewardClaimsExpired` { #ev_rewardclaimsexpired } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardClaimsExpired( + uint256 rewardEpochId +) +``` + +Unclaimed rewards have expired and are now inaccessible. + +`getUnclaimedReward()` can be used to retrieve more information. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `rewardEpochId` | `uint256` | ID of the reward epoch that has just expired. | + +
+
+ +
+ +### `RewardsBurned` { #ev_rewardsburned } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardsBurned( + uint256 amountBurnedWei +) +``` + +Emitted when unclaimed rewards are burned. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `amountBurnedWei` | `uint256` | Burned amount of native tokens, in wei. | + +
+
+ +
+ +### `RewardsDistributed` { #ev_rewardsdistributed } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event RewardsDistributed( + address ftso, + uint256 epochId, + address[] addresses, + uint256[] rewards +) +``` + +Emitted every price epoch, when rewards have been distributed to each contributing data provider. +Note that rewards are not claimable until the reward epoch finishes. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `ftso` | `address` | Address of the FTSO that generated the rewards. | +| `epochId` | `uint256` | ID of the reward epoch where the rewards were accrued. | +| `addresses` | `address[]` | Data provider addresses that have rewards to claim. | +| `rewards` | `uint256[]` | Amounts available for claiming (wei). | + +
+
+ +
+ +### `UnearnedRewardsAccrued` { #ev_unearnedrewardsaccrued } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +event UnearnedRewardsAccrued( + uint256 epochId, + uint256 reward +) +``` + +Emitted when rewards cannot be distributed during a reward epoch +(for example, because the FTSO went into fallback mode) and they are accrued +for later burning. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `epochId` | `uint256` | ID of the reward epoch where the reward was accrued. | +| `reward` | `uint256` | Total amount of accrued rewards (wei). | + +
+
+ +
+ +
+ +## Functions + +
+ +### `accrueUnearnedRewards` { #fn_accrueunearnedrewards } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function accrueUnearnedRewards( + uint256 epochId, + uint256 priceEpochDurationSeconds, + uint256 priceEpochEndTime +) external; +``` + +Accrue unearned rewards for a given price epoch. +Typically done when the FTSO is in fallback mode or because of insufficient vote power. +Simply accrue them so they will not be distributed and will be burned later. + +The amount of rewards that will be burned is calculated in the same way as in [`distributeRewards`](#fn_distributerewards). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `epochId` | `uint256` | Price epoch ID. | +| `priceEpochDurationSeconds` | `uint256` | Duration of price epochs (180s). | +| `priceEpochEndTime` | `uint256` | Timestamp of the price epoch end time (end of submit period), in seconds since UNIX epoch. | + +
+
+ +
+ +### `activate` { #fn_activate } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function activate( +) external; +``` + +Activates reward manager (allows claiming rewards). + +
+
+ +
+ +### `active` { #fn_active } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function active( +) external view returns ( + bool); +``` + +Whether rewards can be claimed from this reward manager. + +
+
+ +
+ +### `autoClaim` { #fn_autoclaim } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function autoClaim( + address[] _rewardOwners, + uint256 _rewardEpoch +) external; +``` + +Allows claiming rewards simultaneously for a list of reward owners and all unclaimed epochs before the +specified one. + +This is meant as a convenience all-in-one reward claiming method to be used both by reward owners and +[registered executors](https://docs.flare.network/tech/automatic-claiming/#registered-claiming-process). +It performs a series of operations, besides claiming rewards: + +* If a reward owner has enabled its +[Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account), rewards are also +claimed for the PDA and the total claimed amount is sent to that PDA. +Otherwise, the claimed amount is sent to the reward owner's account. + +* Claimed amount is automatically wrapped through the [`WNat`](./WNat.md) contract. + +* If the caller is a registered executor with a non-zero fee, the fee is paid to the executor for each claimed +address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwners` | `address[]` | List of reward owners to claim for. | +| `_rewardEpoch` | `uint256` | Last reward epoch ID to claim for. All previous epochs with pending rewards will be claimed too. | + +
+
+ +
+ +### `claim` { #fn_claim } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function claim( + address _rewardOwner, + address payable _recipient, + uint256 _rewardEpoch, + bool _wrap +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards for a reward owner. +The caller does not have to be the owner of the rewards, but must be approved by the owner to [`claim`](#fn_claim) on his +behalf by using `setClaimExecutors` on the `claimSetupManager`. + +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by percentage. +Reverts if `msg.sender` is delegating by amount. + +Anybody can call this method, but rewards can only be sent to the reward owner, therefore no funds can be +stolen. However, by limiting the authorized callers, the owner can control the timing of the calls. + +When the reward owner is the caller, rewards can be sent to any recipient set by `setAllowedClaimRecipients` on +the `claimSetupManager`. +The reward owner's [Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) +is always an authorized recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner. | +| `_recipient` | `address payable` | Address to transfer claimed rewards to. | +| `_rewardEpoch` | `uint256` | Last reward epoch to claim for. All previous epochs with pending rewards will be claimed too. | +| `_wrap` | `bool` | Whether claimed rewards should be wrapped through the [`WNat`](./WNat.md) contract before transferring them to the `_recipient`. This parameter is offered as a convenience. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `claimFromDataProviders` { #fn_claimfromdataproviders } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimFromDataProviders( + address _rewardOwner, + address payable _recipient, + uint256[] _rewardEpochs, + address[] _dataProviders, + bool _wrap +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards for a reward owner from specific data providers. +The caller does not have to be the owner of the rewards, but must be approved by the owner to [`claim`](#fn_claim) on his +behalf by using `setClaimExecutors` on the `claimSetupManager`. + +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by amount (explicit delegation). +Reverts if `msg.sender` is delegating by percentage. + +Anybody can call this method, but rewards can only be sent to the reward owner, therefore no funds can be +stolen. However, by limiting the authorized callers, the owner can control the timing of the calls. + +When the reward owner is the caller, rewards can be sent to any recipient set by `setAllowedClaimRecipients` on +the `claimSetupManager`. +The reward owner's [Personal Delegation Account](https://docs.flare.network/tech/personal-delegation-account) +is always an authorized recipient. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner. | +| `_recipient` | `address payable` | Address to transfer claimed rewards to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch IDs to claim for. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to claim the reward from. | +| `_wrap` | `bool` | Whether claimed rewards should be wrapped through the [`WNat`](./WNat.md) contract before transferring them to the `_recipient`. This parameter is offered as a convenience. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `claimReward` { #fn_claimreward } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimReward( + address payable _recipient, + uint256[] _rewardEpochs +) external returns ( + uint256 _rewardAmount); +``` + +Allows a percentage delegator to [`claim`](#fn_claim) rewards. +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by percentage. + +**This function is deprecated**: use [`claim`](#fn_claim) instead. + +Reverts if `msg.sender` is delegating by amount. +Claims for all unclaimed reward epochs to the 'max(_rewardEpochs)'. +Retained for backward compatibility. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipient` | `address payable` | Address to transfer funds to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch numbers to claim for. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Amount of total claimed rewards (wei). | +
+
+ +
+ +### `claimRewardFromDataProviders` { #fn_claimrewardfromdataproviders } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function claimRewardFromDataProviders( + address payable _recipient, + uint256[] _rewardEpochs, + address[] _dataProviders +) external returns ( + uint256 _rewardAmount); +``` + +Allows the caller to [`claim`](#fn_claim) rewards from specific data providers. +This function is intended to be used to [`claim`](#fn_claim) rewards in case of delegation by amount. + +**This function is deprecated**: use [`claimFromDataProviders`](#fn_claimfromdataproviders) instead. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipient` | `address payable` | Address to transfer funds to. | +| `_rewardEpochs` | `uint256[]` | Array of reward epoch numbers to claim for. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to claim the reward from. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Total amount of claimed rewards (wei). | +
+
+ +
+ +### `closeExpiredRewardEpoch` { #fn_closeexpiredrewardepoch } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function closeExpiredRewardEpoch( + uint256 _rewardEpochId +) external; +``` + +Collects funds from expired reward epoch and calculates totals. + +Triggered by ftsoManager on finalization of a reward epoch. +Operation is irreversible: when some reward epoch is closed according to current +settings, it cannot be reopened even if new parameters would +allow it, because `nextRewardEpochToExpire` in ftsoManager never decreases. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpochId` | `uint256` | ID of the epoch to close. | + +
+
+ +
+ +### `deactivate` { #fn_deactivate } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function deactivate( +) external; +``` + +Deactivates reward manager (prevents claiming rewards). + +
+
+ +
+ +### `distributeRewards` { #fn_distributerewards } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function distributeRewards( + address[] addresses, + uint256[] weights, + uint256 totalWeight, + uint256 epochId, + address ftso, + uint256 priceEpochDurationSeconds, + uint256 currentRewardEpoch, + uint256 priceEpochEndTime, + uint256 votePowerBlock +) external; +``` + +Distributes price epoch rewards to data provider accounts, according to input parameters. +Must be called with `totalWeight` > 0 and `addresses.length` > 0. + +The amount of rewards for a given price epoch ID are calculated in [`FtsoRewardManager`](./FtsoRewardManager.md) from +`priceEpochDurationSeconds`, `priceEpochEndTime` and inflation authorization data +(see `_getTotalPriceEpochRewardWei` in [`FtsoRewardManager`](./FtsoRewardManager.md). +Then each data provider address is given a portion of this amount according to corresponding weight +and total sum of weights. + +Parameters `epochId` and `ftso` are only needed so they can be passed onto the emitted event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `addresses` | `address[]` | Data provider addresses to reward. | +| `weights` | `uint256[]` | Weights corresponding to rewarded addresses. | +| `totalWeight` | `uint256` | Sum of all weights. | +| `epochId` | `uint256` | Price epoch ID. | +| `ftso` | `address` | Randomly chosen FTSO contract used to calculate the weights. | +| `priceEpochDurationSeconds` | `uint256` | Duration of price epochs (180s). | +| `currentRewardEpoch` | `uint256` | ID of the current reward epoch. Rewards for the price epoch are added to this reward epoch. | +| `priceEpochEndTime` | `uint256` | Timestamp of the price epoch end time (end of submit period), in seconds since UNIX epoch. | +| `votePowerBlock` | `uint256` | Vote power block used in the given reward epoch. | + +
+
+ +
+ +### `enableClaims` { #fn_enableclaims } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function enableClaims( +) external; +``` + +Enable claiming for current and all future reward epochs. + +
+
+ +
+ +### `firstClaimableRewardEpoch` { #fn_firstclaimablerewardepoch } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function firstClaimableRewardEpoch( +) external view returns ( + uint256); +``` + +Epochs before the token distribution event at Flare launch were not be claimable. +Use this method to know the first reward epoch that was claimable. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 The first reward epoch that can be claimed. | +
+
+ +
+ +### `getClaimedReward` { #fn_getclaimedreward } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getClaimedReward( + uint256 _rewardEpoch, + address _dataProvider, + address _claimer +) external view returns ( + bool _claimed, + uint256 _amount); +``` + +Returns information on the rewards accrued by a reward owner from a specific data provider at a specific +reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | +| `_dataProvider` | `address` | Address of the data provider to query. | +| `_claimer` | `address` | Address of the reward owner to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_claimed` | `bool` | Whether the reward has been claimed or not. | +| `_amount` | `uint256` | Accrued amount in wei. | +
+
+ +
+ +### `getContractName` { #fn_getcontractname } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function getContractName( +) external view returns ( + string); +``` + +Implement this function to allow updating inflation receiver contracts through [`AddressUpdater`](./AddressUpdater.md). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `string` | Contract name. | +
+
+ +
+ +### `getCurrentRewardEpoch` { #fn_getcurrentrewardepoch } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getCurrentRewardEpoch( +) external view returns ( + uint256); +``` + +Returns the current reward epoch ID. + +
+
+ +
+ +### `getDataProviderCurrentFeePercentage` { #fn_getdataprovidercurrentfeepercentage } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderCurrentFeePercentage( + address _dataProvider +) external view returns ( + uint256 _feePercentageBIPS); +``` + +Returns the current [fee](https://docs.flare.network/tech/ftso/#rewards) percentage of a data provider. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256` | Fee percentage in BIPS. | +
+
+ +
+ +### `getDataProviderFeePercentage` { #fn_getdataproviderfeepercentage } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderFeePercentage( + address _dataProvider, + uint256 _rewardEpoch +) external view returns ( + uint256 _feePercentageBIPS); +``` + +Returns the [fee](https://docs.flare.network/tech/ftso/#rewards) percentage of a data provider at a +given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256` | Fee percentage in BIPS. | +
+
+ +
+ +### `getDataProviderPerformanceInfo` { #fn_getdataproviderperformanceinfo } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderPerformanceInfo( + uint256 _rewardEpoch, + address _dataProvider +) external view returns ( + uint256 _rewardAmount, + uint256 _votePowerIgnoringRevocation); +``` + +Returns information on rewards and vote power of a data provider at a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | +| `_dataProvider` | `address` | Address of the data provider to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmount` | `uint256` | Amount of rewards (wei). | +| `_votePowerIgnoringRevocation` | `uint256` | Vote power, not including revocations. | +
+
+ +
+ +### `getDataProviderScheduledFeePercentageChanges` { #fn_getdataproviderscheduledfeepercentagechanges } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getDataProviderScheduledFeePercentageChanges( + address _dataProvider +) external view returns ( + uint256[] _feePercentageBIPS, + uint256[] _validFromEpoch, + bool[] _fixed); +``` + +Returns the scheduled [fee](https://docs.flare.network/tech/ftso/#rewards) percentage changes for a data +provider. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_dataProvider` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256[]` | Array of fee percentages in BIPS. | +| `_validFromEpoch` | `uint256[]` | Array of block numbers from which the fee settings are effective. | +| `_fixed` | `bool[]` | Array of boolean values indicating whether settings are subject to change or not. | +
+
+ +
+ +### `getEpochReward` { #fn_getepochreward } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochReward( + uint256 _rewardEpoch +) external view returns ( + uint256 _totalReward, + uint256 _claimedReward); +``` + +Returns information on an epoch's rewards. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_totalReward` | `uint256` | Total amount of rewards accrued on that epoch, in wei. | +| `_claimedReward` | `uint256` | Total amount of rewards that have already been claimed, in wei. | +
+
+ +
+ +### `getEpochsWithClaimableRewards` { #fn_getepochswithclaimablerewards } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochsWithClaimableRewards( +) external view returns ( + uint256 _startEpochId, + uint256 _endEpochId); +``` + +Returns the reward epoch range for which rewards can be claimed. +Rewards outside this range are unclaimable, either because they have expired or because the reward epoch is +still ongoing. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_startEpochId` | `uint256` | The oldest epoch ID that allows reward claiming. | +| `_endEpochId` | `uint256` | The newest epoch ID that allows reward claiming. | +
+
+ +
+ +### `getEpochsWithUnclaimedRewards` { #fn_getepochswithunclaimedrewards } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getEpochsWithUnclaimedRewards( + address _beneficiary +) external view returns ( + uint256[] _epochIds); +``` + +Returns the array of claimable epoch IDs for which the rewards of a reward owner have not yet been claimed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of the reward owner to query. Reverts if it uses delegation by amount. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_epochIds` | `uint256[]` | Array of epoch IDs. | +
+
+ +
+ +### `getExpectedBalance` { #fn_getexpectedbalance } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function getExpectedBalance( +) external view returns ( + uint256); +``` + +Returns the contract's expected balance +(actual balance may be higher due to self-destruct funds). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Expected native token balance. | +
+
+ +
+ +### `getInflationAddress` { #fn_getinflationaddress } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function getInflationAddress( +) external returns ( + address); +``` + +Returns the address of the [`Inflation`](./Inflation.md) contract. + +
+
+ +
+ +### `getInitialRewardEpoch` { #fn_getinitialrewardepoch } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getInitialRewardEpoch( +) external view returns ( + uint256); +``` + +Returns the initial reward epoch ID for this reward manager contract. +This corresponds to the oldest reward epoch with claimable rewards in the previous reward manager when this +one took over. +Set by governance through `setInitialRewardData`. + +
+
+ +
+ +### `getRewardEpochToExpireNext` { #fn_getrewardepochtoexpirenext } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getRewardEpochToExpireNext( +) external view returns ( + uint256); +``` + +Returns the reward epoch that will expire next once a new reward epoch starts. + +
+
+ +
+ +### `getRewardEpochVotePowerBlock` { #fn_getrewardepochvotepowerblock } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getRewardEpochVotePowerBlock( + uint256 _rewardEpoch +) external view returns ( + uint256); +``` + +Returns the [vote power block](https://docs.flare.network/tech/ftso/#vote-power) of a given reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Reward epoch ID. | + +
+
+ +
+ +### `getStateOfRewards` { #fn_getstateofrewards } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getStateOfRewards( + address _beneficiary, + uint256 _rewardEpoch +) external view returns ( + address[] _dataProviders, + uint256[] _rewardAmounts, + bool[] _claimed, + bool _claimable); +``` + +Returns the state of rewards for a given address at a specific reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of the beneficiary to query. It can be a data provider or a delegator, for example.
Reverts if the queried address is delegating by amount. | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_dataProviders` | `address[]` | Array of addresses of data providers. | +| `_rewardAmounts` | `uint256[]` | Array of reward amounts received from each provider, in wei. | +| `_claimed` | `bool[]` | Array of boolean values indicating whether each reward has been claimed or not. | +| `_claimable` | `bool` | Boolean value indicating whether rewards are claimable or not. | +
+
+ +
+ +### `getStateOfRewardsFromDataProviders` { #fn_getstateofrewardsfromdataproviders } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getStateOfRewardsFromDataProviders( + address _beneficiary, + uint256 _rewardEpoch, + address[] _dataProviders +) external view returns ( + uint256[] _rewardAmounts, + bool[] _claimed, + bool _claimable); +``` + +Returns the state of rewards for a given address coming from a specific set of data providers, at a specific +reward epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_beneficiary` | `address` | Address of beneficiary to query. | +| `_rewardEpoch` | `uint256` | Reward epoch ID to query. | +| `_dataProviders` | `address[]` | Array of addresses of the data providers to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_rewardAmounts` | `uint256[]` | Array of reward amounts received from each provider, in wei. | +| `_claimed` | `bool[]` | Array of boolean values indicating whether each reward has been claimed or not. | +| `_claimable` | `bool` | Boolean value indicating whether rewards are claimable or not. | +
+
+ +
+ +### `getTokenPoolSupplyData` { #fn_gettokenpoolsupplydata } + +
+Defined in `IITokenPool` ([Docs](./IITokenPool.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IITokenPool.sol)). +
+ +
+ +```solidity +function getTokenPoolSupplyData( +) external returns ( + uint256 _lockedFundsWei, + uint256 _totalInflationAuthorizedWei, + uint256 _totalClaimedWei); +``` + +Returns token pool supply data. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lockedFundsWei` | `uint256` | Total amount of funds ever locked in the token pool (wei). `_lockedFundsWei` - `_totalClaimedWei` is the amount currently locked and outside the circulating supply. | +| `_totalInflationAuthorizedWei` | `uint256` | Total inflation authorized amount (wei). | +| `_totalClaimedWei` | `uint256` | Total claimed amount (wei). | +
+
+ +
+ +### `getUnclaimedReward` { #fn_getunclaimedreward } + +
+Defined in `IIFtsoRewardManager` ([Docs](./IIFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IIFtsoRewardManager.sol)). +
+ +
+ +```solidity +function getUnclaimedReward( + uint256 _rewardEpoch, + address _dataProvider +) external view returns ( + uint256 _amount, + uint256 _weight); +``` + +Returns information on unclaimed rewards for a given data provider and epoch. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardEpoch` | `uint256` | Queried reward epoch ID. | +| `_dataProvider` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_amount` | `uint256` | Amount available to be claimed, in wei. | +| `_weight` | `uint256` | Portion of total vote power used in this reward epoch that has not yet claimed its reward, in BIPS. It decreases to 0 when all data providers have claimed their rewards. | +
+
+ +
+ +### `nextClaimableRewardEpoch` { #fn_nextclaimablerewardepoch } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function nextClaimableRewardEpoch( + address _rewardOwner +) external view returns ( + uint256); +``` + +Returns the next claimable reward epoch for a reward owner. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_rewardOwner` | `address` | Address of the reward owner to query. | + +
+
+ +
+ +### `receiveInflation` { #fn_receiveinflation } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function receiveInflation( +) external payable; +``` + +Receive native tokens from inflation. + +
+
+ +
+ +### `setDailyAuthorizedInflation` { #fn_setdailyauthorizedinflation } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function setDailyAuthorizedInflation( + uint256 _toAuthorizeWei +) external; +``` + +Notify the receiver that it is entitled to receive a new inflation amount. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_toAuthorizeWei` | `uint256` | The amount of inflation that can be awarded in the coming day, in wei. | + +
+
+ +
+ +### `setDataProviderFeePercentage` { #fn_setdataproviderfeepercentage } + +
+Defined in `IFtsoRewardManager` ([Docs](./IFtsoRewardManager.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IFtsoRewardManager.sol)). +
+ +
+ +```solidity +function setDataProviderFeePercentage( + uint256 _feePercentageBIPS +) external returns ( + uint256 _validFromEpoch); +``` + +Sets the [fee](https://docs.flare.network/tech/ftso/#rewards) a data provider keeps from all delegations. + +Takes effect after `feeValueUpdateOffset` reward epochs have elapsed. + +When called multiple times inside the same reward epoch, only the last value remains. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_feePercentageBIPS` | `uint256` | Fee percentage in BIPS. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_validFromEpoch` | `uint256` | Reward epoch number when the new fee percentage will become effective. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIGovernanceVotePower.md b/docs/apis/smart-contracts/IIGovernanceVotePower.md new file mode 100644 index 000000000..7311b3b67 --- /dev/null +++ b/docs/apis/smart-contracts/IIGovernanceVotePower.md @@ -0,0 +1,398 @@ +--- +title: IIGovernanceVotePower +--- + + + +# `IIGovernanceVotePower` { #ct_iigovernancevotepower } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol) | Inherits from [IGovernanceVotePower](./IGovernanceVotePower.md) +
+ +
+ +Internal interface for contracts delegating their governance vote power. + +
+ +
+ +## Events + +
+ +### `DelegateChanged` { #ev_delegatechanged } + +
+Defined in `IIGovernanceVotePower` ([Docs](./IIGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol)). +
+ +
+ +```solidity +event DelegateChanged( + address delegator, + address fromDelegate, + address toDelegate +) +``` + +Emitted when an account starts delegating vote power or switches its delegation +to another address. + +The event is always emitted from a [`GovernanceVotePower`](./GovernanceVotePower.md) contract. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `delegator` | `address` | Account delegating its vote power. | +| `fromDelegate` | `address` | Account receiving the delegation before the change. Can be address(0) if there was no previous delegation. | +| `toDelegate` | `address` | Account receiving the delegation after the change. Can be address(0) if `delegator` just undelegated all its vote power. | + +
+
+ +
+ +### `DelegateVotesChanged` { #ev_delegatevoteschanged } + +
+Defined in `IIGovernanceVotePower` ([Docs](./IIGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol)). +
+ +
+ +```solidity +event DelegateVotesChanged( + address delegate, + uint256 previousBalance, + uint256 newBalance +) +``` + +Emitted when a [`delegate`](#fn_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`](./GovernanceVotePower.md) contract. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `delegate` | `address` | The account receiving the changing delegated vote power. | +| `previousBalance` | `uint256` | Delegated vote power before the change. | +| `newBalance` | `uint256` | Delegated vote power after the change. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `delegate` { #fn_delegate } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function delegate( + address _to +) external; +``` + +Delegates all governance vote power of `msg.sender` to address `_to`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | + +
+
+ +
+ +### `getCleanupBlockNumber` { #fn_getcleanupblocknumber } + +
+Defined in `IIGovernanceVotePower` ([Docs](./IIGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol)). +
+ +
+ +```solidity +function getCleanupBlockNumber( +) external view returns ( + uint256); +``` + +Get the current cleanup block number set with [`setCleanupBlockNumber`](#fn_setcleanupblocknumber). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The currently set cleanup block number. | +
+
+ +
+ +### `getDelegateOfAt` { #fn_getdelegateofat } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function getDelegateOfAt( + address _who, + uint256 _blockNumber +) external view returns ( + address); +``` + +Gets the address an account is delegating its governance vote power to, at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number at which to fetch the address. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address where `_who` was delegating its governance vote power at block `_blockNumber`. | +
+
+ +
+ +### `getDelegateOfAtNow` { #fn_getdelegateofatnow } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function getDelegateOfAtNow( + address _who +) external view returns ( + address); +``` + +Gets the address an account is delegating its governance vote power to, at the latest block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address` | Address where `_who` is currently delegating its governance vote power. | +
+
+ +
+ +### `getVotes` { #fn_getvotes } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function getVotes( + address _who +) external view returns ( + uint256); +``` + +Gets the governance vote power of an address at the latest block, including +all delegations made to it. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Governance vote power of `account` at the lastest block. | +
+
+ +
+ +### `ownerToken` { #fn_ownertoken } + +
+Defined in `IIGovernanceVotePower` ([Docs](./IIGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol)). +
+ +
+ +```solidity +function ownerToken( +) external view returns ( + contract IVPToken); +``` + +Get the token that this governance vote power contract belongs to. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `contract IVPToken` | The [`IVPToken`](./IVPToken.md) interface owning this contract. | +
+
+ +
+ +### `setCleanerContract` { #fn_setcleanercontract } + +
+Defined in `IIGovernanceVotePower` ([Docs](./IIGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol)). +
+ +
+ +```solidity +function setCleanerContract( + address _cleanerContract +) external; +``` + +Set the contract that is allowed to call history cleaning methods. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanerContract` | `address` | Address of the cleanup contract. Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). | + +
+
+ +
+ +### `setCleanupBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `IIGovernanceVotePower` ([Docs](./IIGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumber( + uint256 _blockNumber +) 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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The new cleanup block number. | + +
+
+ +
+ +### `undelegate` { #fn_undelegate } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function undelegate( +) external; +``` + +Undelegates all governance vote power of `msg.sender`. + +
+
+ +
+ +### `updateAtTokenTransfer` { #fn_updateattokentransfer } + +
+Defined in `IIGovernanceVotePower` ([Docs](./IIGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIGovernanceVotePower.sol)). +
+ +
+ +```solidity +function updateAtTokenTransfer( + address _from, + address _to, + uint256 _fromBalance, + uint256 _toBalance, + uint256 _amount +) external; +``` + +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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Source address of the transfer. | +| `_to` | `address` | Destination address of the transfer. | +| `_fromBalance` | `uint256` | _Ignored._ | +| `_toBalance` | `uint256` | _Ignored._ | +| `_amount` | `uint256` | Amount being transferred. | + +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `IGovernanceVotePower` ([Docs](./IGovernanceVotePower.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IGovernanceVotePower.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _who, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Gets the governance vote power of an address at a given block number, including +all delegations made to it. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number at which to fetch the vote power. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Governance vote power of `_who` at `_blockNumber`. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIInflationReceiver.md b/docs/apis/smart-contracts/IIInflationReceiver.md new file mode 100644 index 000000000..6124d5bd3 --- /dev/null +++ b/docs/apis/smart-contracts/IIInflationReceiver.md @@ -0,0 +1,139 @@ +--- +title: IIInflationReceiver +--- + + + +# `IIInflationReceiver` { #ct_iiinflationreceiver } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol) +
+ +
+ +Internal interface for contracts that can receive inflation. + +
+ +
+ +## Functions + +
+ +### `getContractName` { #fn_getcontractname } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function getContractName( +) external view returns ( + string); +``` + +Implement this function to allow updating inflation receiver contracts through [`AddressUpdater`](./AddressUpdater.md). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `string` | Contract name. | +
+
+ +
+ +### `getExpectedBalance` { #fn_getexpectedbalance } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function getExpectedBalance( +) external view returns ( + uint256); +``` + +Returns the contract's expected balance +(actual balance may be higher due to self-destruct funds). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Expected native token balance. | +
+
+ +
+ +### `getInflationAddress` { #fn_getinflationaddress } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function getInflationAddress( +) external returns ( + address); +``` + +Returns the address of the [`Inflation`](./Inflation.md) contract. + +
+
+ +
+ +### `receiveInflation` { #fn_receiveinflation } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function receiveInflation( +) external payable; +``` + +Receive native tokens from inflation. + +
+
+ +
+ +### `setDailyAuthorizedInflation` { #fn_setdailyauthorizedinflation } + +
+Defined in `IIInflationReceiver` ([Docs](./IIInflationReceiver.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/interface/IIInflationReceiver.sol)). +
+ +
+ +```solidity +function setDailyAuthorizedInflation( + uint256 _toAuthorizeWei +) external; +``` + +Notify the receiver that it is entitled to receive a new inflation amount. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_toAuthorizeWei` | `uint256` | The amount of inflation that can be awarded in the coming day, in wei. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIPriceSubmitter.md b/docs/apis/smart-contracts/IIPriceSubmitter.md new file mode 100644 index 000000000..84846da16 --- /dev/null +++ b/docs/apis/smart-contracts/IIPriceSubmitter.md @@ -0,0 +1,339 @@ +--- +title: IIPriceSubmitter +--- + + + +# `IIPriceSubmitter` { #ct_iipricesubmitter } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IIPriceSubmitter.sol) | Inherits from [IPriceSubmitter](./IPriceSubmitter.md) +
+ +
+ +Internal interface for the [`PriceSubmitter`](./PriceSubmitter.md) contract. + +
+ +
+ +## Functions + +
+ +### `getCurrentRandom` { #fn_getcurrentrandom } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getCurrentRandom( +) external view returns ( + uint256); +``` + +Returns the random number for the previous epoch, obtained from the random numbers +provided by all data providers along with their data submissions. +Note that the random number for the previous epoch keeps updating as new submissions are revealed. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Random number calculated from all data provider's submissions. | +
+
+ +
+ +### `getFtsoManager` { #fn_getftsomanager } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getFtsoManager( +) external view returns ( + contract IFtsoManagerGenesis); +``` + +Returns the address of the [`FtsoManager`](./FtsoManager.md) contract. + +
+
+ +
+ +### `getFtsoRegistry` { #fn_getftsoregistry } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getFtsoRegistry( +) external view returns ( + contract IFtsoRegistryGenesis); +``` + +Returns the address of the [`FtsoRegistry`](./FtsoRegistry.md) contract. + +
+
+ +
+ +### `getRandom` { #fn_getrandom } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getRandom( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns the random number used in a specific past epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the queried epoch. Current epoch cannot be queried, and the previous epoch is constantly updated as data providers reveal their prices and random numbers. Note that only the last 50 epochs can be queried and there is no bounds checking for this parameter. Out-of-bounds queries return undefined values. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The random number used in that epoch. | +
+
+ +
+ +### `getTrustedAddresses` { #fn_gettrustedaddresses } + +
+Defined in `IIPriceSubmitter` ([Docs](./IIPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IIPriceSubmitter.sol)). +
+ +
+ +```solidity +function getTrustedAddresses( +) external view returns ( + address[]); +``` + +Returns the list of trusted addresses that are always allowed to submit and reveal. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | address[] Array of trusted voter addresses. | +
+
+ +
+ +### `getVoterWhitelister` { #fn_getvoterwhitelister } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getVoterWhitelister( +) external view returns ( + address); +``` + +Returns the address of the [`VoterWhitelister`](./VoterWhitelister.md) contract managing the data provider whitelist. + +
+
+ +
+ +### `revealPrices` { #fn_revealprices } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function revealPrices( + uint256 _epochId, + uint256[] _ftsoIndices, + uint256[] _prices, + uint256 _random +) external; +``` + +Reveals submitted prices during the epoch reveal period. +The hash of FTSO indices, prices, random number, and voter address must be equal +to the hash previously submitted with [`submitHash`](#fn_submithash). +Emits a [`PricesRevealed`](#ev_pricesrevealed) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to which the price hashes are submitted. | +| `_ftsoIndices` | `uint256[]` | List of FTSO indices in ascending order. | +| `_prices` | `uint256[]` | List of submitted prices in USD. | +| `_random` | `uint256` | Submitted random number. | + +
+
+ +
+ +### `setTrustedAddresses` { #fn_settrustedaddresses } + +
+Defined in `IIPriceSubmitter` ([Docs](./IIPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IIPriceSubmitter.sol)). +
+ +
+ +```solidity +function setTrustedAddresses( + address[] _trustedAddresses +) external; +``` + +Set trusted addresses that are always allowed to submit and reveal. +Only ftso manager can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_trustedAddresses` | `address[]` | Array of voter addresses. | + +
+
+ +
+ +### `submitHash` { #fn_submithash } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function submitHash( + uint256 _epochId, + bytes32 _hash +) external; +``` + +Submits a hash for the current epoch. Can only be called by FTSO data providers +whitelisted through the `VoterWhitelisted` contract. +Emits the [`HashSubmitted`](#ev_hashsubmitted) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the target epoch to which the hash is submitted. | +| `_hash` | `bytes32` | A hash of the FTSO indices, prices, random number, and voter address. | + +
+
+ +
+ +### `voterWhitelistBitmap` { #fn_voterwhitelistbitmap } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function voterWhitelistBitmap( + address _voter +) external view returns ( + uint256); +``` + +Returns a bitmap of all FTSOs for which a data provider is allowed to submit prices or hashes. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | If a data provider is allowed to vote for a given FTSO index, the corresponding bit in the result is 1. | +
+
+ +
+ +### `voterWhitelisted` { #fn_voterwhitelisted } + +
+Defined in `IIPriceSubmitter` ([Docs](./IIPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IIPriceSubmitter.sol)). +
+ +
+ +```solidity +function voterWhitelisted( + address _voter, + uint256 _ftsoIndex +) external; +``` + +Called from the [`VoterWhitelister`](./VoterWhitelister.md) contract when a new voter has been whitelisted. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Voter address that has been added to the whitelist. | +| `_ftsoIndex` | `uint256` | Index of the FTSO to which the voter has registered. Each FTSO has its own whitelist. | + +
+
+ +
+ +### `votersRemovedFromWhitelist` { #fn_votersremovedfromwhitelist } + +
+Defined in `IIPriceSubmitter` ([Docs](./IIPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IIPriceSubmitter.sol)). +
+ +
+ +```solidity +function votersRemovedFromWhitelist( + address[] _voters, + uint256 _ftsoIndex +) external; +``` + +Called from the [`VoterWhitelister`](./VoterWhitelister.md) contract when one or more voters have been removed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voters` | `address[]` | Array of voter addresses that have been removed. | +| `_ftsoIndex` | `uint256` | Index of the FTSO to which the voters were registered. Each FTSO has its own whitelist. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IITokenPool.md b/docs/apis/smart-contracts/IITokenPool.md new file mode 100644 index 000000000..836bb587f --- /dev/null +++ b/docs/apis/smart-contracts/IITokenPool.md @@ -0,0 +1,52 @@ +--- +title: IITokenPool +--- + + + +# `IITokenPool` { #ct_iitokenpool } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IITokenPool.sol) +
+ +
+ +Internal interface for token pools. + +
+ +
+ +## Functions + +
+ +### `getTokenPoolSupplyData` { #fn_gettokenpoolsupplydata } + +
+Defined in `IITokenPool` ([Docs](./IITokenPool.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/tokenPools/interface/IITokenPool.sol)). +
+ +
+ +```solidity +function getTokenPoolSupplyData( +) external returns ( + uint256 _lockedFundsWei, + uint256 _totalInflationAuthorizedWei, + uint256 _totalClaimedWei); +``` + +Returns token pool supply data. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lockedFundsWei` | `uint256` | Total amount of funds ever locked in the token pool (wei). `_lockedFundsWei` - `_totalClaimedWei` is the amount currently locked and outside the circulating supply. | +| `_totalInflationAuthorizedWei` | `uint256` | Total inflation authorized amount (wei). | +| `_totalClaimedWei` | `uint256` | Total claimed amount (wei). | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIVPContract.md b/docs/apis/smart-contracts/IIVPContract.md new file mode 100644 index 000000000..0183ae1bb --- /dev/null +++ b/docs/apis/smart-contracts/IIVPContract.md @@ -0,0 +1,734 @@ +--- +title: IIVPContract +--- + + + +# `IIVPContract` { #ct_iivpcontract } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol) | Inherits from [IICleanable](./IICleanable.md), [IVPContractEvents](./IVPContractEvents.md) +
+ +
+ +Internal interface for helper contracts handling functionality for an associated [`VPToken`](./VPToken.md). + +
+ +
+ +## Functions + +
+ +### `batchVotePowerOfAt` { #fn_batchvotepowerofat } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function batchVotePowerOfAt( + address[] _owners, + uint256 _blockNumber +) external view returns ( + uint256[]); +``` + +Get the vote power of a set of addresses at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owners` | `address[]` | The list of addresses being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256[]` | Vote power of each address at `_blockNumber`, including any delegation received. | +
+
+ +
+ +### `cleanupBlockNumber` { #fn_cleanupblocknumber } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function cleanupBlockNumber( +) external view returns ( + uint256); +``` + +Get the current cleanup block number set with [`setCleanupBlockNumber`](#fn_setcleanupblocknumber). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The currently set cleanup block number. | +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function delegate( + address _from, + address _to, + uint256 _balance, + uint256 _bips +) external; +``` + +[`Delegate`](#ev_delegate) `_bips` percentage of voting power from a delegator address to a delegatee address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_to` | `address` | The address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance | +| `_bips` | `uint256` | 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 a value of 0 revokes delegation). | + +
+
+ +
+ +### `delegateExplicit` { #fn_delegateexplicit } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function delegateExplicit( + address _from, + address _to, + uint256 _balance, + uint256 _amount +) external; +``` + +Explicitly [`delegate`](#fn_delegate) `_amount` tokens of voting power from a delegator address to a delegatee address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_to` | `address` | The address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance. | +| `_amount` | `uint256` | An explicit vote power amount to be delegated. Not cumulative: every call resets the delegation value (and a value of 0 undelegates `_to`). | + +
+
+ +
+ +### `delegatesOf` { #fn_delegatesof } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function delegatesOf( + address _owner +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the percentages and addresses being delegated to by a vote power delegator. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address of the delegator being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Array of delegatee addresses. | +| `_bips` | `uint256[]` | Array of delegation percents specified in basis points (1/100 or 1 percent), for each delegatee. | +| `_count` | `uint256` | The number of returned delegatees. | +| `_delegationMode` | `uint256` | The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See [`Delegatable`](./Delegatable.md).DelegationMode. | +
+
+ +
+ +### `delegatesOfAt` { #fn_delegatesofat } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function delegatesOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the percentages and addresses being delegated to by a vote power delegator, +at a given block. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address of the delegator being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Array of delegatee addresses. | +| `_bips` | `uint256[]` | Array of delegation percents specified in basis points (1/100 or 1 percent), for each delegatee. | +| `_count` | `uint256` | The number of returned delegatees. | +| `_delegationMode` | `uint256` | The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See [`Delegatable`](./Delegatable.md).DelegationMode. | +
+
+ +
+ +### `delegationModeOf` { #fn_delegationmodeof } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function delegationModeOf( + address _who +) external view returns ( + uint256); +``` + +Get the delegation mode of an address. This mode determines whether vote power is +allocated by percentage or by explicit value and cannot be changed once set with +[`delegate`](#fn_delegate) or [`delegateExplicit`](#fn_delegateexplicit). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Delegation mode (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See [`Delegatable`](./Delegatable.md).DelegationMode. | +
+
+ +
+ +### `isReplacement` { #fn_isreplacement } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function isReplacement( +) external view returns ( + bool); +``` + +Return true if this [`IIVPContract`](./IIVPContract.md) 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. + +
+
+ +
+ +### `ownerToken` { #fn_ownertoken } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function ownerToken( +) external view returns ( + contract IVPToken); +``` + +The [`VPToken`](./VPToken.md) (or some other contract) that owns this [`VPContract`](./VPContract.md). +All state changing methods may be called only from this address. +This is because original `msg.sender` is typically sent in a parameter +and we must make sure that it cannot be faked by directly calling +[`IIVPContract`](./IIVPContract.md) methods. +Owner token is also used in case of replacement to recover vote powers from balances. + +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _from, + address _to, + uint256 _balance, + uint256 _blockNumber +) external; +``` + +[`Revoke`](#ev_revoke) all vote power delegation from a delegator address to a delegatee address at a given block. +Only affects the reads via [`votePowerOfAtCached`](#fn_votepowerofatcached) in the block `_blockNumber`. +This method should be used only to prevent rogue [`delegate`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) or [`delegateExplicit`](#fn_delegateexplicit) with value of 0, +or [`undelegateAll`](#fn_undelegateall)/ [`undelegateAllExplicit`](#fn_undelegateallexplicit). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_to` | `address` | Address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance. | +| `_blockNumber` | `uint256` | The block number at which to revoke delegation. Must be in the past. | + +
+
+ +
+ +### `setCleanerContract` { #fn_setcleanercontract } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function setCleanerContract( + address _cleanerContract +) external; +``` + +Set the contract that is allowed to call history cleaning methods. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanerContract` | `address` | Address of the cleanup contract. Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). | + +
+
+ +
+ +### `setCleanupBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumber( + uint256 _blockNumber +) external; +``` + +Set the cleanup block number. +Historic data for the blocks before [`cleanupBlockNumber`](#fn_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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The new cleanup block number. | + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function undelegateAll( + address _from, + uint256 _balance +) external; +``` + +Undelegate all voting power for a delegator address. +Can only be used with percentage delegation. +Does not reset delegation mode back to `NOTSET`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_balance` | `uint256` | The delegator's current balance. | + +
+
+ +
+ +### `undelegateAllExplicit` { #fn_undelegateallexplicit } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function undelegateAllExplicit( + address _from, + address[] _delegateAddresses +) external returns ( + uint256); +``` + +Undelegate all explicit vote power by amount for a delegator address. +Can only be used with explicit delegation. +Does not reset delegation mode back to `NOTSET`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_delegateAddresses` | `address[]` | Explicit delegation does not store delegatees' addresses, so the caller must supply them. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The amount still delegated (in case the list of delegates was incomplete). | +
+
+ +
+ +### `undelegatedVotePowerOf` { #fn_undelegatedvotepowerof } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOf( + address _owner, + uint256 _balance +) external view returns ( + uint256); +``` + +Compute the current undelegated vote power of an address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address being queried. | +| `_balance` | `uint256` | Current balance of that address. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`, this is, the amount of vote power currently not being delegated to other addresses. | +
+
+ +
+ +### `undelegatedVotePowerOfAt` { #fn_undelegatedvotepowerofat } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOfAt( + address _owner, + uint256 _balance, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Compute the undelegated vote power of an address at a given block. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address being queried. | +| `_balance` | `uint256` | | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`, this is, the amount of vote power that was not being delegated to other addresses at that block number. | +
+
+ +
+ +### `updateAtTokenTransfer` { #fn_updateattokentransfer } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function updateAtTokenTransfer( + address _from, + address _to, + uint256 _fromBalance, + uint256 _toBalance, + uint256 _amount +) external; +``` + +Update vote powers when tokens are transferred. +Also update delegated vote powers for percentage delegation +and check for enough funds for explicit delegations. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Source account of the transfer. | +| `_to` | `address` | Destination account of the transfer. | +| `_fromBalance` | `uint256` | Balance of the source account before the transfer. | +| `_toBalance` | `uint256` | Balance of the destination account before the transfer. | +| `_amount` | `uint256` | Amount that has been transferred. | + +
+
+ +
+ +### `votePowerFromTo` { #fn_votepowerfromto } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function votePowerFromTo( + address _from, + address _to, + uint256 _balance +) external view returns ( + uint256); +``` + +Get current delegated vote power from a delegator to a delegatee. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of the delegator. | +| `_to` | `address` | Address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The delegated vote power. | +
+
+ +
+ +### `votePowerFromToAt` { #fn_votepowerfromtoat } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function votePowerFromToAt( + address _from, + address _to, + uint256 _balance, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get delegated the vote power from a delegator to a delegatee at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of the delegator. | +| `_to` | `address` | Address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The delegated vote power. | +
+
+ +
+ +### `votePowerOf` { #fn_votepowerof } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function votePowerOf( + address _who +) external view returns ( + uint256); +``` + +Get the current vote power of an address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Current vote power of `_who`, including any delegation received. | +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _who, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of an address at a given block number + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_who` at `_blockNumber`, including any delegation received. | +
+
+ +
+ +### `votePowerOfAtCached` { #fn_votepowerofatcached } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function votePowerOfAtCached( + address _who, + uint256 _blockNumber +) external returns ( + uint256); +``` + +Get the vote power of an address at a given block number. +Reads/updates cache and upholds revocations. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_who` at `_blockNumber`, including any delegation received. | +
+
+ +
+ +### `votePowerOfAtIgnoringRevocation` { #fn_votepowerofatignoringrevocation } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function votePowerOfAtIgnoringRevocation( + address _who, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of an address at a given block number, ignoring revocation information and cache. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_who` at `_blockNumber`, including any delegation received. Result doesn't change if vote power is revoked. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIVPToken.md b/docs/apis/smart-contracts/IIVPToken.md new file mode 100644 index 000000000..c2a41ac17 --- /dev/null +++ b/docs/apis/smart-contracts/IIVPToken.md @@ -0,0 +1,1166 @@ +--- +title: IIVPToken +--- + + + +# `IIVPToken` { #ct_iivptoken } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPToken.sol) | Inherits from [IVPToken](./IVPToken.md), [IICleanable](./IICleanable.md) +
+ +
+ +Vote power token internal interface. + +
+ +
+ +## Functions + +
+ +### `allowance` { #fn_allowance } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function allowance( + address owner, + address spender +) external view returns ( + uint256); +``` + +Returns the remaining number of tokens that `spender` will be +allowed to spend on behalf of `owner` through [`transferFrom`](#fn_transferfrom). This is +zero by default. + +This value changes when [`approve`](#fn_approve) or [`transferFrom`](#fn_transferfrom) are called. + +
+
+ +
+ +### `approve` { #fn_approve } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function approve( + address spender, + uint256 amount +) external returns ( + bool); +``` + +Sets `amount` as the [`allowance`](#fn_allowance) of `spender` over the caller's tokens. + +Returns a boolean value indicating whether the operation succeeded. + +IMPORTANT: Beware that changing an [`allowance`](#fn_allowance) with this method brings the risk +that someone may use both the old and the new [`allowance`](#fn_allowance) by unfortunate +transaction ordering. One possible solution to mitigate this race +condition is to first reduce the spender's [`allowance`](#fn_allowance) to 0 and set the +desired value afterwards: +https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + +Emits an [`Approval`](#ev_approval) event. + +
+
+ +
+ +### `balanceOf` { #fn_balanceof } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function balanceOf( + address account +) external view returns ( + uint256); +``` + +Returns the amount of tokens owned by `account`. + +
+
+ +
+ +### `balanceOfAt` { #fn_balanceofat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function balanceOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Queries the token balance of `_owner` at a specific `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address from which the balance will be retrieved. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The balance at `_blockNumber`. | +
+
+ +
+ +### `batchDelegate` { #fn_batchdelegate } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function batchDelegate( + address[] _delegatees, + uint256[] _bips +) external; +``` + +Undelegate all percentage delegations from the sender and then [`delegate`](#fn_delegate) corresponding + `_bips` percentage of voting power from the sender to each member of the `_delegatees` array. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegatees` | `address[]` | The addresses of the new recipients. | +| `_bips` | `uint256[]` | The percentages of voting power to be delegated expressed in basis points (1/100 of one percent). The sum of all `_bips` values must be at most 10000 (100%). | + +
+
+ +
+ +### `batchVotePowerOfAt` { #fn_batchvotepowerofat } + +
+Defined in `IIVPToken` ([Docs](./IIVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPToken.sol)). +
+ +
+ +```solidity +function batchVotePowerOfAt( + address[] _owners, + uint256 _blockNumber +) external view returns ( + uint256[]); +``` + +Return the vote power for several addresses. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owners` | `address[]` | The list of addresses to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256[]` | Array of vote power for each queried address. | +
+
+ +
+ +### `cleanupBlockNumber` { #fn_cleanupblocknumber } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function cleanupBlockNumber( +) external view returns ( + uint256); +``` + +Get the current cleanup block number set with [`setCleanupBlockNumber`](#fn_setcleanupblocknumber). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The currently set cleanup block number. | +
+
+ +
+ +### `decimals` { #fn_decimals } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function decimals( +) external view returns ( + uint8); +``` + +Returns the number of [`decimals`](#fn_decimals) used to get its user representation. +For example, if [`decimals`](#fn_decimals) equals 2, a balance of 505 tokens should +be displayed to a user as 5.05 (505 / 102). + +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 +[`balanceOf`](#fn_balanceof) and [`transfer`](#fn_transfer). + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegate( + address _to, + uint256 _bips +) external; +``` + +Delegate voting power to account `_to` from `msg.sender`, by percentage. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_bips` | `uint256` | 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 a value of 0 revokes all previous delegations). | + +
+
+ +
+ +### `delegateExplicit` { #fn_delegateexplicit } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegateExplicit( + address _to, + uint256 _amount +) external; +``` + +Explicitly [`delegate`](#fn_delegate) `_amount` voting power to account `_to` from `msg.sender`. +Compare with [`delegate`](#fn_delegate) which delegates by percentage. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_amount` | `uint256` | An explicit vote power amount to be delegated. Not cumulative: every call resets the delegation value (and a value of 0 revokes all previous delegations). | + +
+
+ +
+ +### `delegatesOf` { #fn_delegatesof } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegatesOf( + address _who +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the list of addresses to which `_who` is delegating, and their percentages. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Positional array of addresses being delegated to. | +| `_bips` | `uint256[]` | Positional array of delegation percents specified in basis points (1/100 of 1 percent). Each one matches the address in the same position in the `_delegateAddresses` array. | +| `_count` | `uint256` | The number of delegates. | +| `_delegationMode` | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `delegatesOfAt` { #fn_delegatesofat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegatesOfAt( + address _who, + uint256 _blockNumber +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the list of addresses to which `_who` is delegating, and their percentages, at the given block. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Positional array of addresses being delegated to. | +| `_bips` | `uint256[]` | Positional array of delegation percents specified in basis points (1/100 of 1 percent). Each one matches the address in the same position in the `_delegateAddresses` array. | +| `_count` | `uint256` | The number of delegates. | +| `_delegationMode` | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `delegationModeOf` { #fn_delegationmodeof } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegationModeOf( + address _who +) external view returns ( + uint256); +``` + +Get the delegation mode for account '_who'. This mode determines whether vote power is +allocated by percentage or by explicit amount. Once the delegation mode is set, +it can never be changed, even if all delegations are removed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address to get delegation mode. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `governanceVotePower` { #fn_governancevotepower } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function governanceVotePower( +) external view returns ( + contract IGovernanceVotePower); +``` + +When set, allows token owners to participate in governance voting +and delegating governance vote power. + +
+
+ +
+ +### `name` { #fn_name } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function name( +) external view returns ( + string); +``` + +Returns the [`name`](#fn_name) of the token. + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `readVotePowerContract` { #fn_readvotepowercontract } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function readVotePowerContract( +) external view returns ( + contract IVPContractEvents); +``` + +Returns [`VPContract`](./VPContract.md) event interface used for read-only operations (view methods). +The only non-view method that might be called on it is [`revokeDelegationAt`](#fn_revokedelegationat). + +[`readVotePowerContract`](#fn_readvotepowercontract) is almost always equal to [`writeVotePowerContract`](#fn_writevotepowercontract) +except during an upgrade from one [`VPContract`](./VPContract.md) to a new version (which should happen +rarely or never and will be announced beforehand). + +Do not call any methods on [`VPContract`](./VPContract.md) directly. +State changing methods are forbidden from direct calls. +All methods are exposed via [`VPToken`](./VPToken.md). +This is the reason that this method returns [`IVPContractEvents`](./IVPContractEvents.md). +Use it only for listening to events and revoking. + +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _who, + uint256 _blockNumber +) external; +``` + +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`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) / [`delegateExplicit`](#fn_delegateexplicit) with value of 0 or [`undelegateAll`](#fn_undelegateall) / [`undelegateAllExplicit`](#fn_undelegateallexplicit). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | Address of the delegatee. | +| `_blockNumber` | `uint256` | The block number at which to revoke delegation.. | + +
+
+ +
+ +### `setCleanerContract` { #fn_setcleanercontract } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function setCleanerContract( + address _cleanerContract +) external; +``` + +Set the contract that is allowed to call history cleaning methods. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanerContract` | `address` | Address of the cleanup contract. Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). | + +
+
+ +
+ +### `setCleanupBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `IICleanable` ([Docs](./IICleanable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IICleanable.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumber( + uint256 _blockNumber +) external; +``` + +Set the cleanup block number. +Historic data for the blocks before [`cleanupBlockNumber`](#fn_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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The new cleanup block number. | + +
+
+ +
+ +### `setCleanupBlockNumberManager` { #fn_setcleanupblocknumbermanager } + +
+Defined in `IIVPToken` ([Docs](./IIVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPToken.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumberManager( + address _cleanupBlockNumberManager +) external; +``` + +Set the contract that is allowed to set [`cleanupBlockNumber`](#fn_cleanupblocknumber). +Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). + +
+
+ +
+ +### `setGovernanceVotePower` { #fn_setgovernancevotepower } + +
+Defined in `IIVPToken` ([Docs](./IIVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPToken.sol)). +
+ +
+ +```solidity +function setGovernanceVotePower( + contract IIGovernanceVotePower _governanceVotePower +) external; +``` + +Sets new governance vote power contract that allows token owners to participate in governance voting +and [`delegate`](#fn_delegate) governance vote power. + +
+
+ +
+ +### `symbol` { #fn_symbol } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function symbol( +) external view returns ( + string); +``` + +Returns the [`symbol`](#fn_symbol) of the token, usually a shorter version of the [`name`](#fn_name). + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `totalSupply` { #fn_totalsupply } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function totalSupply( +) external view returns ( + uint256); +``` + +Returns the amount of tokens in existence. + +
+
+ +
+ +### `totalSupplyAt` { #fn_totalsupplyat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function totalSupplyAt( + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Total amount of tokens held by all accounts at a specific block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total amount of tokens at `_blockNumber`. | +
+
+ +
+ +### `totalVotePower` { #fn_totalvotepower } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function totalVotePower( +) external view returns ( + uint256); +``` + +Get the current total vote power. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The current total vote power (sum of all accounts' vote power). | +
+
+ +
+ +### `totalVotePowerAt` { #fn_totalvotepowerat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function totalVotePowerAt( + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the total vote power at block `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total vote power at the queried block (sum of all accounts' vote powers). | +
+
+ +
+ +### `totalVotePowerAtCached` { #fn_totalvotepoweratcached } + +
+Defined in `IIVPToken` ([Docs](./IIVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPToken.sol)). +
+ +
+ +```solidity +function totalVotePowerAtCached( + uint256 _blockNumber +) external returns ( + uint256); +``` + +Get the total vote power at block `_blockNumber` using cache. + It tries to read the cached value and if it is not found, reads the actual value and stores it in the cache. + Can only be used if `_blockNumber` is in the past, otherwise reverts. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total vote power at the queried block (sum of all accounts' vote powers). | +
+
+ +
+ +### `transfer` { #fn_transfer } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function transfer( + address recipient, + uint256 amount +) external returns ( + bool); +``` + +Moves `amount` tokens from the caller's account to `recipient`. + +Returns a boolean value indicating whether the operation succeeded. + +Emits a [`Transfer`](#ev_transfer) event. + +
+
+ +
+ +### `transferFrom` { #fn_transferfrom } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function transferFrom( + address sender, + address recipient, + uint256 amount +) external returns ( + bool); +``` + +Moves `amount` tokens from `sender` to `recipient` using the +[`allowance`](#fn_allowance) mechanism. `amount` is then deducted from the caller's +[`allowance`](#fn_allowance). + +Returns a boolean value indicating whether the operation succeeded. + +Emits a [`Transfer`](#ev_transfer) event. + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function undelegateAll( +) external; +``` + +Undelegate all voting power of `msg.sender`. This effectively revokes all previous delegations. +Can only be used with percentage delegation. +Does not reset delegation mode back to NOT SET. + +
+
+ +
+ +### `undelegateAllExplicit` { #fn_undelegateallexplicit } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function undelegateAllExplicit( + address[] _delegateAddresses +) external returns ( + uint256); +``` + +Undelegate all explicit vote power by amount of `msg.sender`. +Can only be used with explicit delegation. +Does not reset delegation mode back to NOT SET. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Explicit delegation does not store delegatees' addresses, so the caller must supply them. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The amount still delegated (in case the list of delegates was incomplete). | +
+
+ +
+ +### `undelegatedVotePowerOf` { #fn_undelegatedvotepowerof } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOf( + address _owner +) external view returns ( + uint256); +``` + +Compute the current undelegated vote power of the `_owner` account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`. | +
+
+ +
+ +### `undelegatedVotePowerOfAt` { #fn_undelegatedvotepowerofat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the undelegated vote power of the `_owner` account at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`. | +
+
+ +
+ +### `votePowerFromTo` { #fn_votepowerfromto } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerFromTo( + address _from, + address _to +) external view returns ( + uint256); +``` + +Get current delegated vote power from delegator `_from` to delegatee `_to`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of delegator. | +| `_to` | `address` | Address of delegatee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | votePower The delegated vote power. | +
+
+ +
+ +### `votePowerFromToAt` { #fn_votepowerfromtoat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerFromToAt( + address _from, + address _to, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get delegated vote power from delegator `_from` to delegatee `_to` at `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of delegator. | +| `_to` | `address` | Address of delegatee. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The delegated vote power. | +
+
+ +
+ +### `votePowerOf` { #fn_votepowerof } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerOf( + address _owner +) external view returns ( + uint256); +``` + +Get the current vote power of `_owner`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Current vote power of `_owner`. | +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at block number `_blockNumber`. | +
+
+ +
+ +### `votePowerOfAtCached` { #fn_votepowerofatcached } + +
+Defined in `IIVPToken` ([Docs](./IIVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAtCached( + address _owner, + uint256 _blockNumber +) external returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber` using cache. + It tries to read the cached value and if it is not found, reads the actual value and stores it in the cache. + Can only be used if `_blockNumber` is in the past, otherwise reverts. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at `_blockNumber`. | +
+
+ +
+ +### `votePowerOfAtIgnoringRevocation` { #fn_votepowerofatignoringrevocation } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAtIgnoringRevocation( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber`, ignoring revocation information (and cache). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at block number `_blockNumber`. Result doesn't change if vote power is revoked. | +
+
+ +
+ +### `writeVotePowerContract` { #fn_writevotepowercontract } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function writeVotePowerContract( +) external view returns ( + contract IVPContractEvents); +``` + +Returns [`VPContract`](./VPContract.md) event interface used for state-changing operations (non-view methods). +The only non-view method that might be called on it is [`revokeDelegationAt`](#fn_revokedelegationat). + +[`writeVotePowerContract`](#fn_writevotepowercontract) is almost always equal to [`readVotePowerContract`](#fn_readvotepowercontract), +except during upgrade from one [`VPContract`](./VPContract.md) to a new version (which should happen +rarely or never and will be announced beforehand). +In the case of an upgrade, [`writeVotePowerContract`](#fn_writevotepowercontract) is replaced first to establish delegations. +After some period (e.g., after a reward epoch ends), [`readVotePowerContract`](#fn_readvotepowercontract) is set equal to it. + +Do not call any methods on [`VPContract`](./VPContract.md) directly. +State changing methods are forbidden from direct calls. +All are exposed via [`VPToken`](./VPToken.md). +This is the reason that this method returns [`IVPContractEvents`](./IVPContractEvents.md) +Use it only for listening to events, delegating, and revoking. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IIVoterWhitelister.md b/docs/apis/smart-contracts/IIVoterWhitelister.md new file mode 100644 index 000000000..ee446eb6e --- /dev/null +++ b/docs/apis/smart-contracts/IIVoterWhitelister.md @@ -0,0 +1,391 @@ +--- +title: IIVoterWhitelister +--- + + + +# `IIVoterWhitelister` { #ct_iivoterwhitelister } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIVoterWhitelister.sol) | Inherits from [IVoterWhitelister](./IVoterWhitelister.md) +
+ +
+ +Internal interface for managers of the [FTSO whitelist](https://docs.flare.network/infra/data/whitelisting/). + +Only addresses registered in this contract can submit data to the FTSO system. + +
+ +
+ +## Functions + +
+ +### `addFtso` { #fn_addftso } + +
+Defined in `IIVoterWhitelister` ([Docs](./IIVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIVoterWhitelister.sol)). +
+ +
+ +```solidity +function addFtso( + uint256 _ftsoIndex +) external; +``` + +Create an empty whitelist with default size for a new FTSO. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the new FTSO. | + +
+
+ +
+ +### `chillVoter` { #fn_chillvoter } + +
+Defined in `IIVoterWhitelister` ([Docs](./IIVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIVoterWhitelister.sol)). +
+ +
+ +```solidity +function chillVoter( + address _voter, + uint256 _noOfRewardEpochs, + uint256[] _ftsoIndices +) external returns ( + bool[] _removed, + uint256 _untilRewardEpoch); +``` + +Used to chill a data provider, this is, remove it from the whitelist for a +specified number of reward epochs. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Data provider being chilled. | +| `_noOfRewardEpochs` | `uint256` | Number of epochs to chill the provider for. | +| `_ftsoIndices` | `uint256[]` | Array of indices of the FTSOs that will not allow this provider to submit data. | + +
+
+ +
+ +### `chilledUntilRewardEpoch` { #fn_chilleduntilrewardepoch } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function chilledUntilRewardEpoch( + address _voter +) external view returns ( + uint256); +``` + +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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 ID of the epoch where the data provider can start submitting prices again. | +
+
+ +
+ +### `defaultMaxVotersForFtso` { #fn_defaultmaxvotersforftso } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function defaultMaxVotersForFtso( +) external view returns ( + uint256); +``` + +Maximum number of voters in the whitelist for a new FTSO. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Default maximum allowed voters. | +
+
+ +
+ +### `getFtsoWhitelistedPriceProviders` { #fn_getftsowhitelistedpriceproviders } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function getFtsoWhitelistedPriceProviders( + uint256 _ftsoIndex +) external view returns ( + address[]); +``` + +Gets whitelisted price providers for the FTSO at a given index. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Queried index. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the whitelisted data providers. | +
+
+ +
+ +### `getFtsoWhitelistedPriceProvidersBySymbol` { #fn_getftsowhitelistedpriceprovidersbysymbol } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function getFtsoWhitelistedPriceProvidersBySymbol( + string _symbol +) external view returns ( + address[]); +``` + +Gets whitelisted price providers for the FTSO with a specified symbol. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | Queried symbol. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the whitelisted data providers. | +
+
+ +
+ +### `maxVotersForFtso` { #fn_maxvotersforftso } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function maxVotersForFtso( + uint256 _ftsoIndex +) external view returns ( + uint256); +``` + +Maximum number of voters in the whitelist for a specific FTSO. +Adjustable separately for each index. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the FTSO. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Maximum allowed voters. | +
+
+ +
+ +### `removeFtso` { #fn_removeftso } + +
+Defined in `IIVoterWhitelister` ([Docs](./IIVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIVoterWhitelister.sol)). +
+ +
+ +```solidity +function removeFtso( + uint256 _ftsoIndex +) external; +``` + +Clear whitelist for a removed FTSO. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the removed FTSO. | + +
+
+ +
+ +### `removeTrustedAddressFromWhitelist` { #fn_removetrustedaddressfromwhitelist } + +
+Defined in `IIVoterWhitelister` ([Docs](./IIVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIVoterWhitelister.sol)). +
+ +
+ +```solidity +function removeTrustedAddressFromWhitelist( + address _trustedAddress, + uint256 _ftsoIndex +) external; +``` + +Remove a trusted address from whitelist. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_trustedAddress` | `address` | Address to remove. | +| `_ftsoIndex` | `uint256` | Index of the FTSO being modified. | + +
+
+ +
+ +### `requestFullVoterWhitelisting` { #fn_requestfullvoterwhitelisting } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function requestFullVoterWhitelisting( + address _voter +) external returns ( + uint256[] _supportedIndices, + bool[] _success); +``` + +Requests whitelisting an account to act as a data provider for all active FTSOs. +May be called by any address, including the voter itself. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter to be whitelisted. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of currently supported FTSO indices. | +| `_success` | `bool[]` | Array of success flags by FTSO index. | +
+
+ +
+ +### `requestWhitelistingVoter` { #fn_requestwhitelistingvoter } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function requestWhitelistingVoter( + address _voter, + uint256 _ftsoIndex +) external; +``` + +Requests whitelisting an account to act as a data provider for a specific FTSO. +Reverts if the vote power of the account is too low. +May be called by any address, including the voter itself. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter to be whitelisted. | +| `_ftsoIndex` | `uint256` | Index of the FTSO. | + +
+
+ +
+ +### `setDefaultMaxVotersForFtso` { #fn_setdefaultmaxvotersforftso } + +
+Defined in `IIVoterWhitelister` ([Docs](./IIVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIVoterWhitelister.sol)). +
+ +
+ +```solidity +function setDefaultMaxVotersForFtso( + uint256 _defaultMaxVotersForFtso +) external; +``` + +Set the maximum number of voters in the whitelist for a new FTSOs. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_defaultMaxVotersForFtso` | `uint256` | New maximum default value. | + +
+
+ +
+ +### `setMaxVotersForFtso` { #fn_setmaxvotersforftso } + +
+Defined in `IIVoterWhitelister` ([Docs](./IIVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/interface/IIVoterWhitelister.sol)). +
+ +
+ +```solidity +function setMaxVotersForFtso( + uint256 _ftsoIndex, + uint256 _newMaxVoters +) external; +``` + +Set the maximum number of voters in the whitelist for a specific FTSO. +Can remove voters with the least votepower from the whitelist. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the FTSO to modify. | +| `_newMaxVoters` | `uint256` | New size of the whitelist. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IInflationGenesis.md b/docs/apis/smart-contracts/IInflationGenesis.md new file mode 100644 index 000000000..a5f6b3e9c --- /dev/null +++ b/docs/apis/smart-contracts/IInflationGenesis.md @@ -0,0 +1,49 @@ +--- +title: IInflationGenesis +--- + + + +# `IInflationGenesis` { #ct_iinflationgenesis } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IInflationGenesis.sol) +
+ +
+ +Portion of the [`Inflation`](./Inflation.md) contract that is available to contracts deployed at genesis. + +
+ +
+ +## Functions + +
+ +### `receiveMinting` { #fn_receiveminting } + +
+Defined in `IInflationGenesis` ([Docs](./IInflationGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IInflationGenesis.sol)). +
+ +
+ +```solidity +function receiveMinting( +) external payable; +``` + +Receive newly minted native tokens from the [`FlareDaemon`](./FlareDaemon.md). + +Assume that the received amount will be >= last topup requested across all services. +If there is not enough balance sent to cover the topup request, expect the library method to revert. +Also assume that any received balance greater than the calculated topup request +came from self-destructor sending a balance to this contract. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IPriceSubmitter.md b/docs/apis/smart-contracts/IPriceSubmitter.md new file mode 100644 index 000000000..fc19fc659 --- /dev/null +++ b/docs/apis/smart-contracts/IPriceSubmitter.md @@ -0,0 +1,310 @@ +--- +title: IPriceSubmitter +--- + + + +# `IPriceSubmitter` { #ct_ipricesubmitter } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol) +
+ +
+ +Interface for the [`PriceSubmitter`](./PriceSubmitter.md) contract. + +This is the contract used by all [FTSO data providers](https://docs.flare.network/tech/ftso) +to submit their data. + +
+ +
+ +## Events + +
+ +### `HashSubmitted` { #ev_hashsubmitted } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +event HashSubmitted( + address submitter, + uint256 epochId, + bytes32 hash, + uint256 timestamp +) +``` + +Emitted when a hash is submitted through [`submitHash`](#fn_submithash). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `submitter` | `address` | Address of the submitting data provider. | +| `epochId` | `uint256` | Current price epoch ID. | +| `hash` | `bytes32` | Submitted hash. | +| `timestamp` | `uint256` | Current block timestamp. | + +
+
+ +
+ +### `PricesRevealed` { #ev_pricesrevealed } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +event PricesRevealed( + address voter, + uint256 epochId, + contract IFtsoGenesis[] ftsos, + uint256[] prices, + uint256 random, + uint256 timestamp +) +``` + +Emitted when prices are revealed through `revealPrice`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `voter` | `address` | Address of the revealing data provider. | +| `epochId` | `uint256` | ID of the epoch in which the price hash is revealed. | +| `ftsos` | `contract IFtsoGenesis[]` | Array of FTSOs that correspond to the indexes in the call. | +| `prices` | `uint256[]` | List of revealed prices. | +| `random` | `uint256` | Revealed random number. | +| `timestamp` | `uint256` | Current block timestamp. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `getCurrentRandom` { #fn_getcurrentrandom } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getCurrentRandom( +) external view returns ( + uint256); +``` + +Returns the random number for the previous epoch, obtained from the random numbers +provided by all data providers along with their data submissions. +Note that the random number for the previous epoch keeps updating as new submissions are revealed. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Random number calculated from all data provider's submissions. | +
+
+ +
+ +### `getFtsoManager` { #fn_getftsomanager } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getFtsoManager( +) external view returns ( + contract IFtsoManagerGenesis); +``` + +Returns the address of the [`FtsoManager`](./FtsoManager.md) contract. + +
+
+ +
+ +### `getFtsoRegistry` { #fn_getftsoregistry } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getFtsoRegistry( +) external view returns ( + contract IFtsoRegistryGenesis); +``` + +Returns the address of the [`FtsoRegistry`](./FtsoRegistry.md) contract. + +
+
+ +
+ +### `getRandom` { #fn_getrandom } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getRandom( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns the random number used in a specific past epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the queried epoch. Current epoch cannot be queried, and the previous epoch is constantly updated as data providers reveal their prices and random numbers. Note that only the last 50 epochs can be queried and there is no bounds checking for this parameter. Out-of-bounds queries return undefined values. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The random number used in that epoch. | +
+
+ +
+ +### `getVoterWhitelister` { #fn_getvoterwhitelister } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function getVoterWhitelister( +) external view returns ( + address); +``` + +Returns the address of the [`VoterWhitelister`](./VoterWhitelister.md) contract managing the data provider whitelist. + +
+
+ +
+ +### `revealPrices` { #fn_revealprices } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function revealPrices( + uint256 _epochId, + uint256[] _ftsoIndices, + uint256[] _prices, + uint256 _random +) external; +``` + +Reveals submitted prices during the epoch reveal period. +The hash of FTSO indices, prices, random number, and voter address must be equal +to the hash previously submitted with [`submitHash`](#fn_submithash). +Emits a [`PricesRevealed`](#ev_pricesrevealed) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to which the price hashes are submitted. | +| `_ftsoIndices` | `uint256[]` | List of FTSO indices in ascending order. | +| `_prices` | `uint256[]` | List of submitted prices in USD. | +| `_random` | `uint256` | Submitted random number. | + +
+
+ +
+ +### `submitHash` { #fn_submithash } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function submitHash( + uint256 _epochId, + bytes32 _hash +) external; +``` + +Submits a hash for the current epoch. Can only be called by FTSO data providers +whitelisted through the `VoterWhitelisted` contract. +Emits the [`HashSubmitted`](#ev_hashsubmitted) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the target epoch to which the hash is submitted. | +| `_hash` | `bytes32` | A hash of the FTSO indices, prices, random number, and voter address. | + +
+
+ +
+ +### `voterWhitelistBitmap` { #fn_voterwhitelistbitmap } + +
+Defined in `IPriceSubmitter` ([Docs](./IPriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IPriceSubmitter.sol)). +
+ +
+ +```solidity +function voterWhitelistBitmap( + address _voter +) external view returns ( + uint256); +``` + +Returns a bitmap of all FTSOs for which a data provider is allowed to submit prices or hashes. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | If a data provider is allowed to vote for a given FTSO index, the corresponding bit in the result is 1. | +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IVPContractEvents.md b/docs/apis/smart-contracts/IVPContractEvents.md new file mode 100644 index 000000000..56bc0c9f4 --- /dev/null +++ b/docs/apis/smart-contracts/IVPContractEvents.md @@ -0,0 +1,93 @@ +--- +title: IVPContractEvents +--- + + + +# `IVPContractEvents` { #ct_ivpcontractevents } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPContractEvents.sol) +
+ +
+ +Events interface for vote-power related operations. + +
+ +
+ +## Events + +
+ +### `Delegate` { #ev_delegate } + +
+Defined in `IVPContractEvents` ([Docs](./IVPContractEvents.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPContractEvents.sol)). +
+ +
+ +```solidity +event Delegate( + address from, + address to, + uint256 priorVotePower, + uint256 newVotePower +) +``` + +Emitted when the amount of vote power delegated from one account to another changes. + +**Note**: This event is always emitted from [`VPToken`](./VPToken.md)'s `writeVotePowerContract`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `from` | `address` | The account that has changed the amount of vote power it is delegating. | +| `to` | `address` | The account whose received vote power has changed. | +| `priorVotePower` | `uint256` | The vote power originally delegated. | +| `newVotePower` | `uint256` | The new vote power that triggered this event. It can be 0 if the delegation is completely canceled. | + +
+
+ +
+ +### `Revoke` { #ev_revoke } + +
+Defined in `IVPContractEvents` ([Docs](./IVPContractEvents.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPContractEvents.sol)). +
+ +
+ +```solidity +event Revoke( + address delegator, + address delegatee, + uint256 votePower, + uint256 blockNumber +) +``` + +Emitted when an account revokes its vote power delegation to another account +for a single current or past block (typically the current vote block). + +**Note**: This event is always emitted from [`VPToken`](./VPToken.md)'s `writeVotePowerContract` or `readVotePowerContract`. + +See `revokeDelegationAt` in [`IVPToken`](./IVPToken.md). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `delegator` | `address` | The account that revoked the delegation. | +| `delegatee` | `address` | The account that has been revoked. | +| `votePower` | `uint256` | The revoked vote power. | +| `blockNumber` | `uint256` | The block number at which the delegation has been revoked. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IVPToken.md b/docs/apis/smart-contracts/IVPToken.md new file mode 100644 index 000000000..399f63b12 --- /dev/null +++ b/docs/apis/smart-contracts/IVPToken.md @@ -0,0 +1,950 @@ +--- +title: IVPToken +--- + + + +# `IVPToken` { #ct_ivptoken } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol) | Inherits from IERC20 +
+ +
+ +Vote power token interface. + +
+ +
+ +## Functions + +
+ +### `allowance` { #fn_allowance } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function allowance( + address owner, + address spender +) external view returns ( + uint256); +``` + +Returns the remaining number of tokens that `spender` will be +allowed to spend on behalf of `owner` through [`transferFrom`](#fn_transferfrom). This is +zero by default. + +This value changes when [`approve`](#fn_approve) or [`transferFrom`](#fn_transferfrom) are called. + +
+
+ +
+ +### `approve` { #fn_approve } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function approve( + address spender, + uint256 amount +) external returns ( + bool); +``` + +Sets `amount` as the [`allowance`](#fn_allowance) of `spender` over the caller's tokens. + +Returns a boolean value indicating whether the operation succeeded. + +IMPORTANT: Beware that changing an [`allowance`](#fn_allowance) with this method brings the risk +that someone may use both the old and the new [`allowance`](#fn_allowance) by unfortunate +transaction ordering. One possible solution to mitigate this race +condition is to first reduce the spender's [`allowance`](#fn_allowance) to 0 and set the +desired value afterwards: +https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + +Emits an [`Approval`](#ev_approval) event. + +
+
+ +
+ +### `balanceOf` { #fn_balanceof } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function balanceOf( + address account +) external view returns ( + uint256); +``` + +Returns the amount of tokens owned by `account`. + +
+
+ +
+ +### `balanceOfAt` { #fn_balanceofat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function balanceOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Queries the token balance of `_owner` at a specific `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address from which the balance will be retrieved. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The balance at `_blockNumber`. | +
+
+ +
+ +### `batchDelegate` { #fn_batchdelegate } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function batchDelegate( + address[] _delegatees, + uint256[] _bips +) external; +``` + +Undelegate all percentage delegations from the sender and then [`delegate`](#fn_delegate) corresponding + `_bips` percentage of voting power from the sender to each member of the `_delegatees` array. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegatees` | `address[]` | The addresses of the new recipients. | +| `_bips` | `uint256[]` | The percentages of voting power to be delegated expressed in basis points (1/100 of one percent). The sum of all `_bips` values must be at most 10000 (100%). | + +
+
+ +
+ +### `decimals` { #fn_decimals } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function decimals( +) external view returns ( + uint8); +``` + +Returns the number of [`decimals`](#fn_decimals) used to get its user representation. +For example, if [`decimals`](#fn_decimals) equals 2, a balance of 505 tokens should +be displayed to a user as 5.05 (505 / 102). + +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 +[`balanceOf`](#fn_balanceof) and [`transfer`](#fn_transfer). + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegate( + address _to, + uint256 _bips +) external; +``` + +Delegate voting power to account `_to` from `msg.sender`, by percentage. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_bips` | `uint256` | 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 a value of 0 revokes all previous delegations). | + +
+
+ +
+ +### `delegateExplicit` { #fn_delegateexplicit } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegateExplicit( + address _to, + uint256 _amount +) external; +``` + +Explicitly [`delegate`](#fn_delegate) `_amount` voting power to account `_to` from `msg.sender`. +Compare with [`delegate`](#fn_delegate) which delegates by percentage. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_amount` | `uint256` | An explicit vote power amount to be delegated. Not cumulative: every call resets the delegation value (and a value of 0 revokes all previous delegations). | + +
+
+ +
+ +### `delegatesOf` { #fn_delegatesof } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegatesOf( + address _who +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the list of addresses to which `_who` is delegating, and their percentages. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Positional array of addresses being delegated to. | +| `_bips` | `uint256[]` | Positional array of delegation percents specified in basis points (1/100 of 1 percent). Each one matches the address in the same position in the `_delegateAddresses` array. | +| `_count` | `uint256` | The number of delegates. | +| `_delegationMode` | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `delegatesOfAt` { #fn_delegatesofat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegatesOfAt( + address _who, + uint256 _blockNumber +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the list of addresses to which `_who` is delegating, and their percentages, at the given block. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Positional array of addresses being delegated to. | +| `_bips` | `uint256[]` | Positional array of delegation percents specified in basis points (1/100 of 1 percent). Each one matches the address in the same position in the `_delegateAddresses` array. | +| `_count` | `uint256` | The number of delegates. | +| `_delegationMode` | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `delegationModeOf` { #fn_delegationmodeof } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function delegationModeOf( + address _who +) external view returns ( + uint256); +``` + +Get the delegation mode for account '_who'. This mode determines whether vote power is +allocated by percentage or by explicit amount. Once the delegation mode is set, +it can never be changed, even if all delegations are removed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address to get delegation mode. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `governanceVotePower` { #fn_governancevotepower } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function governanceVotePower( +) external view returns ( + contract IGovernanceVotePower); +``` + +When set, allows token owners to participate in governance voting +and delegating governance vote power. + +
+
+ +
+ +### `name` { #fn_name } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function name( +) external view returns ( + string); +``` + +Returns the [`name`](#fn_name) of the token. + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `readVotePowerContract` { #fn_readvotepowercontract } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function readVotePowerContract( +) external view returns ( + contract IVPContractEvents); +``` + +Returns [`VPContract`](./VPContract.md) event interface used for read-only operations (view methods). +The only non-view method that might be called on it is [`revokeDelegationAt`](#fn_revokedelegationat). + +[`readVotePowerContract`](#fn_readvotepowercontract) is almost always equal to [`writeVotePowerContract`](#fn_writevotepowercontract) +except during an upgrade from one [`VPContract`](./VPContract.md) to a new version (which should happen +rarely or never and will be announced beforehand). + +Do not call any methods on [`VPContract`](./VPContract.md) directly. +State changing methods are forbidden from direct calls. +All methods are exposed via [`VPToken`](./VPToken.md). +This is the reason that this method returns [`IVPContractEvents`](./IVPContractEvents.md). +Use it only for listening to events and revoking. + +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _who, + uint256 _blockNumber +) external; +``` + +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`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) / [`delegateExplicit`](#fn_delegateexplicit) with value of 0 or [`undelegateAll`](#fn_undelegateall) / [`undelegateAllExplicit`](#fn_undelegateallexplicit). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | Address of the delegatee. | +| `_blockNumber` | `uint256` | The block number at which to revoke delegation.. | + +
+
+ +
+ +### `symbol` { #fn_symbol } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function symbol( +) external view returns ( + string); +``` + +Returns the [`symbol`](#fn_symbol) of the token, usually a shorter version of the [`name`](#fn_name). + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `totalSupply` { #fn_totalsupply } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function totalSupply( +) external view returns ( + uint256); +``` + +Returns the amount of tokens in existence. + +
+
+ +
+ +### `totalSupplyAt` { #fn_totalsupplyat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function totalSupplyAt( + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Total amount of tokens held by all accounts at a specific block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total amount of tokens at `_blockNumber`. | +
+
+ +
+ +### `totalVotePower` { #fn_totalvotepower } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function totalVotePower( +) external view returns ( + uint256); +``` + +Get the current total vote power. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The current total vote power (sum of all accounts' vote power). | +
+
+ +
+ +### `totalVotePowerAt` { #fn_totalvotepowerat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function totalVotePowerAt( + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the total vote power at block `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total vote power at the queried block (sum of all accounts' vote powers). | +
+
+ +
+ +### `transfer` { #fn_transfer } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function transfer( + address recipient, + uint256 amount +) external returns ( + bool); +``` + +Moves `amount` tokens from the caller's account to `recipient`. + +Returns a boolean value indicating whether the operation succeeded. + +Emits a [`Transfer`](#ev_transfer) event. + +
+
+ +
+ +### `transferFrom` { #fn_transferfrom } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function transferFrom( + address sender, + address recipient, + uint256 amount +) external returns ( + bool); +``` + +Moves `amount` tokens from `sender` to `recipient` using the +[`allowance`](#fn_allowance) mechanism. `amount` is then deducted from the caller's +[`allowance`](#fn_allowance). + +Returns a boolean value indicating whether the operation succeeded. + +Emits a [`Transfer`](#ev_transfer) event. + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function undelegateAll( +) external; +``` + +Undelegate all voting power of `msg.sender`. This effectively revokes all previous delegations. +Can only be used with percentage delegation. +Does not reset delegation mode back to NOT SET. + +
+
+ +
+ +### `undelegateAllExplicit` { #fn_undelegateallexplicit } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function undelegateAllExplicit( + address[] _delegateAddresses +) external returns ( + uint256); +``` + +Undelegate all explicit vote power by amount of `msg.sender`. +Can only be used with explicit delegation. +Does not reset delegation mode back to NOT SET. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Explicit delegation does not store delegatees' addresses, so the caller must supply them. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The amount still delegated (in case the list of delegates was incomplete). | +
+
+ +
+ +### `undelegatedVotePowerOf` { #fn_undelegatedvotepowerof } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOf( + address _owner +) external view returns ( + uint256); +``` + +Compute the current undelegated vote power of the `_owner` account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`. | +
+
+ +
+ +### `undelegatedVotePowerOfAt` { #fn_undelegatedvotepowerofat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the undelegated vote power of the `_owner` account at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`. | +
+
+ +
+ +### `votePowerFromTo` { #fn_votepowerfromto } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerFromTo( + address _from, + address _to +) external view returns ( + uint256); +``` + +Get current delegated vote power from delegator `_from` to delegatee `_to`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of delegator. | +| `_to` | `address` | Address of delegatee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | votePower The delegated vote power. | +
+
+ +
+ +### `votePowerFromToAt` { #fn_votepowerfromtoat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerFromToAt( + address _from, + address _to, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get delegated vote power from delegator `_from` to delegatee `_to` at `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of delegator. | +| `_to` | `address` | Address of delegatee. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The delegated vote power. | +
+
+ +
+ +### `votePowerOf` { #fn_votepowerof } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerOf( + address _owner +) external view returns ( + uint256); +``` + +Get the current vote power of `_owner`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Current vote power of `_owner`. | +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at block number `_blockNumber`. | +
+
+ +
+ +### `votePowerOfAtIgnoringRevocation` { #fn_votepowerofatignoringrevocation } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAtIgnoringRevocation( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber`, ignoring revocation information (and cache). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at block number `_blockNumber`. Result doesn't change if vote power is revoked. | +
+
+ +
+ +### `writeVotePowerContract` { #fn_writevotepowercontract } + +
+Defined in `IVPToken` ([Docs](./IVPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVPToken.sol)). +
+ +
+ +```solidity +function writeVotePowerContract( +) external view returns ( + contract IVPContractEvents); +``` + +Returns [`VPContract`](./VPContract.md) event interface used for state-changing operations (non-view methods). +The only non-view method that might be called on it is [`revokeDelegationAt`](#fn_revokedelegationat). + +[`writeVotePowerContract`](#fn_writevotepowercontract) is almost always equal to [`readVotePowerContract`](#fn_readvotepowercontract), +except during upgrade from one [`VPContract`](./VPContract.md) to a new version (which should happen +rarely or never and will be announced beforehand). +In the case of an upgrade, [`writeVotePowerContract`](#fn_writevotepowercontract) is replaced first to establish delegations. +After some period (e.g., after a reward epoch ends), [`readVotePowerContract`](#fn_readvotepowercontract) is set equal to it. + +Do not call any methods on [`VPContract`](./VPContract.md) directly. +State changing methods are forbidden from direct calls. +All are exposed via [`VPToken`](./VPToken.md). +This is the reason that this method returns [`IVPContractEvents`](./IVPContractEvents.md) +Use it only for listening to events, delegating, and revoking. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IVoterWhitelister.md b/docs/apis/smart-contracts/IVoterWhitelister.md new file mode 100644 index 000000000..5780e600b --- /dev/null +++ b/docs/apis/smart-contracts/IVoterWhitelister.md @@ -0,0 +1,316 @@ +--- +title: IVoterWhitelister +--- + + + +# `IVoterWhitelister` { #ct_ivoterwhitelister } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol) +
+ +
+ +Interface for managers of the [FTSO whitelist](https://docs.flare.network/infra/data/whitelisting/). + +Only addresses registered in this contract can submit data to the FTSO system. + +
+ +
+ +## Events + +
+ +### `VoterChilled` { #ev_voterchilled } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +event VoterChilled( + address voter, + uint256 untilRewardEpoch +) +``` + +Emitted when an account is chilled from the voter whitelist. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `voter` | `address` | Address of the chilled account. | +| `untilRewardEpoch` | `uint256` | Epoch ID when the chill will be lifted. | + +
+
+ +
+ +### `VoterRemovedFromWhitelist` { #ev_voterremovedfromwhitelist } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +event VoterRemovedFromWhitelist( + address voter, + uint256 ftsoIndex +) +``` + +Emitted when an account is removed from the voter whitelist. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `voter` | `address` | Address of the removed account. | +| `ftsoIndex` | `uint256` | Index of the FTSO in which it was registered. | + +
+
+ +
+ +### `VoterWhitelisted` { #ev_voterwhitelisted } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +event VoterWhitelisted( + address voter, + uint256 ftsoIndex +) +``` + +Emitted when an account is added to the voter whitelist. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `voter` | `address` | Address of the added account. | +| `ftsoIndex` | `uint256` | Index of the FTSO to which it has been registered. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `chilledUntilRewardEpoch` { #fn_chilleduntilrewardepoch } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function chilledUntilRewardEpoch( + address _voter +) external view returns ( + uint256); +``` + +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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 ID of the epoch where the data provider can start submitting prices again. | +
+
+ +
+ +### `defaultMaxVotersForFtso` { #fn_defaultmaxvotersforftso } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function defaultMaxVotersForFtso( +) external view returns ( + uint256); +``` + +Maximum number of voters in the whitelist for a new FTSO. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Default maximum allowed voters. | +
+
+ +
+ +### `getFtsoWhitelistedPriceProviders` { #fn_getftsowhitelistedpriceproviders } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function getFtsoWhitelistedPriceProviders( + uint256 _ftsoIndex +) external view returns ( + address[]); +``` + +Gets whitelisted price providers for the FTSO at a given index. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Queried index. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the whitelisted data providers. | +
+
+ +
+ +### `getFtsoWhitelistedPriceProvidersBySymbol` { #fn_getftsowhitelistedpriceprovidersbysymbol } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function getFtsoWhitelistedPriceProvidersBySymbol( + string _symbol +) external view returns ( + address[]); +``` + +Gets whitelisted price providers for the FTSO with a specified symbol. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | Queried symbol. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the whitelisted data providers. | +
+
+ +
+ +### `maxVotersForFtso` { #fn_maxvotersforftso } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function maxVotersForFtso( + uint256 _ftsoIndex +) external view returns ( + uint256); +``` + +Maximum number of voters in the whitelist for a specific FTSO. +Adjustable separately for each index. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the FTSO. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Maximum allowed voters. | +
+
+ +
+ +### `requestFullVoterWhitelisting` { #fn_requestfullvoterwhitelisting } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function requestFullVoterWhitelisting( + address _voter +) external returns ( + uint256[] _supportedIndices, + bool[] _success); +``` + +Requests whitelisting an account to act as a data provider for all active FTSOs. +May be called by any address, including the voter itself. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter to be whitelisted. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of currently supported FTSO indices. | +| `_success` | `bool[]` | Array of success flags by FTSO index. | +
+
+ +
+ +### `requestWhitelistingVoter` { #fn_requestwhitelistingvoter } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function requestWhitelistingVoter( + address _voter, + uint256 _ftsoIndex +) external; +``` + +Requests whitelisting an account to act as a data provider for a specific FTSO. +Reverts if the vote power of the account is too low. +May be called by any address, including the voter itself. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter to be whitelisted. | +| `_ftsoIndex` | `uint256` | Index of the FTSO. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/IWNat.md b/docs/apis/smart-contracts/IWNat.md new file mode 100644 index 000000000..b33e4b7ad --- /dev/null +++ b/docs/apis/smart-contracts/IWNat.md @@ -0,0 +1,147 @@ +--- +title: IWNat +--- + + + +# `IWNat` { #ct_iwnat } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IWNat.sol) +
+ +
+ +Wrapped native token interface. + +This contract converts native tokens into `WNAT` (wrapped native) tokens and vice versa. +`WNAT` tokens are a one-to-one [ERC20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) +representation of native tokens, which are minted and burned as needed by this contract. + +The wrapped versions of the native `FLR` and `SGB` tokens are called `WFLR` and `WSGB` respectively. + +Code attribution: WETH9. + +
+ +
+ +## Functions + +
+ +### `deposit` { #fn_deposit } + +
+Defined in `IWNat` ([Docs](./IWNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IWNat.sol)). +
+ +
+ +```solidity +function deposit( +) external payable; +``` + +Deposits native tokens and mints the same amount of `WNAT` tokens, +which are added to the `msg.sender`'s balance. +This operation is commonly known as "wrapping". + +
+
+ +
+ +### `depositTo` { #fn_depositto } + +
+Defined in `IWNat` ([Docs](./IWNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IWNat.sol)). +
+ +
+ +```solidity +function depositTo( + address _recipient +) external payable; +``` + +Deposits native tokens and mints the same amount of `WNAT` tokens, +which are added to `_recipient`'s balance. +This operation is commonly known as "wrapping". + +This is equivalent to using [`deposit`](#fn_deposit) followed by `transfer`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipient` | `address` | The address to receive the minted `WNAT`. | + +
+
+ +
+ +### `withdraw` { #fn_withdraw } + +
+Defined in `IWNat` ([Docs](./IWNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IWNat.sol)). +
+ +
+ +```solidity +function withdraw( + uint256 _amount +) external; +``` + +Burns `_amount` of `WNAT` tokens from `msg.sender`'s `WNAT` balance and +transfers the same amount of native tokens to `msg.sender`. +This operation is commonly known as "unwrapping". + +Reverts if `_amount` is higher than `msg.sender`'s `WNAT` balance. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_amount` | `uint256` | The amount to withdraw. | + +
+
+ +
+ +### `withdrawFrom` { #fn_withdrawfrom } + +
+Defined in `IWNat` ([Docs](./IWNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IWNat.sol)). +
+ +
+ +```solidity +function withdrawFrom( + address _owner, + uint256 _amount +) external; +``` + +Burns `_amount` of `WNAT` tokens from `_owner`'s `WNAT` balance and +transfers the same amount of native tokens to `msg.sender`. +This operation is commonly known as "unwrapping". + +`msg.sender` must have been authorized to [`withdraw`](#fn_withdraw) from `_owner`'s account +through ERC-20's approve mechanism. + +Reverts if `_amount` is higher than `_owners`'s `WNAT` balance or than +`msg.sender`'s allowance over `_owner`'s tokens. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address containing the tokens to withdraw. | +| `_amount` | `uint256` | The amount to withdraw. | + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/Inflation.md b/docs/apis/smart-contracts/Inflation.md new file mode 100644 index 000000000..338130765 --- /dev/null +++ b/docs/apis/smart-contracts/Inflation.md @@ -0,0 +1,1216 @@ +--- +title: Inflation +--- + + + +# `Inflation` { #ct_inflation } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol) | Inherits from [IInflationGenesis](./IInflationGenesis.md), [GovernedAndFlareDaemonized](./GovernedAndFlareDaemonized.md), [IFlareDaemonize](./IFlareDaemonize.md), [AddressUpdatable](./AddressUpdatable.md) +
+ +
+ +Recognizes, authorizes, mints, and funds native tokens to Flare services that are rewardable through inflation. + +See the [technical specification]( +https://gitlab.com/flarenetwork/flare-smart-contracts/-/blob/master/docs/specs/Inflation.md). + +
+ +
+ +## Events + +
+ +### `GovernanceCallTimelocked` { #ev_governancecalltimelocked } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceCallTimelocked( + bytes4 selector, + uint256 allowedAfterTimestamp, + bytes encodedCall +) +``` + +Emitted when a new [`governance`](#fn_governance) call has been recorded and is now waiting for the time lock to expire. + +
+
+ +
+ +### `GovernanceInitialised` { #ev_governanceinitialised } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceInitialised( + address initialGovernance +) +``` + +Emitted when the [`governance`](#fn_governance) address is initialized. +This address will be used until production mode is entered (see [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered)). +At that point the [`governance`](#fn_governance) address is taken from [`GovernanceSettings`](./GovernanceSettings.md). + +
+
+ +
+ +### `GovernedProductionModeEntered` { #ev_governedproductionmodeentered } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernedProductionModeEntered( + address governanceSettings +) +``` + +Emitted when [`governance`](#fn_governance) is enabled and the [`governance`](#fn_governance) address cannot be changed anymore +(only through a network fork). + +
+
+ +
+ +### `InflationAllocationSet` { #ev_inflationallocationset } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event InflationAllocationSet( + contract IIInflationAllocation inflationAllocation +) +``` + +
+
+ +
+ +### `InflationAuthorized` { #ev_inflationauthorized } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event InflationAuthorized( + uint256 amountWei +) +``` + +
+
+ +
+ +### `InflationRewardServiceDailyAuthorizedInflationComputed` { #ev_inflationrewardservicedailyauthorizedinflationcomputed } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event InflationRewardServiceDailyAuthorizedInflationComputed( + contract IIInflationReceiver inflationReceiver, + uint256 amountWei +) +``` + +
+
+ +
+ +### `InflationRewardServiceTopupComputed` { #ev_inflationrewardservicetopupcomputed } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event InflationRewardServiceTopupComputed( + contract IIInflationReceiver inflationReceiver, + uint256 amountWei +) +``` + +
+
+ +
+ +### `InflationRewardServiceTopupRequestReceived` { #ev_inflationrewardservicetopuprequestreceived } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event InflationRewardServiceTopupRequestReceived( + contract IIInflationReceiver inflationReceiver, + uint256 amountWei +) +``` + +
+
+ +
+ +### `MintingReceived` { #ev_mintingreceived } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event MintingReceived( + uint256 amountWei, + uint256 selfDestructAmountWei +) +``` + +
+
+ +
+ +### `NewTimeSlotInitialized` { #ev_newtimeslotinitialized } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event NewTimeSlotInitialized( + uint256 startTimeStamp, + uint256 endTimeStamp, + uint256 inflatableSupplyWei, + uint256 recognizedInflationWei +) +``` + +
+
+ +
+ +### `SupplySet` { #ev_supplyset } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event SupplySet( + contract IISupply oldSupply, + contract IISupply newSupply +) +``` + +
+
+ +
+ +### `TimelockedGovernanceCallCanceled` { #ev_timelockedgovernancecallcanceled } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallCanceled( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is canceled before execution. + +
+
+ +
+ +### `TimelockedGovernanceCallExecuted` { #ev_timelockedgovernancecallexecuted } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallExecuted( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is executed. + +
+
+ +
+ +### `TopupConfigurationSet` { #ev_topupconfigurationset } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event TopupConfigurationSet( + struct TopupConfiguration topupConfiguration +) +``` + +
+
+ +
+ +### `TopupRequested` { #ev_topuprequested } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +event TopupRequested( + uint256 requestAmountWei, + uint256 reRequestAmountWei +) +``` + +
+
+ +
+ +
+ +## Functions + +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + contract FlareDaemon _flareDaemon, + address _addressUpdater, + uint256 _rewardEpochStartTs +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `GovernedAndFlareDaemonized` ([Docs](./GovernedAndFlareDaemonized.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + contract FlareDaemon _flareDaemon +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `daemonize` { #fn_daemonize } + +
+Defined in `IFlareDaemonize` ([Docs](./IFlareDaemonize.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/interface/IFlareDaemonize.sol)). +
+ +
+ +```solidity +function daemonize( +) external returns ( + bool); +``` + +Implement this function to receive a trigger from the [`FlareDaemon`](./FlareDaemon.md). +The trigger method is called by the validator right at the end of block state transition. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | bool Whether the contract is still active after the call. Currently unused. | +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getContractName` { #fn_getcontractname } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function getContractName( +) external pure returns ( + string); +``` + +Implement this function to allow updating daemonized contracts through the [`AddressUpdater`](./AddressUpdater.md). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `string` | string Contract name. | +
+
+ +
+ +### `getCurrentTimeSlot` { #fn_getcurrenttimeslot } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function getCurrentTimeSlot( +) external view returns ( + struct InflationTimeSlots.InflationTimeSlot); +``` + +Return the current time slot. + +Expect library to revert if there is no current time slot. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct InflationTimeSlots.InflationTimeSlot` | The inflation time slot state of the current time slot. | +
+
+ +
+ +### `getCurrentTimeSlotId` { #fn_getcurrenttimeslotid } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function getCurrentTimeSlotId( +) external view returns ( + uint256); +``` + +Return current time slot id. + +Expect library to revert if there is no current time slot. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Id of the current time slot. | +
+
+ +
+ +### `getNextExpectedTopupTs` { #fn_getnextexpectedtopupts } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function getNextExpectedTopupTs( +) external view returns ( + uint256 _nextTopupTs); +``` + +Returns next expected inflation topup time stamp which is also inflation authorization time. +The returned time from this API is actually the time of the block in which the topup is requested. +The Actual topup will take place in the next block. +Expected diff is up to a few seconds (max is less then a minute). + +
+
+ +
+ +### `getRewardServices` { #fn_getrewardservices } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function getRewardServices( +) external view returns ( + struct InflationRewardServices.RewardService[]); +``` + +Return the structure of reward services. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct InflationRewardServices.RewardService[]` | Reward services structure. | +
+
+ +
+ +### `getTimeSlot` { #fn_gettimeslot } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function getTimeSlot( + uint256 _index +) external view returns ( + struct InflationTimeSlots.InflationTimeSlot); +``` + +Given an index, return the time slot at that index. + +Expect library to revert if index not found. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_index` | `uint256` | The index of the time slot to fetch. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `struct InflationTimeSlots.InflationTimeSlot` | The inflation time slot state. | +
+
+ +
+ +### `getTopupConfiguration` { #fn_gettopupconfiguration } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function getTopupConfiguration( + contract IIInflationReceiver _inflationReceiver +) external view returns ( + struct TopupConfiguration _topupConfiguration); +``` + +Given an inflation receiver, get the topup configuration. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_inflationReceiver` | `contract IIInflationReceiver` | The reward service. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_topupConfiguration` | `struct TopupConfiguration` | The configuration of how the topup requests are calculated for a given reward service. | +
+
+ +
+ +### `getTotals` { #fn_gettotals } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function getTotals( +) external view returns ( + uint256 _totalAuthorizedInflationWei, + uint256 _totalInflationTopupRequestedWei, + uint256 _totalInflationTopupDistributedWei, + uint256 _totalRecognizedInflationWei); +``` + +Get a tuple of totals across inflation time slots. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_totalAuthorizedInflationWei` | `uint256` | Total inflation authorized to be mintable | +| `_totalInflationTopupRequestedWei` | `uint256` | Total inflation requested to be topped up for rewarding | +| `_totalInflationTopupDistributedWei` | `uint256` | Total inflation received for funding reward services | +| `_totalRecognizedInflationWei` | `uint256` | Total inflation recognized for rewarding | +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `receiveMinting` { #fn_receiveminting } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function receiveMinting( +) external payable; +``` + +Receive newly minted native tokens from the [`FlareDaemon`](./FlareDaemon.md). + +Assume that the received amount will be >= last topup requested across all services. +If there is not enough balance sent to cover the topup request, expect the library method to revert. +Also assume that any received balance greater than the calculated topup request +came from self-destructor sending a balance to this contract. + +
+
+ +
+ +### `setInitialData` { #fn_setinitialdata } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function setInitialData( + contract IIInflationV1 _oldInflation, + uint256 _noOfAnnums +) external; +``` + +Used to copy data from old inflation contract. + +Only [`governance`](#fn_governance) can call. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_oldInflation` | `contract IIInflationV1` | Address of old inflation. | +| `_noOfAnnums` | `uint256` | Number of annums in old inflation. | + +
+
+ +
+ +### `setPreInflationCalculation` { #fn_setpreinflationcalculation } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function setPreInflationCalculation( + contract IIPreInflationCalculation _preInflationCalculation +) external; +``` + +Set contract that should be triggered before new inflation is calculated (it can be address(0)) + +Only [`governance`](#fn_governance) can call. + +
+
+ +
+ +### `setTopupConfiguration` { #fn_settopupconfiguration } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function setTopupConfiguration( + contract IIInflationReceiver _inflationReceiver, + enum TopupType _topupType, + uint256 _topupFactorX100 +) external; +``` + +Set the topup configuration for a reward service. + +Only [`governance`](#fn_governance) can call. + +Topup factor, if _topupType == FACTOROFDAILYAUTHORIZED, must be greater than 100. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_inflationReceiver` | `contract IIInflationReceiver` | The reward service to receive the inflation funds for distribution. | +| `_topupType` | `enum TopupType` | The type to signal how the topup amounts are to be calculated. FACTOROFDAILYAUTHORIZED = Use a factor of last daily authorized to set a target balance for a reward service to maintain as a reserve for claiming. ALLAUTHORIZED = Mint enough native tokens to topup reward service contract to hold all authorized but unrequested rewards. | +| `_topupFactorX100` | `uint256` | If _topupType == FACTOROFDAILYAUTHORIZED, then this factor (times 100) is multiplied by last daily authorized inflation to obtain the maximum balance that a reward service can hold at any given time. If it holds less, then this max amount is used to compute the mint request topup required to bring the reward service contract native token balance up to that amount. | + +
+
+ +
+ +### `switchToFallbackMode` { #fn_switchtofallbackmode } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +function switchToFallbackMode( +) external view returns ( + bool); +``` + +This function will be called after an error is caught in [`daemonize`](#fn_daemonize). +It will switch the contract to a simpler fallback mode, which hopefully works when full mode doesn't. +Not every contract needs to support fallback mode ([`FtsoManager`](./FtsoManager.md) does), so this method may be empty. +Switching back to normal mode is left to the contract (typically a governed method call). +This function may be called due to low-gas error, so it shouldn't use more than ~30.000 gas. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `bool` | True if switched to fallback mode, false if already in fallback mode or if fallback mode is not supported. | +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `notZero` { #md_notzero } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity +modifier notZero( address _address) +``` + +
+
+ +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +### `onlyFlareDaemon` { #md_onlyflaredaemon } + +
+Defined in `GovernedAndFlareDaemonized` ([Docs](./GovernedAndFlareDaemonized.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol)). +
+ +
+ +```solidity +modifier onlyFlareDaemon() +``` + +Only the [`flareDaemon`](#va_flaredaemon) can call this method. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +
+ +## Variables + +
+ +### `flareDaemon` { #va_flaredaemon } + +
+Defined in `GovernedAndFlareDaemonized` ([Docs](./GovernedAndFlareDaemonized.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/GovernedAndFlareDaemonized.sol)). +
+ +
+ +```solidity + contract FlareDaemon flareDaemon +``` + +The [`FlareDaemon`](./FlareDaemon.md) contract, set at construction time. + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `inflationAllocation` { #va_inflationallocation } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity + contract IIInflationAllocation inflationAllocation +``` + +
+
+ +
+ +### `lastAuthorizationTs` { #va_lastauthorizationts } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity + uint256 lastAuthorizationTs +``` + +The last time inflation was authorized. + +
+
+ +
+ +### `preInflationCalculation` { #va_preinflationcalculation } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity + contract IIPreInflationCalculation preInflationCalculation +``` + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `rewardEpochStartTs` { #va_rewardepochstartts } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity + uint256 rewardEpochStartTs +``` + +Do not start inflation time slots before this, in seconds after UNIX epoch. + +
+
+ +
+ +### `rewardEpochStartedTs` { #va_rewardepochstartedts } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity + uint256 rewardEpochStartedTs +``` + +When the first reward epoch was started, in seconds after UNIX epoch. + +
+
+ +
+ +### `supply` { #va_supply } + +
+Defined in `Inflation` ([Docs](./Inflation.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/inflation/implementation/Inflation.sol)). +
+ +
+ +```solidity + contract IISupply supply +``` + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/PriceSubmitter.md b/docs/apis/smart-contracts/PriceSubmitter.md new file mode 100644 index 000000000..de6c859c6 --- /dev/null +++ b/docs/apis/smart-contracts/PriceSubmitter.md @@ -0,0 +1,766 @@ +--- +title: PriceSubmitter +--- + + + +# `PriceSubmitter` { #ct_pricesubmitter } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol) | Inherits from [IIPriceSubmitter](./IIPriceSubmitter.md), [GovernedAtGenesis](./GovernedAtGenesis.md), [AddressUpdatable](./AddressUpdatable.md) +
+ +
+ +Receives prices from [FTSO data providers](https://docs.flare.network/tech/ftso). + +It then forwards the submissions to the appropriate FTSO contract, +allowing data providers to perform all required operations in a single transaction +per price epoch. + +
+ +
+ +## Functions + +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +constructor( +) public; +``` + +This [`constructor`](#fn_constructor) should contain no code as this contract is pre-loaded into the genesis block. + The super constructors are called for testing convenience. + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getCurrentRandom` { #fn_getcurrentrandom } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function getCurrentRandom( +) external view returns ( + uint256); +``` + +Returns the random number for the previous epoch, obtained from the random numbers +provided by all data providers along with their data submissions. +Note that the random number for the previous epoch keeps updating as new submissions are revealed. + +It never reverts. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Random number calculated from all data provider's submissions. | +
+
+ +
+ +### `getFtsoManager` { #fn_getftsomanager } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function getFtsoManager( +) external view returns ( + contract IFtsoManagerGenesis); +``` + +Returns the address of the [`FtsoManager`](./FtsoManager.md) contract. + +
+
+ +
+ +### `getFtsoRegistry` { #fn_getftsoregistry } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function getFtsoRegistry( +) external view returns ( + contract IFtsoRegistryGenesis); +``` + +Returns the address of the [`FtsoRegistry`](./FtsoRegistry.md) contract. + +
+
+ +
+ +### `getRandom` { #fn_getrandom } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function getRandom( + uint256 _epochId +) external view returns ( + uint256); +``` + +Returns the random number used in a specific past epoch, obtained from the random numbers +provided by all data providers along with their data submissions. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the queried epoch. Current epoch cannot be queried, and the previous epoch is constantly updated as data providers reveal their prices and random numbers. Note that only the last 50 epochs can be queried and there is no bounds checking for this parameter. Out-of-bounds queries return undefined values. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The random number used in that epoch. | +
+
+ +
+ +### `getTrustedAddresses` { #fn_gettrustedaddresses } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function getTrustedAddresses( +) external view returns ( + address[]); +``` + +Returns the list of trusted addresses that are always allowed to submit and reveal. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | address[] Array of trusted voter addresses. | +
+
+ +
+ +### `getVoterWhitelister` { #fn_getvoterwhitelister } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function getVoterWhitelister( +) external view returns ( + address); +``` + +Returns the address of the [`VoterWhitelister`](./VoterWhitelister.md) contract managing the data provider whitelist. + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `initialise` { #fn_initialise } + +
+Defined in `GovernedAtGenesis` ([Docs](./GovernedAtGenesis.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedAtGenesis.sol)). +
+ +
+ +```solidity +function initialise( + address _governance +) public pure; +``` + +Disallow [`initialise`](#fn_initialise) to be called. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | The governance address for initial claiming. | + +
+
+ +
+ +### `revealPrices` { #fn_revealprices } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function revealPrices( + uint256 _epochId, + uint256[] _ftsoIndices, + uint256[] _prices, + uint256 _random +) external; +``` + +Reveals submitted prices during the epoch reveal period. +The hash of FTSO indices, prices, random number, and voter address must be equal +to the hash previously submitted with [`submitHash`](#fn_submithash). +Emits a [`PricesRevealed`](#ev_pricesrevealed) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the epoch to which the price hashes are submitted. | +| `_ftsoIndices` | `uint256[]` | List of FTSO indices in ascending order. | +| `_prices` | `uint256[]` | List of submitted prices in USD. | +| `_random` | `uint256` | Submitted random number. | + +
+
+ +
+ +### `setAddressUpdater` { #fn_setaddressupdater } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function setAddressUpdater( + address _addressUpdater +) external; +``` + +Sets the address updater contract. +Only [`governance`](#fn_governance) cal call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_addressUpdater` | `address` | Address of the [`AddressUpdater`](./AddressUpdater.md) contract. | + +
+
+ +
+ +### `setTrustedAddresses` { #fn_settrustedaddresses } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function setTrustedAddresses( + address[] _trustedAddresses +) external; +``` + +Set the trusted addresses that are always allowed to submit and reveal. +Trusted addresses are used, for example, in fallback mode. +Only FTSO Manager can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_trustedAddresses` | `address[]` | Array of FTSO data provider addresses (voters). The previous list of trusted addresses is discarded. | + +
+
+ +
+ +### `submitHash` { #fn_submithash } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function submitHash( + uint256 _epochId, + bytes32 _hash +) external; +``` + +Submits a hash for the current epoch. Can only be called by FTSO data providers +whitelisted through the `VoterWhitelisted` contract. +Emits the [`HashSubmitted`](#ev_hashsubmitted) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_epochId` | `uint256` | ID of the target epoch to which the hash is submitted. | +| `_hash` | `bytes32` | A hash of the FTSO indices, prices, random number, and voter address. | + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +### `voterWhitelistBitmap` { #fn_voterwhitelistbitmap } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function voterWhitelistBitmap( + address _voter +) external view returns ( + uint256); +``` + +Returns a bitmap of all FTSOs for which a data provider is allowed to submit prices or hashes. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | If a data provider is allowed to vote for a given FTSO index, the corresponding bit in the result is 1. | +
+
+ +
+ +### `voterWhitelisted` { #fn_voterwhitelisted } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function voterWhitelisted( + address _voter, + uint256 _ftsoIndex +) external; +``` + +Called from the [`VoterWhitelister`](./VoterWhitelister.md) contract when a new voter has been whitelisted. + +Only the [`VoterWhitelister`](./VoterWhitelister.md) contract can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Voter address that has been added to the whitelist. | +| `_ftsoIndex` | `uint256` | Index of the FTSO to which the voter has registered. Each FTSO has its own whitelist. | + +
+
+ +
+ +### `votersRemovedFromWhitelist` { #fn_votersremovedfromwhitelist } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +function votersRemovedFromWhitelist( + address[] _removedVoters, + uint256 _ftsoIndex +) external; +``` + +Called from the [`VoterWhitelister`](./VoterWhitelister.md) contract when one or more voters have been removed. + +Only the [`VoterWhitelister`](./VoterWhitelister.md) contract can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_removedVoters` | `address[]` | | +| `_ftsoIndex` | `uint256` | Index of the FTSO to which the voters were registered. Each FTSO has its own whitelist. | + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +### `onlyFtsoManager` { #md_onlyftsomanager } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +modifier onlyFtsoManager() +``` + +Only the `ftsoManager` can call this method. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +### `onlyWhitelister` { #md_onlywhitelister } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity +modifier onlyWhitelister() +``` + +Only the `voterWhitelister` can call this method. + +
+
+ +
+ +
+ +## Variables + +
+ +### `MINIMAL_RANDOM` { #va_minimal_random } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity + uint256 MINIMAL_RANDOM +``` + +Minimal random value accepted along price submissions. +Submitted random values below this threshold will revert. + +
+
+ +
+ +### `RANDOM_EPOCH_CYCLIC_BUFFER_SIZE` { #va_random_epoch_cyclic_buffer_size } + +
+Defined in `PriceSubmitter` ([Docs](./PriceSubmitter.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/genesis/implementation/PriceSubmitter.sol)). +
+ +
+ +```solidity + uint256 RANDOM_EPOCH_CYCLIC_BUFFER_SIZE +``` + +Number of past random numbers remembered. + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/RevertErrorTracking.md b/docs/apis/smart-contracts/RevertErrorTracking.md new file mode 100644 index 000000000..548ae3d93 --- /dev/null +++ b/docs/apis/smart-contracts/RevertErrorTracking.md @@ -0,0 +1,206 @@ +--- +title: RevertErrorTracking +--- + + + +# `RevertErrorTracking` { #ct_reverterrortracking } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol) +
+ +
+ +Revert error tracking contract. + +A contract to track and store revert errors. + +
+ +
+ +## Events + +
+ +### `ContractRevertError` { #ev_contractreverterror } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +```solidity +event ContractRevertError( + address theContract, + uint256 atBlock, + string theMessage +) +``` + +Emitted when a contract reverts. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `theContract` | `address` | The culprit's address. | +| `atBlock` | `uint256` | Block number where the error happened. | +| `theMessage` | `string` | Reason for the revert, as reported by the contract. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `showLastRevertedError` { #fn_showlastrevertederror } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +```solidity +function showLastRevertedError( +) external view returns ( + uint256[] _lastErrorBlock, + uint256[] _numErrors, + string[] _errorString, + address[] _erroringContract, + uint256 _totalRevertedErrors); +``` + +Returns latest error information. All arrays will contain only one entry. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lastErrorBlock` | `uint256[]` | Array of block numbers where the errors occurred. | +| `_numErrors` | `uint256[]` | Array of number of times same error with same contract address has been reverted. | +| `_errorString` | `string[]` | Array of revert error messages. | +| `_erroringContract` | `address[]` | Array of addresses of the reverting contracts. | +| `_totalRevertedErrors` | `uint256` | Total number of revert errors across all contracts. | +
+
+ +
+ +### `showRevertedErrors` { #fn_showrevertederrors } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +```solidity +function showRevertedErrors( + uint256 startIndex, + uint256 numErrorTypesToShow +) public view returns ( + uint256[] _lastErrorBlock, + uint256[] _numErrors, + string[] _errorString, + address[] _erroringContract, + uint256 _totalRevertedErrors); +``` + +Returns latest errors. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `startIndex` | `uint256` | Starting index in the error list array. | +| `numErrorTypesToShow` | `uint256` | Number of errors to show. The total amount can be found in `errorData`. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_lastErrorBlock` | `uint256[]` | Array of block numbers where the errors occurred. | +| `_numErrors` | `uint256[]` | Array of number of times same error with same contract address has been reverted. | +| `_errorString` | `string[]` | Array of revert error messages. | +| `_erroringContract` | `address[]` | Array of addresses of the reverting contracts. | +| `_totalRevertedErrors` | `uint256` | Total number of revert errors across all contracts. | +
+
+ +
+ +
+ +## Structures + +
+ +### `LastErrorData` { #st_lasterrordata } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +
+```solidity +struct LastErrorData { + uint192 totalRevertedErrors; + uint64 lastErrorTypeIndex; +} +``` + +
+ +
+ +### `RevertedError` { #st_revertederror } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +
+```solidity +struct RevertedError { + uint192 lastErrorBlock; + uint64 numErrors; + address fromContract; + uint64 errorTypeIndex; + string errorMessage; +} +``` + +
+ +
+ +
+ +## Variables + +
+ +### `errorData` { #va_errordata } + +
+Defined in `RevertErrorTracking` ([Docs](./RevertErrorTracking.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/RevertErrorTracking.sol)). +
+ +
+ +```solidity + struct RevertErrorTracking.LastErrorData errorData +``` + +Most recent error information. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/VPContract.md b/docs/apis/smart-contracts/VPContract.md new file mode 100644 index 000000000..6ad701b90 --- /dev/null +++ b/docs/apis/smart-contracts/VPContract.md @@ -0,0 +1,1098 @@ +--- +title: VPContract +--- + + + +# `VPContract` { #ct_vpcontract } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol) | Inherits from [IIVPContract](./IIVPContract.md), [Delegatable](./Delegatable.md) +
+ +
+ +Helper contract handling all the vote power and delegation functionality for an associated [`VPToken`](./VPToken.md). + +
+ +
+ +## Functions + +
+ +### `batchVotePowerOfAt` { #fn_batchvotepowerofat } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function batchVotePowerOfAt( + address[] _owners, + uint256 _blockNumber +) external view returns ( + uint256[] _votePowers); +``` + +Get the vote power of a set of addresses at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owners` | `address[]` | The list of addresses being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_votePowers` | `uint256[]` | Vote power of each address at `_blockNumber`, including any delegation received. | +
+
+ +
+ +### `cleanupBlockNumber` { #fn_cleanupblocknumber } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function cleanupBlockNumber( +) external view returns ( + uint256); +``` + +Get the current cleanup block number set with [`setCleanupBlockNumber`](#fn_setcleanupblocknumber). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The currently set cleanup block number. | +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +constructor( + contract IVPToken _ownerToken, + bool _isReplacement +) public; +``` + +Construct [`VPContract`](./VPContract.md) for given [`VPToken`](./VPToken.md). + +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function delegate( + address _from, + address _to, + uint256 _balance, + uint256 _bips +) external; +``` + +[`Delegate`](#ev_delegate) `_bips` percentage of voting power from a delegator address to a delegatee address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_to` | `address` | The address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance | +| `_bips` | `uint256` | 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 a value of 0 revokes delegation). | + +
+
+ +
+ +### `delegateExplicit` { #fn_delegateexplicit } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function delegateExplicit( + address _from, + address _to, + uint256 _balance, + uint256 _amount +) external; +``` + +Explicitly [`delegate`](#fn_delegate) `_amount` tokens of voting power from a delegator address to a delegatee address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_to` | `address` | The address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance. | +| `_amount` | `uint256` | An explicit vote power amount to be delegated. Not cumulative: every call resets the delegation value (and a value of 0 undelegates `_to`). | + +
+
+ +
+ +### `delegatesOf` { #fn_delegatesof } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function delegatesOf( + address _owner +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the percentages and addresses being delegated to by a vote power delegator. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address of the delegator being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Array of delegatee addresses. | +| `_bips` | `uint256[]` | Array of delegation percents specified in basis points (1/100 or 1 percent), for each delegatee. | +| `_count` | `uint256` | The number of returned delegatees. | +| `_delegationMode` | `uint256` | The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See [`Delegatable`](./Delegatable.md).DelegationMode. | +
+
+ +
+ +### `delegatesOfAt` { #fn_delegatesofat } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function delegatesOfAt( + address _owner, + uint256 _blockNumber +) public view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the percentages and addresses being delegated to by a vote power delegator, +at a given block. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address of the delegator being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Array of delegatee addresses. | +| `_bips` | `uint256[]` | Array of delegation percents specified in basis points (1/100 or 1 percent), for each delegatee. | +| `_count` | `uint256` | The number of returned delegatees. | +| `_delegationMode` | `uint256` | The mode of the delegation (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See [`Delegatable`](./Delegatable.md).DelegationMode. | +
+
+ +
+ +### `delegationModeOf` { #fn_delegationmodeof } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function delegationModeOf( + address _who +) external view returns ( + uint256); +``` + +Get the delegation mode of an address. This mode determines whether vote power is +allocated by percentage or by explicit value and cannot be changed once set with +[`delegate`](#fn_delegate) or [`delegateExplicit`](#fn_delegateexplicit). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Delegation mode (NOTSET=0, PERCENTAGE=1, AMOUNT=2). See [`Delegatable`](./Delegatable.md).DelegationMode. | +
+
+ +
+ +### `explicitDelegationHistoryCleanup` { #fn_explicitdelegationhistorycleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function explicitDelegationHistoryCleanup( + address _from, + address _to, + uint256 _count +) external returns ( + uint256); +``` + +Delete explicit delegation checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Delegator address. | +| `_to` | `address` | Delegatee address. | +| `_count` | `uint256` | Maximum number of checkpoints to delete. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of checkpoints deleted. | +
+
+ +
+ +### `isReplacement` { #fn_isreplacement } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function isReplacement( +) external view returns ( + bool); +``` + +Return true if this [`IIVPContract`](./IIVPContract.md) 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. + +
+
+ +
+ +### `ownerToken` { #fn_ownertoken } + +
+Defined in `IIVPContract` ([Docs](./IIVPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/interface/IIVPContract.sol)). +
+ +
+ +```solidity +function ownerToken( +) external view returns ( + contract IVPToken); +``` + +The [`VPToken`](./VPToken.md) (or some other contract) that owns this [`VPContract`](./VPContract.md). +All state changing methods may be called only from this address. +This is because original `msg.sender` is typically sent in a parameter +and we must make sure that it cannot be faked by directly calling +[`IIVPContract`](./IIVPContract.md) methods. +Owner token is also used in case of replacement to recover vote powers from balances. + +
+
+ +
+ +### `percentageDelegationHistoryCleanup` { #fn_percentagedelegationhistorycleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function percentageDelegationHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete percentage delegation checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Balance owner account address. | +| `_count` | `uint256` | Maximum number of checkpoints to delete. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of deleted checkpoints. | +
+
+ +
+ +### `revocationCleanup` { #fn_revocationcleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function revocationCleanup( + address _from, + address _to, + uint256 _blockNumber +) external returns ( + uint256); +``` + +Delete revocation entry that expired (i.e. is before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Delegator address. | +| `_to` | `address` | Delegatee address. | +| `_blockNumber` | `uint256` | Block number for which total supply value was cached. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of revocation entries deleted (always 0 or 1). | +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _from, + address _to, + uint256 _balance, + uint256 _blockNumber +) external; +``` + +[`Revoke`](#ev_revoke) all vote power delegation from a delegator address to a delegatee address at a given block. +Only affects the reads via [`votePowerOfAtCached`](#fn_votepowerofatcached) in the block `_blockNumber`. +This method should be used only to prevent rogue [`delegate`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) or [`delegateExplicit`](#fn_delegateexplicit) with value of 0, +or [`undelegateAll`](#fn_undelegateall)/ [`undelegateAllExplicit`](#fn_undelegateallexplicit). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_to` | `address` | Address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance. | +| `_blockNumber` | `uint256` | The block number at which to revoke delegation. Must be in the past. | + +
+
+ +
+ +### `setCleanerContract` { #fn_setcleanercontract } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function setCleanerContract( + address _cleanerContract +) external; +``` + +Set the contract that is allowed to call history cleaning methods. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanerContract` | `address` | Address of the cleanup contract. Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). | + +
+
+ +
+ +### `setCleanupBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumber( + uint256 _blockNumber +) external; +``` + +Set the cleanup block number. +Historic data for the blocks before [`cleanupBlockNumber`](#fn_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. + +The method can be called only by the owner token. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The new cleanup block number. | + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function undelegateAll( + address _from, + uint256 _balance +) external; +``` + +Undelegate all voting power for a delegator address. +Can only be used with percentage delegation. +Does not reset delegation mode back to `NOTSET`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_balance` | `uint256` | The delegator's current balance. | + +
+
+ +
+ +### `undelegateAllExplicit` { #fn_undelegateallexplicit } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function undelegateAllExplicit( + address _from, + address[] _delegateAddresses +) external returns ( + uint256); +``` + +Undelegate all explicit vote power by amount for a delegator address. +Can only be used with explicit delegation. +Does not reset delegation mode back to `NOTSET`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | The address of the delegator. | +| `_delegateAddresses` | `address[]` | Explicit delegation does not store delegatees' addresses, so the caller must supply them. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The amount still delegated (in case the list of delegates was incomplete). | +
+
+ +
+ +### `undelegatedVotePowerOf` { #fn_undelegatedvotepowerof } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOf( + address _owner, + uint256 _balance +) external view returns ( + uint256); +``` + +Compute the current undelegated vote power of an address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address being queried. | +| `_balance` | `uint256` | Current balance of that address. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`, this is, the amount of vote power currently not being delegated to other addresses. | +
+
+ +
+ +### `undelegatedVotePowerOfAt` { #fn_undelegatedvotepowerofat } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOfAt( + address _owner, + uint256 _balance, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Compute the undelegated vote power of an address at a given block. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address being queried. | +| `_balance` | `uint256` | | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`, this is, the amount of vote power that was not being delegated to other addresses at that block number. | +
+
+ +
+ +### `updateAtTokenTransfer` { #fn_updateattokentransfer } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function updateAtTokenTransfer( + address _from, + address _to, + uint256 _fromBalance, + uint256 _toBalance, + uint256 _amount +) external; +``` + +Update vote powers when tokens are transferred. +Also update delegated vote powers for percentage delegation +and check for enough funds for explicit delegations. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Source account of the transfer. | +| `_to` | `address` | Destination account of the transfer. | +| `_fromBalance` | `uint256` | Balance of the source account before the transfer. | +| `_toBalance` | `uint256` | Balance of the destination account before the transfer. | +| `_amount` | `uint256` | Amount that has been transferred. | + +
+
+ +
+ +### `votePowerCacheCleanup` { #fn_votepowercachecleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function votePowerCacheCleanup( + address _owner, + uint256 _blockNumber +) external returns ( + uint256); +``` + +Delete vote power cache entry that expired (i.e. is before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Vote power owner account address. | +| `_blockNumber` | `uint256` | Block number for which total supply value was cached. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of deleted cache entries (always 0 or 1). | +
+
+ +
+ +### `votePowerFromTo` { #fn_votepowerfromto } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function votePowerFromTo( + address _from, + address _to, + uint256 _balance +) external view returns ( + uint256); +``` + +Get current delegated vote power from a delegator to a delegatee. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of the delegator. | +| `_to` | `address` | Address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The delegated vote power. | +
+
+ +
+ +### `votePowerFromToAt` { #fn_votepowerfromtoat } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function votePowerFromToAt( + address _from, + address _to, + uint256 _balance, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get delegated the vote power from a delegator to a delegatee at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of the delegator. | +| `_to` | `address` | Address of the delegatee. | +| `_balance` | `uint256` | The delegator's current balance. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The delegated vote power. | +
+
+ +
+ +### `votePowerHistoryCleanup` { #fn_votepowerhistorycleanup } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +function votePowerHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete vote power checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | Vote power owner account address. | +| `_count` | `uint256` | Maximum number of checkpoints to delete. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Number of deleted checkpoints. | +
+
+ +
+ +### `votePowerOf` { #fn_votepowerof } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function votePowerOf( + address _who +) external view returns ( + uint256); +``` + +Get the current vote power of an address. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Current vote power of `_who`, including any delegation received. | +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _who, + uint256 _blockNumber +) public view returns ( + uint256); +``` + +Get the vote power of an address at a given block number + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_who` at `_blockNumber`, including any delegation received. | +
+
+ +
+ +### `votePowerOfAtCached` { #fn_votepowerofatcached } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function votePowerOfAtCached( + address _who, + uint256 _blockNumber +) external returns ( + uint256); +``` + +Get the vote power of an address at a given block number. +Reads/updates cache and upholds revocations. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_who` at `_blockNumber`, including any delegation received. | +
+
+ +
+ +### `votePowerOfAtIgnoringRevocation` { #fn_votepowerofatignoringrevocation } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +function votePowerOfAtIgnoringRevocation( + address _who, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of an address at a given block number, ignoring revocation information and cache. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address being queried. | +| `_blockNumber` | `uint256` | The block number being queried. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_who` at `_blockNumber`, including any delegation received. Result doesn't change if vote power is revoked. | +
+
+ +
+ +
+ +## Modifiers + +
+ +### `notBeforeCleanupBlock` { #md_notbeforecleanupblock } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +modifier notBeforeCleanupBlock( uint256 _blockNumber) +``` + +Reading from history is not allowed before `cleanupBlockNumber`, since data before that +might have been deleted and is thus unreliable. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number being checked for validity. | + +
+
+ +
+ +### `onlyCleaner` { #md_onlycleaner } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity +modifier onlyCleaner() +``` + +History cleaning methods can be called only from [`cleanerContract`](#va_cleanercontract). + +
+
+ +
+ +### `onlyExplicit` { #md_onlyexplicit } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +modifier onlyExplicit( address sender) +``` + +If a [`delegate`](#fn_delegate) cannot be added by explicit amount, revert. + +
+
+ +
+ +### `onlyOwnerToken` { #md_onlyownertoken } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +modifier onlyOwnerToken() +``` + +All external methods in [`VPContract`](./VPContract.md) can only be executed by the owner token. + +
+
+ +
+ +### `onlyPercent` { #md_onlypercent } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity +modifier onlyPercent( address sender) +``` + +If a [`delegate`](#fn_delegate) cannot be added by percentage, revert. + +
+
+ +
+ +
+ +## Variables + +
+ +### `cleanerContract` { #va_cleanercontract } + +
+Defined in `Delegatable` ([Docs](./Delegatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/Delegatable.sol)). +
+ +
+ +```solidity + address cleanerContract +``` + +Address of the contract that is allowed to call methods for history cleaning. + +
+
+ +
+ +### `isReplacement` { #va_isreplacement } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity + bool isReplacement +``` + +Return true if this [`IIVPContract`](./IIVPContract.md) 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. + +
+
+ +
+ +### `ownerToken` { #va_ownertoken } + +
+Defined in `VPContract` ([Docs](./VPContract.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPContract.sol)). +
+ +
+ +```solidity + contract IVPToken ownerToken +``` + +The [`VPToken`](./VPToken.md) (or some other contract) that owns this [`VPContract`](./VPContract.md). +All state changing methods may be called only from this address. +This is because original `msg.sender` is typically sent in a parameter +and we must make sure that it cannot be faked by directly calling +[`IIVPContract`](./IIVPContract.md) methods. +Owner token is also used in case of replacement to recover vote powers from balances. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/VPToken.md b/docs/apis/smart-contracts/VPToken.md new file mode 100644 index 000000000..56c448c7e --- /dev/null +++ b/docs/apis/smart-contracts/VPToken.md @@ -0,0 +1,1837 @@ +--- +title: VPToken +--- + + + +# `VPToken` { #ct_vptoken } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol) | Inherits from [IIVPToken](./IIVPToken.md), ERC20, [CheckPointable](./CheckPointable.md), [Governed](./Governed.md) +
+ +
+ +Vote power token. + +An ERC20 token that enables the holder to [`delegate`](#fn_delegate) a voting power +equal to their balance, with history tracking by block height. +Actual vote power and delegation functionality is implemented in an associated [`VPContract`](./VPContract.md). + +
+ +
+ +## Events + +
+ +### `Approval` { #ev_approval } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +event Approval( + address owner, + address spender, + uint256 value +) +``` + +Emitted when the [`allowance`](#fn_allowance) of a `spender` for an `owner` is set by +a call to [`approve`](#fn_approve). `value` is the new [`allowance`](#fn_allowance). + +
+
+ +
+ +### `CreatedTotalSupplyCache` { #ev_createdtotalsupplycache } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +event CreatedTotalSupplyCache( + uint256 _blockNumber +) +``` + +Emitted when a total supply cache entry is created. +Allows history cleaners to track total supply cache cleanup opportunities off-chain. + +
+
+ +
+ +### `GovernanceCallTimelocked` { #ev_governancecalltimelocked } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceCallTimelocked( + bytes4 selector, + uint256 allowedAfterTimestamp, + bytes encodedCall +) +``` + +Emitted when a new [`governance`](#fn_governance) call has been recorded and is now waiting for the time lock to expire. + +
+
+ +
+ +### `GovernanceInitialised` { #ev_governanceinitialised } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceInitialised( + address initialGovernance +) +``` + +Emitted when the [`governance`](#fn_governance) address is initialized. +This address will be used until production mode is entered (see [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered)). +At that point the [`governance`](#fn_governance) address is taken from [`GovernanceSettings`](./GovernanceSettings.md). + +
+
+ +
+ +### `GovernedProductionModeEntered` { #ev_governedproductionmodeentered } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernedProductionModeEntered( + address governanceSettings +) +``` + +Emitted when [`governance`](#fn_governance) is enabled and the [`governance`](#fn_governance) address cannot be changed anymore +(only through a network fork). + +
+
+ +
+ +### `TimelockedGovernanceCallCanceled` { #ev_timelockedgovernancecallcanceled } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallCanceled( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is canceled before execution. + +
+
+ +
+ +### `TimelockedGovernanceCallExecuted` { #ev_timelockedgovernancecallexecuted } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallExecuted( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is executed. + +
+
+ +
+ +### `Transfer` { #ev_transfer } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +event Transfer( + address from, + address to, + uint256 value +) +``` + +Emitted when `value` tokens are moved from one account (`from`) to +another (`to`). + +Note that `value` may be zero. + +
+
+ +
+ +### `VotePowerContractChanged` { #ev_votepowercontractchanged } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +event VotePowerContractChanged( + uint256 _contractType, + address _oldContractAddress, + address _newContractAddress +) +``` + +Emitted when one of the vote power contracts is changed. + +It is used to track the history of [`VPToken`](./VPToken.md) -> [`VPContract`](./VPContract.md) / [`GovernanceVotePower`](./GovernanceVotePower.md) +associations (e.g. by external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_contractType` | `uint256` | 0 = Read [`VPContract`](./VPContract.md), 1 = Write [`VPContract`](./VPContract.md), 2 = Governance vote power. | +| `_oldContractAddress` | `address` | Contract address before change. | +| `_newContractAddress` | `address` | Contract address after change. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `allowance` { #fn_allowance } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function allowance( + address owner, + address spender +) external view returns ( + uint256); +``` + +Returns the remaining number of tokens that `spender` will be +allowed to spend on behalf of `owner` through [`transferFrom`](#fn_transferfrom). This is +zero by default. + +This value changes when [`approve`](#fn_approve) or [`transferFrom`](#fn_transferfrom) are called. + +
+
+ +
+ +### `approve` { #fn_approve } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function approve( + address spender, + uint256 amount +) external returns ( + bool); +``` + +Sets `amount` as the [`allowance`](#fn_allowance) of `spender` over the caller's tokens. + +Returns a boolean value indicating whether the operation succeeded. + +IMPORTANT: Beware that changing an [`allowance`](#fn_allowance) with this method brings the risk +that someone may use both the old and the new [`allowance`](#fn_allowance) by unfortunate +transaction ordering. One possible solution to mitigate this race +condition is to first reduce the spender's [`allowance`](#fn_allowance) to 0 and set the +desired value afterwards: +https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + +Emits an [`Approval`](#ev_approval) event. + +
+
+ +
+ +### `balanceHistoryCleanup` { #fn_balancehistorycleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function balanceHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete balance checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | balance owner account address | +| `_count` | `uint256` | maximum number of checkpoints to delete | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of checkpoints deleted | +
+
+ +
+ +### `balanceOf` { #fn_balanceof } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function balanceOf( + address account +) external view returns ( + uint256); +``` + +Returns the amount of tokens owned by `account`. + +
+
+ +
+ +### `balanceOfAt` { #fn_balanceofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function balanceOfAt( + address _owner, + uint256 _blockNumber +) public view returns ( + uint256); +``` + +Queries the token balance of `_owner` at a specific `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address from which the balance will be retrieved. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | | +
+
+ +
+ +### `batchDelegate` { #fn_batchdelegate } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function batchDelegate( + address[] _delegatees, + uint256[] _bips +) external; +``` + +Undelegate all percentage delegations from the sender and then [`delegate`](#fn_delegate) corresponding + `_bips` percentage of voting power from the sender to each member of the `_delegatees` array. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegatees` | `address[]` | The addresses of the new recipients. | +| `_bips` | `uint256[]` | The percentages of voting power to be delegated expressed in basis points (1/100 of one percent). The sum of all `_bips` values must be at most 10000 (100%). | + +
+
+ +
+ +### `batchVotePowerOfAt` { #fn_batchvotepowerofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function batchVotePowerOfAt( + address[] _owners, + uint256 _blockNumber +) external view returns ( + uint256[]); +``` + +Return the vote power for several addresses. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owners` | `address[]` | The list of addresses to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256[]` | Array of vote power for each queried address. | +
+
+ +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `cleanupBlockNumber` { #fn_cleanupblocknumber } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function cleanupBlockNumber( +) external view returns ( + uint256); +``` + +Get the current cleanup block number set with [`setCleanupBlockNumber`](#fn_setcleanupblocknumber). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The currently set cleanup block number. | +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + string _name, + string _symbol +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `ERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/ERC20.sol)). +
+ +
+ +```solidity +constructor( + string name_, + string symbol_ +) public; +``` + +Sets the values for [`name`](#fn_name) and [`symbol`](#fn_symbol), initializes [`decimals`](#fn_decimals) with +a default value of 18. + +To select a different value for [`decimals`](#fn_decimals), use _setupDecimals. + +All three of these values are immutable: they can only be set once during +construction. + +
+
+ +
+ +### `decimals` { #fn_decimals } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function decimals( +) public view returns ( + uint8); +``` + +Returns the number of [`decimals`](#fn_decimals) used to get its user representation. +For example, if [`decimals`](#fn_decimals) equals 2, a balance of 505 tokens should +be displayed to a user as 5.05 (505 / 102). + +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 +[`balanceOf`](#fn_balanceof) and [`transfer`](#fn_transfer). + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegate( + address _to, + uint256 _bips +) external; +``` + +Delegate voting power to account `_to` from `msg.sender`, by percentage. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_bips` | `uint256` | 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 a value of 0 revokes all previous delegations). | + +
+
+ +
+ +### `delegateExplicit` { #fn_delegateexplicit } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegateExplicit( + address _to, + uint256 _amount +) external; +``` + +Explicitly [`delegate`](#fn_delegate) `_amount` voting power to account `_to` from `msg.sender`. +Compare with [`delegate`](#fn_delegate) which delegates by percentage. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_amount` | `uint256` | An explicit vote power amount to be delegated. Not cumulative: every call resets the delegation value (and a value of 0 revokes all previous delegations). | + +
+
+ +
+ +### `delegatesOf` { #fn_delegatesof } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegatesOf( + address _owner +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the list of addresses to which `_who` is delegating, and their percentages. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Positional array of addresses being delegated to. | +| `_bips` | `uint256[]` | Positional array of delegation percents specified in basis points (1/100 of 1 percent). Each one matches the address in the same position in the `_delegateAddresses` array. | +| `_count` | `uint256` | The number of delegates. | +| `_delegationMode` | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `delegatesOfAt` { #fn_delegatesofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegatesOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the list of addresses to which `_who` is delegating, and their percentages, at the given block. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Positional array of addresses being delegated to. | +| `_bips` | `uint256[]` | Positional array of delegation percents specified in basis points (1/100 of 1 percent). Each one matches the address in the same position in the `_delegateAddresses` array. | +| `_count` | `uint256` | The number of delegates. | +| `_delegationMode` | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `delegationModeOf` { #fn_delegationmodeof } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegationModeOf( + address _who +) external view returns ( + uint256); +``` + +Get the delegation mode for account '_who'. This mode determines whether vote power is +allocated by percentage or by explicit amount. Once the delegation mode is set, +it can never be changed, even if all delegations are removed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address to get delegation mode. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `governanceVotePower` { #fn_governancevotepower } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function governanceVotePower( +) external view returns ( + contract IGovernanceVotePower); +``` + +When set, allows token owners to participate in [`governance`](#fn_governance) voting +and [`delegate`](#fn_delegate) [`governance`](#fn_governance) vote power. + +
+
+ +
+ +### `name` { #fn_name } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function name( +) public view returns ( + string); +``` + +Returns the [`name`](#fn_name) of the token. + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `readVotePowerContract` { #fn_readvotepowercontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function readVotePowerContract( +) external view returns ( + contract IVPContractEvents); +``` + +Returns [`VPContract`](./VPContract.md) event interface used for read-only operations (view methods). +The only non-view method that might be called on it is [`revokeDelegationAt`](#fn_revokedelegationat). + +[`readVotePowerContract`](#fn_readvotepowercontract) is almost always equal to [`writeVotePowerContract`](#fn_writevotepowercontract) +except during an upgrade from one [`VPContract`](./VPContract.md) to a new version (which should happen +rarely or never and will be announced beforehand). + +Do not call any methods on [`VPContract`](./VPContract.md) directly. +State changing methods are forbidden from direct calls. +All methods are exposed via [`VPToken`](./VPToken.md). +This is the reason that this method returns [`IVPContractEvents`](./IVPContractEvents.md). +Use it only for listening to events and revoking. + +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _who, + uint256 _blockNumber +) public; +``` + +Revoke all delegation from sender to `_who` at given block. +Only affects the reads via [`votePowerOfAtCached`](#fn_votepowerofatcached) in the block `_blockNumber`. +Block `_blockNumber` must be in the past. +This method should be used only to prevent rogue [`delegate`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) / [`delegateExplicit`](#fn_delegateexplicit) with value of 0 or [`undelegateAll`](#fn_undelegateall) / [`undelegateAllExplicit`](#fn_undelegateallexplicit). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | Address of the delegatee. | +| `_blockNumber` | `uint256` | The block number at which to revoke delegation.. | + +
+
+ +
+ +### `setCleanerContract` { #fn_setcleanercontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setCleanerContract( + address _cleanerContract +) external; +``` + +Set the contract that is allowed to call history cleaning methods. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanerContract` | `address` | Address of the cleanup contract. Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). | + +
+
+ +
+ +### `setCleanupBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumber( + uint256 _blockNumber +) external; +``` + +Set the cleanup block number. +Historic data for the blocks before [`cleanupBlockNumber`](#fn_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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The new cleanup block number. | + +
+
+ +
+ +### `setCleanupBlockNumberManager` { #fn_setcleanupblocknumbermanager } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumberManager( + address _cleanupBlockNumberManager +) external; +``` + +Set the contract that is allowed to set [`cleanupBlockNumber`](#fn_cleanupblocknumber). +Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). + +
+
+ +
+ +### `setGovernanceVotePower` { #fn_setgovernancevotepower } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setGovernanceVotePower( + contract IIGovernanceVotePower _governanceVotePower +) external; +``` + +Sets new [`governance`](#fn_governance) vote power contract that allows token owners to participate in [`governance`](#fn_governance) voting +and [`delegate`](#fn_delegate) [`governance`](#fn_governance) vote power. + +
+
+ +
+ +### `setReadVpContract` { #fn_setreadvpcontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setReadVpContract( + contract IIVPContract _vpContract +) external; +``` + +Call from [`governance`](#fn_governance) to set read VpContract on token, e.g. +vpToken.[`setReadVpContract`](#fn_setreadvpcontract)(new [`VPContract`](./VPContract.md)(vpToken)). + +Read [`VPContract`](./VPContract.md) must be set before any of the [`VPToken`](./VPToken.md) delegation or vote power reading methods are called, +otherwise they will revert. + +**NOTE**: If `readVpContract` differs from `writeVpContract` all reads will be "frozen" and will not reflect +changes (not even revokes; they may or may not reflect balance transfers). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_vpContract` | `contract IIVPContract` | Read vote power contract to be used by this token. | + +
+
+ +
+ +### `setWriteVpContract` { #fn_setwritevpcontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setWriteVpContract( + contract IIVPContract _vpContract +) external; +``` + +Call from [`governance`](#fn_governance) to set write VpContract on token, e.g. +vpToken.[`setWriteVpContract`](#fn_setwritevpcontract)(new [`VPContract`](./VPContract.md)(vpToken)). + +Write [`VPContract`](./VPContract.md) must be set before any of the [`VPToken`](./VPToken.md) delegation modifying methods are called, +otherwise they will revert. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_vpContract` | `contract IIVPContract` | Write vote power contract to be used by this token. | + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `symbol` { #fn_symbol } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function symbol( +) public view returns ( + string); +``` + +Returns the [`symbol`](#fn_symbol) of the token, usually a shorter version of the [`name`](#fn_name). + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `totalSupply` { #fn_totalsupply } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function totalSupply( +) external view returns ( + uint256); +``` + +Returns the amount of tokens in existence. + +
+
+ +
+ +### `totalSupplyAt` { #fn_totalsupplyat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function totalSupplyAt( + uint256 _blockNumber +) public view returns ( + uint256); +``` + +Total amount of tokens at a specific `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number when the _totalSupply is queried | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | | +
+
+ +
+ +### `totalSupplyCacheCleanup` { #fn_totalsupplycachecleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function totalSupplyCacheCleanup( + uint256 _blockNumber +) external returns ( + uint256); +``` + +Delete total supply cache entry that expired (i.e. is before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | the block number for which total supply value was cached | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of cache entries deleted (always 0 or 1) | +
+
+ +
+ +### `totalSupplyHistoryCleanup` { #fn_totalsupplyhistorycleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function totalSupplyHistoryCleanup( + uint256 _count +) external returns ( + uint256); +``` + +Delete total supply checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_count` | `uint256` | maximum number of checkpoints to delete | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of checkpoints deleted | +
+
+ +
+ +### `totalVotePower` { #fn_totalvotepower } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function totalVotePower( +) external view returns ( + uint256); +``` + +Get the current total vote power. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The current total vote power (sum of all accounts' vote power). | +
+
+ +
+ +### `totalVotePowerAt` { #fn_totalvotepowerat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function totalVotePowerAt( + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the total vote power at block `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total vote power at the queried block (sum of all accounts' vote powers). | +
+
+ +
+ +### `totalVotePowerAtCached` { #fn_totalvotepoweratcached } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function totalVotePowerAtCached( + uint256 _blockNumber +) public returns ( + uint256); +``` + +Get the total vote power at block `_blockNumber` using cache. + It tries to read the cached value and if it is not found, reads the actual value and stores it in the cache. + Can only be used if `_blockNumber` is in the past, otherwise reverts. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total vote power at the queried block (sum of all accounts' vote powers). | +
+
+ +
+ +### `transfer` { #fn_transfer } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function transfer( + address recipient, + uint256 amount +) external returns ( + bool); +``` + +Moves `amount` tokens from the caller's account to `recipient`. + +Returns a boolean value indicating whether the operation succeeded. + +Emits a [`Transfer`](#ev_transfer) event. + +
+
+ +
+ +### `transferFrom` { #fn_transferfrom } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function transferFrom( + address sender, + address recipient, + uint256 amount +) external returns ( + bool); +``` + +Moves `amount` tokens from `sender` to `recipient` using the +[`allowance`](#fn_allowance) mechanism. `amount` is then deducted from the caller's +[`allowance`](#fn_allowance). + +Returns a boolean value indicating whether the operation succeeded. + +Emits a [`Transfer`](#ev_transfer) event. + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function undelegateAll( +) external; +``` + +Undelegate all voting power of `msg.sender`. This effectively revokes all previous delegations. +Can only be used with percentage delegation. +Does not reset delegation mode back to NOT SET. + +
+
+ +
+ +### `undelegateAllExplicit` { #fn_undelegateallexplicit } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function undelegateAllExplicit( + address[] _delegateAddresses +) external returns ( + uint256 _remainingDelegation); +``` + +Undelegate all explicit vote power by amount of `msg.sender`. +Can only be used with explicit delegation. +Does not reset delegation mode back to NOT SET. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Explicit delegation does not store delegatees' addresses, so the caller must supply them. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_remainingDelegation` | `uint256` | The amount still delegated (in case the list of delegates was incomplete). | +
+
+ +
+ +### `undelegatedVotePowerOf` { #fn_undelegatedvotepowerof } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOf( + address _owner +) external view returns ( + uint256); +``` + +Compute the current undelegated vote power of the `_owner` account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`. | +
+
+ +
+ +### `undelegatedVotePowerOfAt` { #fn_undelegatedvotepowerofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the undelegated vote power of the `_owner` account at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`. | +
+
+ +
+ +### `votePowerFromTo` { #fn_votepowerfromto } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerFromTo( + address _from, + address _to +) external view returns ( + uint256); +``` + +Get current delegated vote power from delegator `_from` to delegatee `_to`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of delegator. | +| `_to` | `address` | Address of delegatee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | votePower The delegated vote power. | +
+
+ +
+ +### `votePowerFromToAt` { #fn_votepowerfromtoat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerFromToAt( + address _from, + address _to, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get delegated vote power from delegator `_from` to delegatee `_to` at `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of delegator. | +| `_to` | `address` | Address of delegatee. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The delegated vote power. | +
+
+ +
+ +### `votePowerOf` { #fn_votepowerof } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerOf( + address _owner +) external view returns ( + uint256); +``` + +Get the current vote power of `_owner`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Current vote power of `_owner`. | +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at block number `_blockNumber`. | +
+
+ +
+ +### `votePowerOfAtCached` { #fn_votepowerofatcached } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAtCached( + address _owner, + uint256 _blockNumber +) public returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber` using cache. + It tries to read the cached value and if it is not found, reads the actual value and stores it in the cache. + Can only be used if `_blockNumber` is in the past, otherwise reverts. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at `_blockNumber`. | +
+
+ +
+ +### `votePowerOfAtIgnoringRevocation` { #fn_votepowerofatignoringrevocation } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAtIgnoringRevocation( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber`, ignoring revocation information (and cache). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at block number `_blockNumber`. Result doesn't change if vote power is revoked. | +
+
+ +
+ +### `writeVotePowerContract` { #fn_writevotepowercontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function writeVotePowerContract( +) external view returns ( + contract IVPContractEvents); +``` + +Returns [`VPContract`](./VPContract.md) event interface used for state-changing operations (non-view methods). +The only non-view method that might be called on it is [`revokeDelegationAt`](#fn_revokedelegationat). + +[`writeVotePowerContract`](#fn_writevotepowercontract) is almost always equal to [`readVotePowerContract`](#fn_readvotepowercontract), +except during upgrade from one [`VPContract`](./VPContract.md) to a new version (which should happen +rarely or never and will be announced beforehand). +In the case of an upgrade, [`writeVotePowerContract`](#fn_writevotepowercontract) is replaced first to establish delegations. +After some period (e.g., after a reward epoch ends), [`readVotePowerContract`](#fn_readvotepowercontract) is set equal to it. + +Do not call any methods on [`VPContract`](./VPContract.md) directly. +State changing methods are forbidden from direct calls. +All are exposed via [`VPToken`](./VPToken.md). +This is the reason that this method returns [`IVPContractEvents`](./IVPContractEvents.md) +Use it only for listening to events, delegating, and revoking. + +
+
+ +
+ +
+ +## Variables + +
+ +### `cleanerContract` { #va_cleanercontract } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity + address cleanerContract +``` + +Address of the contract that is allowed to call methods for history cleaning. + +
+
+ +
+ +### `cleanupBlockNumberManager` { #va_cleanupblocknumbermanager } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity + address cleanupBlockNumberManager +``` + +The contract that is allowed to set [`cleanupBlockNumber`](#fn_cleanupblocknumber). +Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ +### `vpContractInitialized` { #va_vpcontractinitialized } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity + bool vpContractInitialized +``` + +When true, the argument to [`setWriteVpContract`](#fn_setwritevpcontract) must be a vpContract +with `isReplacement` set to `true`. To be used for creating the correct [`VPContract`](./VPContract.md). + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/VoterWhitelister.md b/docs/apis/smart-contracts/VoterWhitelister.md new file mode 100644 index 000000000..8b60b420f --- /dev/null +++ b/docs/apis/smart-contracts/VoterWhitelister.md @@ -0,0 +1,975 @@ +--- +title: VoterWhitelister +--- + + + +# `VoterWhitelister` { #ct_voterwhitelister } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol) | Inherits from [IIVoterWhitelister](./IIVoterWhitelister.md), [Governed](./Governed.md), [AddressUpdatable](./AddressUpdatable.md) +
+ +
+ +Manager of the [FTSO whitelist](https://docs.flare.network/infra/data/whitelisting/). + +Only addresses registered in this contract can submit data to the FTSO system. + +
+ +
+ +## Functions + +
+ +### `addFtso` { #fn_addftso } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function addFtso( + uint256 _ftsoIndex +) external; +``` + +Create an empty whitelist with default size for a new FTSO. + +Only [`ftsoManager`](#va_ftsomanager) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the new FTSO. | + +
+
+ +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `chillVoter` { #fn_chillvoter } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function chillVoter( + address _voter, + uint256 _noOfRewardEpochs, + uint256[] _ftsoIndices +) external returns ( + bool[] _removed, + uint256 _untilRewardEpoch); +``` + +Used to chill a data provider, this is, remove it from the whitelist for a +specified number of reward epochs. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Data provider being chilled. | +| `_noOfRewardEpochs` | `uint256` | Number of epochs to chill the provider for. | +| `_ftsoIndices` | `uint256[]` | Array of indices of the FTSOs that will not allow this provider to submit data. | + +
+
+ +
+ +### `chilledUntilRewardEpoch` { #fn_chilleduntilrewardepoch } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function chilledUntilRewardEpoch( + address _voter +) external view returns ( + uint256); +``` + +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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the queried data provider. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 ID of the epoch where the data provider can start submitting prices again. | +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + address _addressUpdater, + contract IIPriceSubmitter _priceSubmitter, + uint256 _defaultMaxVotersForFtso, + contract IVoterWhitelister _oldVoterWhitelister +) public; +``` + +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `Governed` ([Docs](./Governed.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/Governed.sol)). +
+ +
+ +```solidity +constructor( + address _governance +) public; +``` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_governance` | `address` | Governance contract. Must not be zero. | + +
+
+ +
+ +### `copyWhitelist` { #fn_copywhitelist } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function copyWhitelist( + uint256 _ftsoIndex +) external; +``` + +Copy whitelist data from [`oldVoterWhitelister`](#va_oldvoterwhitelister) for a specific FTSO. +Can only be called by [`governance`](#fn_governance). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the FTSO whose whitelist is to be copied. | + +
+
+ +
+ +### `defaultMaxVotersForFtso` { #fn_defaultmaxvotersforftso } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function defaultMaxVotersForFtso( +) external view returns ( + uint256); +``` + +Maximum number of voters in the whitelist for a new FTSO. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Default maximum allowed voters. | +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `getAddressUpdater` { #fn_getaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function getAddressUpdater( +) public view returns ( + address _addressUpdater); +``` + +Returns the configured address updater. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_addressUpdater` | `address` | The `AddresUpdater` contract that can update our contract address list, as a response to a governance call. | +
+
+ +
+ +### `getFtsoWhitelistedPriceProviders` { #fn_getftsowhitelistedpriceproviders } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function getFtsoWhitelistedPriceProviders( + uint256 _ftsoIndex +) public view returns ( + address[]); +``` + +Gets whitelisted price providers for the FTSO at a given index. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Queried index. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the whitelisted data providers. | +
+
+ +
+ +### `getFtsoWhitelistedPriceProvidersBySymbol` { #fn_getftsowhitelistedpriceprovidersbysymbol } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function getFtsoWhitelistedPriceProvidersBySymbol( + string _symbol +) external view returns ( + address[]); +``` + +Gets whitelisted price providers for the FTSO with a specified symbol. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_symbol` | `string` | Queried symbol. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `address[]` | Array of addresses of the whitelisted data providers. | +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `maxVotersForFtso` { #fn_maxvotersforftso } + +
+Defined in `IVoterWhitelister` ([Docs](./IVoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/userInterfaces/IVoterWhitelister.sol)). +
+ +
+ +```solidity +function maxVotersForFtso( + uint256 _ftsoIndex +) external view returns ( + uint256); +``` + +Maximum number of voters in the whitelist for a specific FTSO. +Adjustable separately for each index. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the FTSO. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | uint256 Maximum allowed voters. | +
+
+ +
+ +### `removeFtso` { #fn_removeftso } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function removeFtso( + uint256 _ftsoIndex +) external; +``` + +Clear whitelist for a removed FTSO. + +Only [`ftsoManager`](#va_ftsomanager) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the removed FTSO. | + +
+
+ +
+ +### `removeTrustedAddressFromWhitelist` { #fn_removetrustedaddressfromwhitelist } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function removeTrustedAddressFromWhitelist( + address _trustedAddress, + uint256 _ftsoIndex +) external; +``` + +Remove a trusted address from whitelist. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_trustedAddress` | `address` | Address to remove. | +| `_ftsoIndex` | `uint256` | Index of the FTSO being modified. | + +
+
+ +
+ +### `requestFullVoterWhitelisting` { #fn_requestfullvoterwhitelisting } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function requestFullVoterWhitelisting( + address _voter +) external returns ( + uint256[] _supportedIndices, + bool[] _success); +``` + +Requests whitelisting an account to act as a data provider for all active FTSOs. +May be called by any address, including the voter itself. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter to be whitelisted. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_supportedIndices` | `uint256[]` | Array of currently supported FTSO indices. | +| `_success` | `bool[]` | Array of success flags by FTSO index. | +
+
+ +
+ +### `requestWhitelistingVoter` { #fn_requestwhitelistingvoter } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function requestWhitelistingVoter( + address _voter, + uint256 _ftsoIndex +) external; +``` + +Requests whitelisting an account to act as a data provider for a specific FTSO. +Reverts if the vote power of the account is too low. +May be called by any address, including the voter itself. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the voter to be whitelisted. | +| `_ftsoIndex` | `uint256` | Index of the FTSO. | + +
+
+ +
+ +### `setDefaultMaxVotersForFtso` { #fn_setdefaultmaxvotersforftso } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function setDefaultMaxVotersForFtso( + uint256 _defaultMaxVotersForFtso +) external; +``` + +Set the maximum number of voters in the whitelist for a new FTSOs. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_defaultMaxVotersForFtso` | `uint256` | New maximum default value. | + +
+
+ +
+ +### `setMaxVotersForFtso` { #fn_setmaxvotersforftso } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function setMaxVotersForFtso( + uint256 _ftsoIndex, + uint256 _newMaxVoters +) external; +``` + +Set the maximum number of voters in the whitelist for a specific FTSO. +Can remove voters with the least votepower from the whitelist. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_ftsoIndex` | `uint256` | Index of the FTSO to modify. | +| `_newMaxVoters` | `uint256` | New size of the whitelist. | + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `turnOffCopyMode` { #fn_turnoffcopymode } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +function turnOffCopyMode( +) external; +``` + +Turn off copy mode. +Can only be called by [`governance`](#fn_governance). + +
+
+ +
+ +### `updateContractAddresses` { #fn_updatecontractaddresses } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +function updateContractAddresses( + bytes32[] _contractNameHashes, + address[] _contractAddresses +) external; +``` + +External method called from [`AddressUpdater`](./AddressUpdater.md) only. + +
+
+ +
+ +
+ +## Modifiers + +
+ +### `notInCopyMode` { #md_notincopymode } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +modifier notInCopyMode() +``` + +Only callable when not in copy mode. + +
+
+ +
+ +### `onlyAddressUpdater` { #md_onlyaddressupdater } + +
+Defined in `AddressUpdatable` ([Docs](./AddressUpdatable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/addressUpdater/implementation/AddressUpdatable.sol)). +
+ +
+ +```solidity +modifier onlyAddressUpdater() +``` + +Only the `AdressUpdater` contract can call this method. +Its address is set at construction time but it can also update itself. + +
+
+ +
+ +### `onlyFtsoManager` { #md_onlyftsomanager } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +modifier onlyFtsoManager() +``` + +Only the [`ftsoManager`](#va_ftsomanager) can call this method. + +
+
+ +
+ +### `onlyGovernance` { #md_onlygovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyGovernance() +``` + +
+
+ +
+ +### `onlyImmediateGovernance` { #md_onlyimmediategovernance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +modifier onlyImmediateGovernance() +``` + +
+
+ +
+ +### `voterNotChilled` { #md_voternotchilled } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity +modifier voterNotChilled( address _voter) +``` + +Only data providers that have not been chilled can perform this action. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_voter` | `address` | Address of the data provider performing the action. | + +
+
+ +
+ +
+ +## Variables + +
+ +### `chilledUntilRewardEpoch` { #va_chilleduntilrewardepoch } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity + mapping(address => uint256) chilledUntilRewardEpoch +``` + +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. + +
+
+ +
+ +### `copyMode` { #va_copymode } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity + bool copyMode +``` + +
+
+ +
+ +### `defaultMaxVotersForFtso` { #va_defaultmaxvotersforftso } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity + uint256 defaultMaxVotersForFtso +``` + +Maximum number of voters in the whitelist for a new FTSO. + +
+
+ +
+ +### `ftsoManager` { #va_ftsomanager } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity + contract IFtsoManager ftsoManager +``` + +Address of the [`FtsoManager`](./FtsoManager.md) contract. + +
+
+ +
+ +### `ftsoRegistry` { #va_ftsoregistry } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity + contract IFtsoRegistry ftsoRegistry +``` + +Address of the [`FtsoRegistry`](./FtsoRegistry.md) contract. + +
+
+ +
+ +### `governanceSettings` { #va_governancesettings } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + contract IGovernanceSettings governanceSettings +``` + +Governance Settings. + +
+
+ +
+ +### `maxVotersForFtso` { #va_maxvotersforftso } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity + mapping(uint256 => uint256) maxVotersForFtso +``` + +Maximum number of voters in the whitelist for a specific FTSO. +Adjustable separately for each index. + +
+
+ +
+ +### `oldVoterWhitelister` { #va_oldvoterwhitelister } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity + contract IVoterWhitelister oldVoterWhitelister +``` + +Previous [`VoterWhitelister`](./VoterWhitelister.md) contract, set at construction time. +Necessary to allow copying the previous whitelist onto a new contract. + +
+
+ +
+ +### `priceSubmitter` { #va_pricesubmitter } + +
+Defined in `VoterWhitelister` ([Docs](./VoterWhitelister.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/utils/implementation/VoterWhitelister.sol)). +
+ +
+ +```solidity + contract IIPriceSubmitter priceSubmitter +``` + +Address of the [`PriceSubmitter`](./PriceSubmitter.md) contract set at construction time. + +
+
+ +
+ +### `productionMode` { #va_productionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + bool productionMode +``` + +When true, [`governance`](#fn_governance) is enabled and cannot be disabled. See [`switchToProductionMode`](#fn_switchtoproductionmode). + +
+
+ +
+ +### `timelockedCalls` { #va_timelockedcalls } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity + mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls +``` + +List of pending timelocked [`governance`](#fn_governance) calls. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/WNat.md b/docs/apis/smart-contracts/WNat.md new file mode 100644 index 000000000..4eb6fc9e0 --- /dev/null +++ b/docs/apis/smart-contracts/WNat.md @@ -0,0 +1,1871 @@ +--- +title: WNat +--- + + + +# `WNat` { #ct_wnat } + +
+[Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol) | Inherits from [VPToken](./VPToken.md), [IWNat](./IWNat.md) +
+ +
+ +Wrapped native token. + +This contract converts native tokens into `WNAT` (wrapped native) tokens and vice versa. +`WNAT` tokens are a one-to-one [ERC20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) +representation of native tokens, which are minted and burned as needed by this contract. + +The wrapped versions of the native `FLR` and `SGB` tokens are called `WFLR` and `WSGB` respectively. + +Besides the standard ERC20 operations, this contract supports +[FTSO delegation](https://docs.flare.network/tech/ftso/#delegation) and +[governance vote delegation](https://docs.flare.network/tech/governance/#vote-transfer). + +Code attribution: WETH9. + +
+ +
+ +## Events + +
+ +### `Approval` { #ev_approval } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +event Approval( + address owner, + address spender, + uint256 value +) +``` + +Emitted when the [`allowance`](#fn_allowance) of a `spender` for an `owner` is set by +a call to [`approve`](#fn_approve). `value` is the new [`allowance`](#fn_allowance). + +
+
+ +
+ +### `CreatedTotalSupplyCache` { #ev_createdtotalsupplycache } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +event CreatedTotalSupplyCache( + uint256 _blockNumber +) +``` + +Emitted when a total supply cache entry is created. +Allows history cleaners to track total supply cache cleanup opportunities off-chain. + +
+
+ +
+ +### `Deposit` { #ev_deposit } + +
+Defined in `WNat` ([Docs](./WNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol)). +
+ +
+ +```solidity +event Deposit( + address dst, + uint256 amount +) +``` + +Emitted when tokens have been wrapped. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `dst` | `address` | The account that received the wrapped tokens. | +| `amount` | `uint256` | The amount that was wrapped. | + +
+
+ +
+ +### `GovernanceCallTimelocked` { #ev_governancecalltimelocked } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceCallTimelocked( + bytes4 selector, + uint256 allowedAfterTimestamp, + bytes encodedCall +) +``` + +Emitted when a new [`governance`](#fn_governance) call has been recorded and is now waiting for the time lock to expire. + +
+
+ +
+ +### `GovernanceInitialised` { #ev_governanceinitialised } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernanceInitialised( + address initialGovernance +) +``` + +Emitted when the [`governance`](#fn_governance) address is initialized. +This address will be used until production mode is entered (see [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered)). +At that point the [`governance`](#fn_governance) address is taken from [`GovernanceSettings`](./GovernanceSettings.md). + +
+
+ +
+ +### `GovernedProductionModeEntered` { #ev_governedproductionmodeentered } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event GovernedProductionModeEntered( + address governanceSettings +) +``` + +Emitted when [`governance`](#fn_governance) is enabled and the [`governance`](#fn_governance) address cannot be changed anymore +(only through a network fork). + +
+
+ +
+ +### `TimelockedGovernanceCallCanceled` { #ev_timelockedgovernancecallcanceled } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallCanceled( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is canceled before execution. + +
+
+ +
+ +### `TimelockedGovernanceCallExecuted` { #ev_timelockedgovernancecallexecuted } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +event TimelockedGovernanceCallExecuted( + bytes4 selector, + uint256 timestamp +) +``` + +Emitted when a timelocked [`governance`](#fn_governance) call is executed. + +
+
+ +
+ +### `Transfer` { #ev_transfer } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +event Transfer( + address from, + address to, + uint256 value +) +``` + +Emitted when `value` tokens are moved from one account (`from`) to +another (`to`). + +Note that `value` may be zero. + +
+
+ +
+ +### `VotePowerContractChanged` { #ev_votepowercontractchanged } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +event VotePowerContractChanged( + uint256 _contractType, + address _oldContractAddress, + address _newContractAddress +) +``` + +Emitted when one of the vote power contracts is changed. + +It is used to track the history of [`VPToken`](./VPToken.md) -> [`VPContract`](./VPContract.md) / [`GovernanceVotePower`](./GovernanceVotePower.md) +associations (e.g. by external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_contractType` | `uint256` | 0 = Read [`VPContract`](./VPContract.md), 1 = Write [`VPContract`](./VPContract.md), 2 = Governance vote power. | +| `_oldContractAddress` | `address` | Contract address before change. | +| `_newContractAddress` | `address` | Contract address after change. | + +
+
+ +
+ +### `Withdrawal` { #ev_withdrawal } + +
+Defined in `WNat` ([Docs](./WNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol)). +
+ +
+ +```solidity +event Withdrawal( + address src, + uint256 amount +) +``` + +Emitted when tokens have been unwrapped. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `src` | `address` | The account that received the unwrapped tokens. | +| `amount` | `uint256` | The amount that was unwrapped. | + +
+
+ +
+ +
+ +## Functions + +
+ +### `allowance` { #fn_allowance } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function allowance( + address owner, + address spender +) external view returns ( + uint256); +``` + +Returns the remaining number of tokens that `spender` will be +allowed to spend on behalf of `owner` through [`transferFrom`](#fn_transferfrom). This is +zero by default. + +This value changes when [`approve`](#fn_approve) or [`transferFrom`](#fn_transferfrom) are called. + +
+
+ +
+ +### `approve` { #fn_approve } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function approve( + address spender, + uint256 amount +) external returns ( + bool); +``` + +Sets `amount` as the [`allowance`](#fn_allowance) of `spender` over the caller's tokens. + +Returns a boolean value indicating whether the operation succeeded. + +IMPORTANT: Beware that changing an [`allowance`](#fn_allowance) with this method brings the risk +that someone may use both the old and the new [`allowance`](#fn_allowance) by unfortunate +transaction ordering. One possible solution to mitigate this race +condition is to first reduce the spender's [`allowance`](#fn_allowance) to 0 and set the +desired value afterwards: +https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + +Emits an [`Approval`](#ev_approval) event. + +
+
+ +
+ +### `balanceHistoryCleanup` { #fn_balancehistorycleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function balanceHistoryCleanup( + address _owner, + uint256 _count +) external returns ( + uint256); +``` + +Delete balance checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | balance owner account address | +| `_count` | `uint256` | maximum number of checkpoints to delete | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of checkpoints deleted | +
+
+ +
+ +### `balanceOf` { #fn_balanceof } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function balanceOf( + address account +) external view returns ( + uint256); +``` + +Returns the amount of tokens owned by `account`. + +
+
+ +
+ +### `balanceOfAt` { #fn_balanceofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function balanceOfAt( + address _owner, + uint256 _blockNumber +) public view returns ( + uint256); +``` + +Queries the token balance of `_owner` at a specific `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address from which the balance will be retrieved. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | | +
+
+ +
+ +### `batchDelegate` { #fn_batchdelegate } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function batchDelegate( + address[] _delegatees, + uint256[] _bips +) external; +``` + +Undelegate all percentage delegations from the sender and then [`delegate`](#fn_delegate) corresponding + `_bips` percentage of voting power from the sender to each member of the `_delegatees` array. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegatees` | `address[]` | The addresses of the new recipients. | +| `_bips` | `uint256[]` | The percentages of voting power to be delegated expressed in basis points (1/100 of one percent). The sum of all `_bips` values must be at most 10000 (100%). | + +
+
+ +
+ +### `batchVotePowerOfAt` { #fn_batchvotepowerofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function batchVotePowerOfAt( + address[] _owners, + uint256 _blockNumber +) external view returns ( + uint256[]); +``` + +Return the vote power for several addresses. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owners` | `address[]` | The list of addresses to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256[]` | Array of vote power for each queried address. | +
+
+ +
+ +### `cancelGovernanceCall` { #fn_cancelgovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function cancelGovernanceCall( + bytes4 _selector +) external; +``` + +Cancel a timelocked [`governance`](#fn_governance) call before it has been executed. + +Only [`governance`](#fn_governance) can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector. | + +
+
+ +
+ +### `cleanupBlockNumber` { #fn_cleanupblocknumber } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function cleanupBlockNumber( +) external view returns ( + uint256); +``` + +Get the current cleanup block number set with [`setCleanupBlockNumber`](#fn_setcleanupblocknumber). + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The currently set cleanup block number. | +
+
+ +
+ +### `constructor` { #fn_constructor } + +
+Defined in `WNat` ([Docs](./WNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol)). +
+ +
+ +```solidity +constructor( + address _governance, + string _name, + string _symbol +) public; +``` + +Construct an ERC20 token. + +
+
+ +
+ +### `decimals` { #fn_decimals } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function decimals( +) public view returns ( + uint8); +``` + +Returns the number of [`decimals`](#fn_decimals) used to get its user representation. +For example, if [`decimals`](#fn_decimals) equals 2, a balance of 505 tokens should +be displayed to a user as 5.05 (505 / 102). + +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 +[`balanceOf`](#fn_balanceof) and [`transfer`](#fn_transfer). + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `delegate` { #fn_delegate } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegate( + address _to, + uint256 _bips +) external; +``` + +Delegate voting power to account `_to` from `msg.sender`, by percentage. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_bips` | `uint256` | 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 a value of 0 revokes all previous delegations). | + +
+
+ +
+ +### `delegateExplicit` { #fn_delegateexplicit } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegateExplicit( + address _to, + uint256 _amount +) external; +``` + +Explicitly [`delegate`](#fn_delegate) `_amount` voting power to account `_to` from `msg.sender`. +Compare with [`delegate`](#fn_delegate) which delegates by percentage. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_to` | `address` | The address of the recipient. | +| `_amount` | `uint256` | An explicit vote power amount to be delegated. Not cumulative: every call resets the delegation value (and a value of 0 revokes all previous delegations). | + +
+
+ +
+ +### `delegatesOf` { #fn_delegatesof } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegatesOf( + address _owner +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the list of addresses to which `_who` is delegating, and their percentages. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Positional array of addresses being delegated to. | +| `_bips` | `uint256[]` | Positional array of delegation percents specified in basis points (1/100 of 1 percent). Each one matches the address in the same position in the `_delegateAddresses` array. | +| `_count` | `uint256` | The number of delegates. | +| `_delegationMode` | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `delegatesOfAt` { #fn_delegatesofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegatesOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + address[] _delegateAddresses, + uint256[] _bips, + uint256 _count, + uint256 _delegationMode); +``` + +Get the list of addresses to which `_who` is delegating, and their percentages, at the given block. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Positional array of addresses being delegated to. | +| `_bips` | `uint256[]` | Positional array of delegation percents specified in basis points (1/100 of 1 percent). Each one matches the address in the same position in the `_delegateAddresses` array. | +| `_count` | `uint256` | The number of delegates. | +| `_delegationMode` | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `delegationModeOf` { #fn_delegationmodeof } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function delegationModeOf( + address _who +) external view returns ( + uint256); +``` + +Get the delegation mode for account '_who'. This mode determines whether vote power is +allocated by percentage or by explicit amount. Once the delegation mode is set, +it can never be changed, even if all delegations are removed. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | The address to get delegation mode. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Delegation mode: 0 = NOT SET, 1 = PERCENTAGE, 2 = AMOUNT (i.e. explicit). | +
+
+ +
+ +### `deposit` { #fn_deposit } + +
+Defined in `WNat` ([Docs](./WNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol)). +
+ +
+ +```solidity +function deposit( +) public payable; +``` + +Deposits native tokens and mints the same amount of `WNAT` tokens, +which are added to the `msg.sender`'s balance. +This operation is commonly known as "wrapping". + +Emits a [`Deposit`](#ev_deposit) event. + +
+
+ +
+ +### `depositTo` { #fn_depositto } + +
+Defined in `WNat` ([Docs](./WNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol)). +
+ +
+ +```solidity +function depositTo( + address _recipient +) external payable; +``` + +Deposits native tokens and mints the same amount of `WNAT` tokens, +which are added to `_recipient`'s balance. +This operation is commonly known as "wrapping". + +This is equivalent to using [`deposit`](#fn_deposit) followed by [`transfer`](#fn_transfer). + +Emits a [`Deposit`](#ev_deposit) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_recipient` | `address` | The address to receive the minted `WNAT`. | + +
+
+ +
+ +### `executeGovernanceCall` { #fn_executegovernancecall } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function executeGovernanceCall( + bytes4 _selector +) external; +``` + +Execute the timelocked [`governance`](#fn_governance) calls once the timelock period expires. + +Only executor can call this method. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_selector` | `bytes4` | The method selector (only one timelocked call per method is stored). | + +
+
+ +
+ +### `governance` { #fn_governance } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function governance( +) public view returns ( + address); +``` + +Returns the current effective [`governance`](#fn_governance) address. + +
+
+ +
+ +### `governanceVotePower` { #fn_governancevotepower } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function governanceVotePower( +) external view returns ( + contract IGovernanceVotePower); +``` + +When set, allows token owners to participate in [`governance`](#fn_governance) voting +and [`delegate`](#fn_delegate) [`governance`](#fn_governance) vote power. + +
+
+ +
+ +### `name` { #fn_name } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function name( +) public view returns ( + string); +``` + +Returns the [`name`](#fn_name) of the token. + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `readVotePowerContract` { #fn_readvotepowercontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function readVotePowerContract( +) external view returns ( + contract IVPContractEvents); +``` + +Returns [`VPContract`](./VPContract.md) event interface used for read-only operations (view methods). +The only non-view method that might be called on it is [`revokeDelegationAt`](#fn_revokedelegationat). + +[`readVotePowerContract`](#fn_readvotepowercontract) is almost always equal to [`writeVotePowerContract`](#fn_writevotepowercontract) +except during an upgrade from one [`VPContract`](./VPContract.md) to a new version (which should happen +rarely or never and will be announced beforehand). + +Do not call any methods on [`VPContract`](./VPContract.md) directly. +State changing methods are forbidden from direct calls. +All methods are exposed via [`VPToken`](./VPToken.md). +This is the reason that this method returns [`IVPContractEvents`](./IVPContractEvents.md). +Use it only for listening to events and revoking. + +
+
+ +
+ +### `receive` { #fn_receive } + +
+Defined in `WNat` ([Docs](./WNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol)). +
+ +
+ +```solidity +receive( +) external payable; +``` + +A proxy for the [`deposit`](#fn_deposit) method. + +
+
+ +
+ +### `revokeDelegationAt` { #fn_revokedelegationat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function revokeDelegationAt( + address _who, + uint256 _blockNumber +) public; +``` + +Revoke all delegation from sender to `_who` at given block. +Only affects the reads via [`votePowerOfAtCached`](#fn_votepowerofatcached) in the block `_blockNumber`. +Block `_blockNumber` must be in the past. +This method should be used only to prevent rogue [`delegate`](#fn_delegate) voting in the current voting block. +To stop delegating use [`delegate`](#fn_delegate) / [`delegateExplicit`](#fn_delegateexplicit) with value of 0 or [`undelegateAll`](#fn_undelegateall) / [`undelegateAllExplicit`](#fn_undelegateallexplicit). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_who` | `address` | Address of the delegatee. | +| `_blockNumber` | `uint256` | The block number at which to revoke delegation.. | + +
+
+ +
+ +### `setCleanerContract` { #fn_setcleanercontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setCleanerContract( + address _cleanerContract +) external; +``` + +Set the contract that is allowed to call history cleaning methods. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_cleanerContract` | `address` | Address of the cleanup contract. Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). | + +
+
+ +
+ +### `setCleanupBlockNumber` { #fn_setcleanupblocknumber } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumber( + uint256 _blockNumber +) external; +``` + +Set the cleanup block number. +Historic data for the blocks before [`cleanupBlockNumber`](#fn_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. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The new cleanup block number. | + +
+
+ +
+ +### `setCleanupBlockNumberManager` { #fn_setcleanupblocknumbermanager } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setCleanupBlockNumberManager( + address _cleanupBlockNumberManager +) external; +``` + +Set the contract that is allowed to set [`cleanupBlockNumber`](#fn_cleanupblocknumber). +Usually this will be an instance of [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md). + +
+
+ +
+ +### `setGovernanceVotePower` { #fn_setgovernancevotepower } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setGovernanceVotePower( + contract IIGovernanceVotePower _governanceVotePower +) external; +``` + +Sets new [`governance`](#fn_governance) vote power contract that allows token owners to participate in [`governance`](#fn_governance) voting +and [`delegate`](#fn_delegate) [`governance`](#fn_governance) vote power. + +
+
+ +
+ +### `setReadVpContract` { #fn_setreadvpcontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setReadVpContract( + contract IIVPContract _vpContract +) external; +``` + +Call from [`governance`](#fn_governance) to set read VpContract on token, e.g. +vpToken.[`setReadVpContract`](#fn_setreadvpcontract)(new [`VPContract`](./VPContract.md)(vpToken)). + +Read [`VPContract`](./VPContract.md) must be set before any of the [`VPToken`](./VPToken.md) delegation or vote power reading methods are called, +otherwise they will revert. + +**NOTE**: If `readVpContract` differs from `writeVpContract` all reads will be "frozen" and will not reflect +changes (not even revokes; they may or may not reflect balance transfers). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_vpContract` | `contract IIVPContract` | Read vote power contract to be used by this token. | + +
+
+ +
+ +### `setWriteVpContract` { #fn_setwritevpcontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function setWriteVpContract( + contract IIVPContract _vpContract +) external; +``` + +Call from [`governance`](#fn_governance) to set write VpContract on token, e.g. +vpToken.[`setWriteVpContract`](#fn_setwritevpcontract)(new [`VPContract`](./VPContract.md)(vpToken)). + +Write [`VPContract`](./VPContract.md) must be set before any of the [`VPToken`](./VPToken.md) delegation modifying methods are called, +otherwise they will revert. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_vpContract` | `contract IIVPContract` | Write vote power contract to be used by this token. | + +
+
+ +
+ +### `switchToProductionMode` { #fn_switchtoproductionmode } + +
+Defined in `GovernedBase` ([Docs](./GovernedBase.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/governance/implementation/GovernedBase.sol)). +
+ +
+ +```solidity +function switchToProductionMode( +) external; +``` + +Enter the production mode after all the initial [`governance`](#fn_governance) settings have been set. +This enables timelocks and the [`governance`](#fn_governance) can be obtained afterward by calling +[`governanceSettings`](#va_governancesettings).getGovernanceAddress(). +Emits [`GovernedProductionModeEntered`](#ev_governedproductionmodeentered). + +
+
+ +
+ +### `symbol` { #fn_symbol } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function symbol( +) public view returns ( + string); +``` + +Returns the [`symbol`](#fn_symbol) of the token, usually a shorter version of the [`name`](#fn_name). + +Should be compatible with ERC20 method. + +
+
+ +
+ +### `totalSupply` { #fn_totalsupply } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function totalSupply( +) external view returns ( + uint256); +``` + +Returns the amount of tokens in existence. + +
+
+ +
+ +### `totalSupplyAt` { #fn_totalsupplyat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function totalSupplyAt( + uint256 _blockNumber +) public view returns ( + uint256); +``` + +Total amount of tokens at a specific `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number when the _totalSupply is queried | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | | +
+
+ +
+ +### `totalSupplyCacheCleanup` { #fn_totalsupplycachecleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function totalSupplyCacheCleanup( + uint256 _blockNumber +) external returns ( + uint256); +``` + +Delete total supply cache entry that expired (i.e. is before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | the block number for which total supply value was cached | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of cache entries deleted (always 0 or 1) | +
+
+ +
+ +### `totalSupplyHistoryCleanup` { #fn_totalsupplyhistorycleanup } + +
+Defined in `CheckPointable` ([Docs](./CheckPointable.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/CheckPointable.sol)). +
+ +
+ +```solidity +function totalSupplyHistoryCleanup( + uint256 _count +) external returns ( + uint256); +``` + +Delete total supply checkpoints that expired (i.e. are before `cleanupBlockNumber`). +Method can only be called from the [`cleanerContract`](#va_cleanercontract) (which may be a proxy to external cleaners). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_count` | `uint256` | maximum number of checkpoints to delete | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | the number of checkpoints deleted | +
+
+ +
+ +### `totalVotePower` { #fn_totalvotepower } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function totalVotePower( +) external view returns ( + uint256); +``` + +Get the current total vote power. + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The current total vote power (sum of all accounts' vote power). | +
+
+ +
+ +### `totalVotePowerAt` { #fn_totalvotepowerat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function totalVotePowerAt( + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the total vote power at block `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total vote power at the queried block (sum of all accounts' vote powers). | +
+
+ +
+ +### `totalVotePowerAtCached` { #fn_totalvotepoweratcached } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function totalVotePowerAtCached( + uint256 _blockNumber +) public returns ( + uint256); +``` + +Get the total vote power at block `_blockNumber` using cache. + It tries to read the cached value and if it is not found, reads the actual value and stores it in the cache. + Can only be used if `_blockNumber` is in the past, otherwise reverts. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The total vote power at the queried block (sum of all accounts' vote powers). | +
+
+ +
+ +### `transfer` { #fn_transfer } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function transfer( + address recipient, + uint256 amount +) external returns ( + bool); +``` + +Moves `amount` tokens from the caller's account to `recipient`. + +Returns a boolean value indicating whether the operation succeeded. + +Emits a [`Transfer`](#ev_transfer) event. + +
+
+ +
+ +### `transferFrom` { #fn_transferfrom } + +
+Defined in `IERC20` ([Source](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v3.4/contracts/token/ERC20/IERC20.sol)). +
+ +
+ +```solidity +function transferFrom( + address sender, + address recipient, + uint256 amount +) external returns ( + bool); +``` + +Moves `amount` tokens from `sender` to `recipient` using the +[`allowance`](#fn_allowance) mechanism. `amount` is then deducted from the caller's +[`allowance`](#fn_allowance). + +Returns a boolean value indicating whether the operation succeeded. + +Emits a [`Transfer`](#ev_transfer) event. + +
+
+ +
+ +### `undelegateAll` { #fn_undelegateall } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function undelegateAll( +) external; +``` + +Undelegate all voting power of `msg.sender`. This effectively revokes all previous delegations. +Can only be used with percentage delegation. +Does not reset delegation mode back to NOT SET. + +
+
+ +
+ +### `undelegateAllExplicit` { #fn_undelegateallexplicit } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function undelegateAllExplicit( + address[] _delegateAddresses +) external returns ( + uint256 _remainingDelegation); +``` + +Undelegate all explicit vote power by amount of `msg.sender`. +Can only be used with explicit delegation. +Does not reset delegation mode back to NOT SET. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_delegateAddresses` | `address[]` | Explicit delegation does not store delegatees' addresses, so the caller must supply them. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| `_remainingDelegation` | `uint256` | The amount still delegated (in case the list of delegates was incomplete). | +
+
+ +
+ +### `undelegatedVotePowerOf` { #fn_undelegatedvotepowerof } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOf( + address _owner +) external view returns ( + uint256); +``` + +Compute the current undelegated vote power of the `_owner` account. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`. | +
+
+ +
+ +### `undelegatedVotePowerOfAt` { #fn_undelegatedvotepowerofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function undelegatedVotePowerOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the undelegated vote power of the `_owner` account at a given block number. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The unallocated vote power of `_owner`. | +
+
+ +
+ +### `votePowerFromTo` { #fn_votepowerfromto } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerFromTo( + address _from, + address _to +) external view returns ( + uint256); +``` + +Get current delegated vote power from delegator `_from` to delegatee `_to`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of delegator. | +| `_to` | `address` | Address of delegatee. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | votePower The delegated vote power. | +
+
+ +
+ +### `votePowerFromToAt` { #fn_votepowerfromtoat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerFromToAt( + address _from, + address _to, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get delegated vote power from delegator `_from` to delegatee `_to` at `_blockNumber`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_from` | `address` | Address of delegator. | +| `_to` | `address` | Address of delegatee. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | The delegated vote power. | +
+
+ +
+ +### `votePowerOf` { #fn_votepowerof } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerOf( + address _owner +) external view returns ( + uint256); +``` + +Get the current vote power of `_owner`. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Current vote power of `_owner`. | +
+
+ +
+ +### `votePowerOfAt` { #fn_votepowerofat } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAt( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber` + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at block number `_blockNumber`. | +
+
+ +
+ +### `votePowerOfAtCached` { #fn_votepowerofatcached } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAtCached( + address _owner, + uint256 _blockNumber +) public returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber` using cache. + It tries to read the cached value and if it is not found, reads the actual value and stores it in the cache. + Can only be used if `_blockNumber` is in the past, otherwise reverts. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at `_blockNumber`. | +
+
+ +
+ +### `votePowerOfAtIgnoringRevocation` { #fn_votepowerofatignoringrevocation } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function votePowerOfAtIgnoringRevocation( + address _owner, + uint256 _blockNumber +) external view returns ( + uint256); +``` + +Get the vote power of `_owner` at block `_blockNumber`, ignoring revocation information (and cache). + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address to query. | +| `_blockNumber` | `uint256` | The block number to query. | + +| Returns | Type | Description | +| ------- | ---- | ----------- | +| [0] | `uint256` | Vote power of `_owner` at block number `_blockNumber`. Result doesn't change if vote power is revoked. | +
+
+ +
+ +### `withdraw` { #fn_withdraw } + +
+Defined in `WNat` ([Docs](./WNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol)). +
+ +
+ +```solidity +function withdraw( + uint256 _amount +) external; +``` + +Burns `_amount` of `WNAT` tokens from `msg.sender`'s `WNAT` balance and +transfers the same amount of native tokens to `msg.sender`. +This operation is commonly known as "unwrapping". + +Reverts if `_amount` is higher than `msg.sender`'s `WNAT` balance. + +Emits a [`Withdrawal`](#ev_withdrawal) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_amount` | `uint256` | The amount to withdraw. | + +
+
+ +
+ +### `withdrawFrom` { #fn_withdrawfrom } + +
+Defined in `WNat` ([Docs](./WNat.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/WNat.sol)). +
+ +
+ +```solidity +function withdrawFrom( + address _owner, + uint256 _amount +) external; +``` + +Burns `_amount` of `WNAT` tokens from `_owner`'s `WNAT` balance and +transfers the same amount of native tokens to `msg.sender`. +This operation is commonly known as "unwrapping". + +`msg.sender` must have been authorized to [`withdraw`](#fn_withdraw) from `_owner`'s account +through ERC-20's [`approve`](#fn_approve) mechanism. + +Reverts if `_amount` is higher than `_owners`'s `WNAT` balance or than +`msg.sender`'s [`allowance`](#fn_allowance) over `_owner`'s tokens. + +Emits a [`Withdrawal`](#ev_withdrawal) event. + +| Parameters | Type | Description | +| ---------- | ---- | ----------- | +| `_owner` | `address` | The address containing the tokens to withdraw. | +| `_amount` | `uint256` | The amount to withdraw. | + +
+
+ +
+ +### `writeVotePowerContract` { #fn_writevotepowercontract } + +
+Defined in `VPToken` ([Docs](./VPToken.md), [Source](https://gitlab.com/flarenetwork/flare-smart-contracts/-/tree/master/contracts/token/implementation/VPToken.sol)). +
+ +
+ +```solidity +function writeVotePowerContract( +) external view returns ( + contract IVPContractEvents); +``` + +Returns [`VPContract`](./VPContract.md) event interface used for state-changing operations (non-view methods). +The only non-view method that might be called on it is [`revokeDelegationAt`](#fn_revokedelegationat). + +[`writeVotePowerContract`](#fn_writevotepowercontract) is almost always equal to [`readVotePowerContract`](#fn_readvotepowercontract), +except during upgrade from one [`VPContract`](./VPContract.md) to a new version (which should happen +rarely or never and will be announced beforehand). +In the case of an upgrade, [`writeVotePowerContract`](#fn_writevotepowercontract) is replaced first to establish delegations. +After some period (e.g., after a reward epoch ends), [`readVotePowerContract`](#fn_readvotepowercontract) is set equal to it. + +Do not call any methods on [`VPContract`](./VPContract.md) directly. +State changing methods are forbidden from direct calls. +All are exposed via [`VPToken`](./VPToken.md). +This is the reason that this method returns [`IVPContractEvents`](./IVPContractEvents.md) +Use it only for listening to events, delegating, and revoking. + +
+
+ +
+ diff --git a/docs/apis/smart-contracts/index.md b/docs/apis/smart-contracts/index.md new file mode 100644 index 000000000..50e4b9aed --- /dev/null +++ b/docs/apis/smart-contracts/index.md @@ -0,0 +1,89 @@ +# Smart Contracts API + + + +List of Flare smart contracts. + +!!! warning "Work in progress" + + Only the following Flare protocols are fully documented: + + * [FTSO](../../tech/ftso.md) + +## Contracts + +| Name | Description | +| ---- | ----------- | +| [`AddressUpdatable`](./AddressUpdatable.md) | Abstract base class for contracts that depend on other contracts whose addresses can change. | +| [`AddressUpdater`](./AddressUpdater.md) | Keeps track of the current address for all unique and special platform contracts. | +| [`CheckPointable`](./CheckPointable.md) | Check-Pointable ERC20 Behavior. | +| [`ClaimSetupManager`](./ClaimSetupManager.md) | Manages automation of operations related to reward claiming. | +| [`CleanupBlockNumberManager`](./CleanupBlockNumberManager.md) | Token history cleanup manager. | +| [`CloneFactory`](./CloneFactory.md) | Simple clone contract factory. | +| [`Delegatable`](./Delegatable.md) | [`Delegatable`](./Delegatable.md) ERC20 behavior. | +| [`FlareContractRegistry`](./FlareContractRegistry.md) | The Flare contract registry. | +| [`FlareDaemon`](./FlareDaemon.md) | Flare Daemon contract. | +| [`Ftso`](./Ftso.md) | [Flare Time Series Oracle](https://docs.flare.network/tech/ftso) contract. | +| [`FtsoManager`](./FtsoManager.md) | FTSO Manager contract. | +| [`FtsoRegistry`](./FtsoRegistry.md) | Handles registration of assets to the [FTSO system](https://docs.flare.network/tech/ftso). | +| [`FtsoRewardManager`](./FtsoRewardManager.md) | Handles reward distribution and claiming related to the FTSO system. | +| [`GovernanceSettings`](./GovernanceSettings.md) | A special contract that holds the Flare governance address and its timelock. | +| [`GovernanceVotePower`](./GovernanceVotePower.md) | Contract managing governance vote power and its delegation. | +| [`Governed`](./Governed.md) | Defines behaviors for governed contracts that must have a governor set at construction-time. | +| [`GovernedAndFlareDaemonized`](./GovernedAndFlareDaemonized.md) | Base class for contracts that are governed and triggered from the [`FlareDaemon`](./FlareDaemon.md). | +| [`GovernedAtGenesis`](./GovernedAtGenesis.md) | Defines behaviors for governed contracts that have their governor set at genesis. | +| [`GovernedBase`](./GovernedBase.md) | Abstract base class that defines behaviors for governed contracts. | +| [`Inflation`](./Inflation.md) | Recognizes, authorizes, mints, and funds native tokens to Flare services that are rewardable through inflation. | +| [`PriceSubmitter`](./PriceSubmitter.md) | Receives prices from [FTSO data providers](https://docs.flare.network/tech/ftso). | +| [`RevertErrorTracking`](./RevertErrorTracking.md) | Revert error tracking contract. | +| [`VoterWhitelister`](./VoterWhitelister.md) | Manager of the [FTSO whitelist](https://docs.flare.network/infra/data/whitelisting/). | +| [`VPContract`](./VPContract.md) | Helper contract handling all the vote power and delegation functionality for an associated [`VPToken`](./VPToken.md). | +| [`VPToken`](./VPToken.md) | Vote power token. | +| [`WNat`](./WNat.md) | Wrapped native token. | + +## Interfaces + +| Name | Description | +| ---- | ----------- | +| [`IClaimSetupManager`](./IClaimSetupManager.md) | Public interface for the [`ClaimSetupManager`](./ClaimSetupManager.md) contract. | +| [`IFlareContractRegistry`](./IFlareContractRegistry.md) | Interface for the [`FlareContractRegistry`](./FlareContractRegistry.md). | +| [`IFlareDaemonize`](./IFlareDaemonize.md) | Interface for contracts that receive triggers from the [`FlareDaemon`](./FlareDaemon.md) contract. | +| [`IFtso`](./IFtso.md) | Interface for each of the FTSO contracts that handles an asset. | +| [`IFtsoGenesis`](./IFtsoGenesis.md) | Portion of the [`IFtso`](./IFtso.md) interface that is available to contracts deployed at genesis. | +| [`IFtsoManager`](./IFtsoManager.md) | Interface for the [`FtsoManager`](./FtsoManager.md) contract. | +| [`IFtsoManagerGenesis`](./IFtsoManagerGenesis.md) | Portion of the [`IFtsoManager`](./IFtsoManager.md) interface that is available to contracts deployed at genesis. | +| [`IFtsoRegistry`](./IFtsoRegistry.md) | Interface for the [`FtsoRegistry`](./FtsoRegistry.md) contract. | +| [`IFtsoRegistryGenesis`](./IFtsoRegistryGenesis.md) | Portion of the [`IFtsoRegistry`](./IFtsoRegistry.md) interface that is available to contracts deployed at genesis. | +| [`IFtsoRewardManager`](./IFtsoRewardManager.md) | Interface for the [`FtsoRewardManager`](./FtsoRewardManager.md) contract. | +| [`IGovernanceSettings`](./IGovernanceSettings.md) | Interface for the [`GovernanceSettings`](./GovernanceSettings.md) that hold the Flare governance address and its timelock. | +| [`IGovernanceVotePower`](./IGovernanceVotePower.md) | Interface for contracts delegating their governance vote power. | +| [`IInflationGenesis`](./IInflationGenesis.md) | Portion of the [`Inflation`](./Inflation.md) contract that is available to contracts deployed at genesis. | +| [`IPriceSubmitter`](./IPriceSubmitter.md) | Interface for the [`PriceSubmitter`](./PriceSubmitter.md) contract. | +| [`IVoterWhitelister`](./IVoterWhitelister.md) | Interface for managers of the [FTSO whitelist](https://docs.flare.network/infra/data/whitelisting/). | +| [`IVPContractEvents`](./IVPContractEvents.md) | Events interface for vote-power related operations. | +| [`IVPToken`](./IVPToken.md) | Vote power token interface. | +| [`IWNat`](./IWNat.md) | Wrapped native token interface. | + +## Internal Interfaces + +For platform development, not application. + +| Name | Description | +| ---- | ----------- | +| [`IIAddressUpdatable`](./IIAddressUpdatable.md) | Internal interface for contracts that depend on other contracts whose addresses can change. | +| [`IIAddressUpdater`](./IIAddressUpdater.md) | Internal interface for [`AddressUpdater`](./AddressUpdater.md). | +| [`IIClaimSetupManager`](./IIClaimSetupManager.md) | Internal interface for the [`ClaimSetupManager`](./ClaimSetupManager.md) contract. | +| [`IICleanable`](./IICleanable.md) | Internal interface for entities that can have their block history cleaned. | +| [`IIFtso`](./IIFtso.md) | Internal interface for each of the FTSO contracts that handles an asset. | +| [`IIFtsoManager`](./IIFtsoManager.md) | Internal interface for the [`FtsoManager`](./FtsoManager.md) contract. | +| [`IIFtsoRegistry`](./IIFtsoRegistry.md) | Internal interface for the [`FtsoRegistry`](./FtsoRegistry.md) contract. | +| [`IIFtsoRewardManager`](./IIFtsoRewardManager.md) | Internal interface for the [`FtsoRewardManager`](./FtsoRewardManager.md). | +| [`IIGovernanceVotePower`](./IIGovernanceVotePower.md) | Internal interface for contracts delegating their governance vote power. | +| [`IIInflationReceiver`](./IIInflationReceiver.md) | Internal interface for contracts that can receive inflation. | +| [`IIPriceSubmitter`](./IIPriceSubmitter.md) | Internal interface for the [`PriceSubmitter`](./PriceSubmitter.md) contract. | +| [`IITokenPool`](./IITokenPool.md) | Internal interface for token pools. | +| [`IIVoterWhitelister`](./IIVoterWhitelister.md) | Internal interface for managers of the [FTSO whitelist](https://docs.flare.network/infra/data/whitelisting/). | +| [`IIVPContract`](./IIVPContract.md) | Internal interface for helper contracts handling functionality for an associated [`VPToken`](./VPToken.md). | +| [`IIVPToken`](./IIVPToken.md) | Vote power token internal interface. | + + diff --git a/docs/assets/stylesheets/extra.css b/docs/assets/stylesheets/extra.css index b3b61725a..ed0e51e70 100644 --- a/docs/assets/stylesheets/extra.css +++ b/docs/assets/stylesheets/extra.css @@ -175,6 +175,35 @@ figure img.side-by-side { width: 49%; } +/* API reference guide */ +.api-node { + margin-top: 8px; + padding-left: 8px; + padding-right: 8px; + border: solid 1px var(--md-default-fg-color--lightest); +} +.api-node-type h2 { + border-top: solid 4px var(--md-default-fg-color--lighter); + padding-top: 20px +} +.api-node h3 { + font-size: x-large; + margin: 0; + padding-top: 10px; +} +.api-node-internal td:first-child { + white-space: nowrap; +} +.api-node-source p { + text-align: right; + font-size: smaller; + color: var(--md-default-fg-color--lighter); + margin: 0; +} +.api-node-source a { + color: var(--md-default-fg-color--lighter); +} + /* BETA tags * Use as: `BETA`{.beta} */ .md-typeset code.beta { diff --git a/mkdocs.yml b/mkdocs.yml index e2a325d87..f90752fdf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -242,4 +242,65 @@ nav: - dev/external-resources.md - dev/tools.md - APIs: - - apis/index.md \ No newline at end of file + - apis/index.md + - Smart Contracts API: + - apis/smart-contracts/index.md + - apis/smart-contracts/AddressUpdatable.md + - apis/smart-contracts/AddressUpdater.md + - apis/smart-contracts/CheckPointable.md + - apis/smart-contracts/ClaimSetupManager.md + - apis/smart-contracts/CleanupBlockNumberManager.md + - apis/smart-contracts/CloneFactory.md + - apis/smart-contracts/Delegatable.md + - apis/smart-contracts/FlareContractRegistry.md + - apis/smart-contracts/FlareDaemon.md + - apis/smart-contracts/Ftso.md + - apis/smart-contracts/FtsoManager.md + - apis/smart-contracts/FtsoRegistry.md + - apis/smart-contracts/FtsoRewardManager.md + - apis/smart-contracts/GovernanceSettings.md + - apis/smart-contracts/GovernanceVotePower.md + - apis/smart-contracts/Governed.md + - apis/smart-contracts/GovernedAndFlareDaemonized.md + - apis/smart-contracts/GovernedAtGenesis.md + - apis/smart-contracts/GovernedBase.md + - apis/smart-contracts/Inflation.md + - apis/smart-contracts/PriceSubmitter.md + - apis/smart-contracts/RevertErrorTracking.md + - apis/smart-contracts/VoterWhitelister.md + - apis/smart-contracts/VPContract.md + - apis/smart-contracts/VPToken.md + - apis/smart-contracts/WNat.md + - apis/smart-contracts/IClaimSetupManager.md + - apis/smart-contracts/IFlareContractRegistry.md + - apis/smart-contracts/IFlareDaemonize.md + - apis/smart-contracts/IFtso.md + - apis/smart-contracts/IFtsoGenesis.md + - apis/smart-contracts/IFtsoManager.md + - apis/smart-contracts/IFtsoManagerGenesis.md + - apis/smart-contracts/IFtsoRegistry.md + - apis/smart-contracts/IFtsoRegistryGenesis.md + - apis/smart-contracts/IFtsoRewardManager.md + - apis/smart-contracts/IGovernanceSettings.md + - apis/smart-contracts/IGovernanceVotePower.md + - apis/smart-contracts/IInflationGenesis.md + - apis/smart-contracts/IPriceSubmitter.md + - apis/smart-contracts/IVoterWhitelister.md + - apis/smart-contracts/IVPContractEvents.md + - apis/smart-contracts/IVPToken.md + - apis/smart-contracts/IWNat.md + - apis/smart-contracts/IIAddressUpdatable.md + - apis/smart-contracts/IIAddressUpdater.md + - apis/smart-contracts/IIClaimSetupManager.md + - apis/smart-contracts/IICleanable.md + - apis/smart-contracts/IIFtso.md + - apis/smart-contracts/IIFtsoManager.md + - apis/smart-contracts/IIFtsoRegistry.md + - apis/smart-contracts/IIFtsoRewardManager.md + - apis/smart-contracts/IIGovernanceVotePower.md + - apis/smart-contracts/IIInflationReceiver.md + - apis/smart-contracts/IIPriceSubmitter.md + - apis/smart-contracts/IITokenPool.md + - apis/smart-contracts/IIVoterWhitelister.md + - apis/smart-contracts/IIVPContract.md + - apis/smart-contracts/IIVPToken.md