ClaimSetupManager
#
Source | Inherits from IIClaimSetupManager, Governed, AddressUpdatable, CloneFactory, ReentrancyGuard
Manages automation of operations related to reward claiming.
Rewards include FTSO rewards and airdrops. Managed operations include Automatic Claiming and Personal Delegation Accounts.
Functions#
accountToDelegationAccount
#
function accountToDelegationAccount(
address _owner
) external view returns (
address);
Gets the PDA 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
#
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
.
Parameters | Type | Description |
---|---|---|
_owner |
address |
Returns | Type | Description |
---|---|---|
[0] | address[] |
Addresses of all set authorized recipients. |
batchDelegate
#
function batchDelegate(
address[] _delegatees,
uint256[] _bips
) external;
Undelegates all percentage delegations from the caller's
PDA and then delegate
to a list of accounts.
See 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
#
function cancelGovernanceCall(
bytes4 _selector
) external;
Cancel a timelocked governance
call before it has been executed.
Only governance
can call this method.
Parameters | Type | Description |
---|---|---|
_selector |
bytes4 |
The method selector. |
checkExecutorAndAllowedRecipient
#
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
#
function claimExecutors(
address _owner
) external view returns (
address[]);
Gets the addresses of executors authorized to claim for an account.
See setClaimExecutors
.
Parameters | Type | Description |
---|---|---|
_owner |
address |
The account to query. |
Returns | Type | Description |
---|---|---|
[0] | address[] |
Addresses of all set executors. |
constructor
#
constructor(
address _governance,
address _addressUpdater,
uint256 _feeValueUpdateOffset,
uint256 _minFeeValueWei,
uint256 _maxFeeValueWei,
uint256 _registerExecutorFeeValueWei
) public;
constructor
#
constructor(
address _governance
) public;
Parameters | Type | Description |
---|---|---|
_governance |
address |
Governance contract. Must not be zero. |
delegate
#
function delegate(
address _to,
uint256 _bips
) external;
Delegates a percentage of the caller's PDA'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
#
function delegateGovernance(
address _to
) external;
Delegates all the governance vote power of the caller's PDA to another account.
Parameters | Type | Description |
---|---|---|
_to |
address |
Address of the recipient of the delegation. |
disableDelegationAccount
#
function disableDelegationAccount(
) external;
Disables the 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
#
function enableDelegationAccount(
) external returns (
contract IDelegationAccount);
Enables (or creates) a 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
#
function executeGovernanceCall(
bytes4 _selector
) external;
Execute the timelocked 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
#
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
#
function getAutoClaimAddressesAndExecutorFee(
address _executor,
address[] _owners
) external view returns (
address[] _recipients,
uint256 _executorFeeValue);
Gets the 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
#
function getDelegationAccountData(
address _owner
) external view returns (
contract IDelegationAccount _delegationAccount,
bool _enabled);
Gets PDA 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
#
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
#
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
#
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
#
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
#
function getRegisteredExecutors(
uint256 _start,
uint256 _end
) external view returns (
address[] _registeredExecutors,
uint256 _totalLength);
Returns the list of executors registered through 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
#
function governance(
) public view returns (
address);
Returns the current effective governance
address.
isClaimExecutor
#
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
.
Parameters | Type | Description |
---|---|---|
_owner |
address |
The reward owner to query. |
_executor |
address |
The executor to query. |
registerExecutor
#
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
#
function revokeDelegationAt(
address _who,
uint256 _blockNumber
) external;
Revokes all delegation from the caller's PDA 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
voting in the current voting block.
To stop delegating use delegate
with percentage of 0 or 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
#
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
#
function setAutoClaiming(
address[] _executors,
bool _enableDelegationAccount
) external payable;
Sets the addresses of executors and optionally enables (creates) a 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
#
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
#
function setLibraryAddress(
address _libraryAddress
) external;
Sets new library address.
Only governance
can call this.
setMaxFeeValueWei
#
function setMaxFeeValueWei(
uint256 _maxFeeValueWei
) external;
Sets maximum fee allowed for executors, in wei.
Only governance
can call this.
setMinFeeValueWei
#
function setMinFeeValueWei(
uint256 _minFeeValueWei
) external;
Sets minimum fee allowed for executors, in wei.
Only governance
can call this.
setRegisterExecutorFeeValueWei
#
function setRegisterExecutorFeeValueWei(
uint256 _registerExecutorFeeValueWei
) external;
Sets the fee required to register an executor, which must be higher than 0.
Only governance
can call this.
switchToProductionMode
#
function switchToProductionMode(
) external;
Enter the production mode after all the initial governance
settings have been set.
This enables timelocks and the governance
can be obtained afterward by calling
governanceSettings
.getGovernanceAddress().
Emits GovernedProductionModeEntered
.
transferExternalToken
#
function transferExternalToken(
contract IERC20 _token,
uint256 _amount
) external;
Allows the caller to transfer ERC-20 tokens from their PDA 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
contract: use method withdraw
for that.
Parameters | Type | Description |
---|---|---|
_token |
contract IERC20 |
Target token contract address. |
_amount |
uint256 |
Amount of tokens to transfer. |
undelegateGovernance
#
function undelegateGovernance(
) external;
Undelegates all governance vote power currently delegated by the caller's PDA.
unregisterExecutor
#
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
#
function updateContractAddresses(
bytes32[] _contractNameHashes,
address[] _contractAddresses
) external;
External method called from AddressUpdater
only.
updateExecutorFeeValue
#
function updateExecutorFeeValue(
uint256 _feeValue
) external returns (
uint256);
Sets the caller's executor fee. The caller must be an executor registered through 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. |
Modifiers#
nonReentrant
#
Defined in ReentrancyGuard
(Source).
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
#
modifier onlyAddressUpdater()
Only the AdressUpdater
contract can call this method.
Its address is set at construction time but it can also update itself.
Structures#
DelegationAccountData
#
struct DelegationAccountData {
contract IIDelegationAccount delegationAccount;
bool enabled;
}
ExecutorFee
#
struct ExecutorFee {
uint256 value;
uint256 validFromEpoch;
}
Variables#
feeValueUpdateOffset
#
uint256 feeValueUpdateOffset
Number of reward epochs that must elapse before an executor's fee change takes effect.
ftsoManager
#
contract IFtsoManager ftsoManager
The FtsoManager
contract.
governanceSettings
#
contract IGovernanceSettings governanceSettings
Governance Settings.
governanceVP
#
contract IGovernanceVotePower governanceVP
The GovernanceVotePower
contract.
maxFeeValueWei
#
uint256 maxFeeValueWei
Maximum allowed value for an executor's fee.
minFeeValueWei
#
uint256 minFeeValueWei
Minimum allowed value for an executor's fee.
productionMode
#
bool productionMode
When true, governance
is enabled and cannot be disabled. See switchToProductionMode
.
registerExecutorFeeValueWei
#
uint256 registerExecutorFeeValueWei
Fee that must be paid to register an executor.
timelockedCalls
#
mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls
List of pending timelocked governance
calls.