OctantQFMechanism
Inherits: QuadraticVotingMechanism
Title: Octant Quadratic Funding Mechanism
Author: Golem Foundation
Quadratic funding mechanism with configurable signup access control.
Extends QuadraticVotingMechanism and integrates allowset/blockset access modes
to restrict who can register during contribution windows. Owner-only control via
underlying TokenizedAllocationMechanism ownership checks.
Note: security-contact: [email protected]
State Variables
contributionAccessMode
Current access mode for signup eligibility (NONE, ALLOWSET, BLOCKSET)
AccessMode public contributionAccessMode
contributionAllowset
Address set used when contributionAccessMode == ALLOWSET
IAddressSet public contributionAllowset
contributionBlockset
Address set used when contributionAccessMode == BLOCKSET
IAddressSet public contributionBlockset
Functions
constructor
Construct a new OctantQF mechanism
constructor(
address _implementation,
AllocationConfig memory _config,
uint256 _alphaNumerator,
uint256 _alphaDenominator,
IAddressSet _contributionAllowset,
IAddressSet _contributionBlockset,
AccessMode _contributionAccessMode
) QuadraticVotingMechanism(_implementation, _config, _alphaNumerator, _alphaDenominator);
Parameters
| Name | Type | Description |
|---|---|---|
_implementation | address | Address of shared TokenizedAllocationMechanism implementation |
_config | AllocationConfig | Allocation configuration struct |
_alphaNumerator | uint256 | Alpha numerator (dimensionless; 1.0 = denominator) |
_alphaDenominator | uint256 | Alpha denominator (must be > 0) |
_contributionAllowset | IAddressSet | Address set used in ALLOWSET mode |
_contributionBlockset | IAddressSet | Address set used in BLOCKSET mode |
_contributionAccessMode | AccessMode | Initial access mode (NONE, ALLOWSET, BLOCKSET) |
_beforeSignupHook
Hook to validate user eligibility during signup
Reverts with specific error messages for unauthorized users
function _beforeSignupHook(address user) internal view virtual override returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Address attempting to register |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if registration should proceed |
_isUserAuthorized
Internal helper to check access control without reverting
function _isUserAuthorized(address user) internal view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Address to check |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if user passes access control checks, false otherwise |
setContributionAllowset
Sets the contribution allowset (for ALLOWSET mode)
Non-retroactive. Existing voting power is not affected.
Note: security: Only owner via underlying mechanism ownership check
function setContributionAllowset(IAddressSet _allowset) external;
Parameters
| Name | Type | Description |
|---|---|---|
_allowset | IAddressSet | New allowset contract address |
setContributionBlockset
Sets the contribution blockset (for BLOCKSET mode)
Non-retroactive. Existing voting power is not affected.
Note: security: Only owner via underlying mechanism ownership check
function setContributionBlockset(IAddressSet _blockset) external;
Parameters
| Name | Type | Description |
|---|---|---|
_blockset | IAddressSet | New blockset contract address |
setAccessMode
Sets the contribution access mode
Only allowed before voting starts or after tally finalization. Non-retroactive. Existing voting power is not affected.
Note: security: Only owner via underlying mechanism; blocked during active voting
function setAccessMode(AccessMode _mode) external;
Parameters
| Name | Type | Description |
|---|---|---|
_mode | AccessMode | New access mode (NONE, ALLOWSET, or BLOCKSET) |
canSignup
Checks if a user is eligible to signup/contribute based on current access mode
Required for allocation mechanism to be compatible with RegenStaker. Used for defense-in-depth checks. Respects contributionAccessMode: NONE: always returns true ALLOWSET: returns true if user is in contributionAllowset BLOCKSET: returns true if user is NOT in contributionBlockset
function canSignup(address user) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Address to check |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | canSignup_ True if user can signup, false otherwise |
Events
ContributionAllowsetAssigned
Emitted when the allowset contract is assigned
event ContributionAllowsetAssigned(IAddressSet indexed allowset);
Parameters
| Name | Type | Description |
|---|---|---|
allowset | IAddressSet | New allowset contract |
ContributionBlocksetAssigned
Emitted when the blockset contract is assigned
event ContributionBlocksetAssigned(IAddressSet indexed blockset);
Parameters
| Name | Type | Description |
|---|---|---|
blockset | IAddressSet | New blockset contract |
AccessModeSet
Emitted when the contribution access mode is updated
event AccessModeSet(AccessMode indexed mode);
Parameters
| Name | Type | Description |
|---|---|---|
mode | AccessMode | New access mode (NONE, ALLOWSET, BLOCKSET) |