Skip to main content

OctantQFMechanism

Git Source

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

NameTypeDescription
_implementationaddressAddress of shared TokenizedAllocationMechanism implementation
_configAllocationConfigAllocation configuration struct
_alphaNumeratoruint256Alpha numerator (dimensionless; 1.0 = denominator)
_alphaDenominatoruint256Alpha denominator (must be > 0)
_contributionAllowsetIAddressSetAddress set used in ALLOWSET mode
_contributionBlocksetIAddressSetAddress set used in BLOCKSET mode
_contributionAccessModeAccessModeInitial 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

NameTypeDescription
useraddressAddress attempting to register

Returns

NameTypeDescription
<none>boolTrue if registration should proceed

_isUserAuthorized

Internal helper to check access control without reverting

function _isUserAuthorized(address user) internal view returns (bool);

Parameters

NameTypeDescription
useraddressAddress to check

Returns

NameTypeDescription
<none>boolTrue 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

NameTypeDescription
_allowsetIAddressSetNew 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

NameTypeDescription
_blocksetIAddressSetNew 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

NameTypeDescription
_modeAccessModeNew 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

NameTypeDescription
useraddressAddress to check

Returns

NameTypeDescription
<none>boolcanSignup_ True if user can signup, false otherwise

Events

ContributionAllowsetAssigned

Emitted when the allowset contract is assigned

event ContributionAllowsetAssigned(IAddressSet indexed allowset);

Parameters

NameTypeDescription
allowsetIAddressSetNew allowset contract

ContributionBlocksetAssigned

Emitted when the blockset contract is assigned

event ContributionBlocksetAssigned(IAddressSet indexed blockset);

Parameters

NameTypeDescription
blocksetIAddressSetNew blockset contract

AccessModeSet

Emitted when the contribution access mode is updated

event AccessModeSet(AccessMode indexed mode);

Parameters

NameTypeDescription
modeAccessModeNew access mode (NONE, ALLOWSET, BLOCKSET)