Administrative Functions
This section details all administrative functions in the contract, which implement a secure time-delayed governance system to ensure safe management of critical contract parameters and roles.
All administrative changes follow a secure two-step process with a mandatory 24-hour waiting period to prevent immediate modifications to critical parameters.
Presale Staker Management
addPresaleStaker
Function Type: external
Function Signature: addPresaleStaker(address)
Allows the admin to add a single new presale staker to the contract.
Parameters
Parameter | Type | Description |
---|---|---|
_staker | address | Address of the new presale staker |
Workflow
- Admin Verification: Validates caller has admin privileges using
onlyOwner
modifier - Limit Validation: Ensures adding this staker won't exceed the 800 staker limit (
LIMIT_PRESALE_STAKER
) - Staker Registration: Sets
userPresaleStaker[_staker].isAllow = true
- Counter Update: Increments
presaleStakerCount
addPresaleStakers
Function Type: external
Function Signature: addPresaleStakers(address[])
Allows the admin to add multiple presale stakers in a single transaction for efficient batch processing.
Parameters
Parameter | Type | Description |
---|---|---|
_stakers | address[] | Array of addresses of new presale stakers |
Workflow
- Admin Verification: Validates caller has admin privileges using
onlyOwner
modifier - Batch Processing: Iterates through the array of staker addresses
- Individual Limit Check: For each address, verifies the 800 staker limit (
LIMIT_PRESALE_STAKER
) - Staker Registration: Sets
userPresaleStaker[_stakers[i]].isAllow = true
for each valid address - Counter Update: Increments
presaleStakerCount
for each successfully added staker
Admin Role Management
proposeAdmin
Function Type: external
Function Signature: proposeAdmin(address)
Initiates the admin role transfer process by proposing a new admin address.
Parameters
Parameter | Type | Description |
---|---|---|
_newAdmin | address | Address of the proposed new admin |
Workflow
- Admin Verification: Validates caller has current admin privileges
- Proposal Setup: Sets
admin.proposal = _newAdmin
- Time Lock Activation: Sets
admin.timeToAccept = block.timestamp + 1 days
rejectProposalAdmin
Function Type: external
Function Signature: rejectProposalAdmin()
Allows the current admin to cancel a pending admin change proposal.
Workflow
- Admin Verification: Validates caller has current admin privileges
- Proposal Cancellation: Resets
admin.proposal = address(0)
- Time Lock Reset: Resets
admin.timeToAccept = 0
acceptNewAdmin
Function Type: external
Function Signature: acceptNewAdmin()
Allows the proposed admin to accept the role after the mandatory waiting period.
Workflow
- Proposal Validation: Verifies
msg.sender == admin.proposal
- Time Lock Validation: Confirms
admin.timeToAccept <= block.timestamp
- Role Transfer: Updates
admin.actual = admin.proposal
- Cleanup: Resets
admin.proposal = address(0)
andadmin.timeToAccept = 0
Golden Fisher Role Management
proposeGoldenFisher
Function Type: external
Function Signature: proposeGoldenFisher(address)
Initiates the golden fisher role assignment process.
Parameters
Parameter | Type | Description |
---|---|---|
_goldenFisher | address | Address of the proposed new golden fisher |
Workflow
- Admin Verification: Validates caller has admin privileges
- Proposal Setup: Sets
goldenFisher.proposal = _goldenFisher
- Time Lock Activation: Sets
goldenFisher.timeToAccept = block.timestamp + 1 days
rejectProposalGoldenFisher
Function Type: external
Function Signature: rejectProposalGoldenFisher()
Allows the current admin to cancel a pending golden fisher change proposal.
Workflow
- Admin Verification: Validates caller has admin privileges
- Proposal Cancellation: Resets
goldenFisher.proposal = address(0)
- Time Lock Reset: Resets
goldenFisher.timeToAccept = 0
acceptNewGoldenFisher
Function Type: external
Function Signature: acceptNewGoldenFisher()
Allows the admin to confirm the new golden fisher role assignment after the waiting period.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Validation: Confirms
goldenFisher.timeToAccept <= block.timestamp
- Role Assignment: Updates
goldenFisher.actual = goldenFisher.proposal
- Cleanup: Resets
goldenFisher.proposal = address(0)
andgoldenFisher.timeToAccept = 0
Staking Time Lock Configuration
proposeSetSecondsToUnlockStaking
Function Type: external
Function Signature: proposeSetSecondsToUnlockStaking(uint256)
Initiates the process to change the re-staking cooldown period.
Parameters
Parameter | Type | Description |
---|---|---|
_secondsToUnlockStaking | uint256 | New staking unlock period in seconds |
Workflow
- Admin Verification: Validates caller has admin privileges
- Proposal Setup: Sets
secondsToUnlockStaking.proposal = _secondsToUnlockStaking
- Time Lock Activation: Sets
secondsToUnlockStaking.timeToAccept = block.timestamp + 1 days
rejectProposalSetSecondsToUnlockStaking
Function Type: external
Function Signature: rejectProposalSetSecondsToUnlockStaking()
Allows the current admin to cancel a pending staking unlock period change proposal.
Workflow
- Admin Verification: Validates caller has admin privileges
- Proposal Cancellation: Resets
secondsToUnlockStaking.proposal = 0
- Time Lock Reset: Resets
secondsToUnlockStaking.timeToAccept = 0
acceptSetSecondsToUnlockStaking
Function Type: external
Function Signature: acceptSetSecondsToUnlockStaking()
Allows the admin to confirm the new staking unlock period after the waiting period.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Validation: Confirms
secondsToUnlockStaking.timeToAccept <= block.timestamp
- Configuration Update: Updates
secondsToUnlockStaking.actual = secondsToUnlockStaking.proposal
- Cleanup: Resets
secondsToUnlockStaking.proposal = 0
andsecondsToUnlockStaking.timeToAccept = 0
Full Unstaking Time Lock Configuration
prepareSetSecondsToUnlockFullUnstaking
Function Type: external
Function Signature: prepareSetSecondsToUnllockFullUnstaking(uint256)
Initiates the process to change the full unstaking cooldown period.
Parameters
Parameter | Type | Description |
---|---|---|
_secondsToUnllockFullUnstaking | uint256 | New full unstaking unlock period in seconds |
Workflow
- Admin Verification: Validates caller has admin privileges
- Proposal Setup: Sets
secondsToUnllockFullUnstaking.proposal = _secondsToUnllockFullUnstaking
- Time Lock Activation: Sets
secondsToUnllockFullUnstaking.timeToAccept = block.timestamp + 1 days
cancelSetSecondsToUnlockFullUnstaking
Function Type: external
Function Signature: cancelSetSecondsToUnllockFullUnstaking()
Allows the current admin to cancel a pending full unstaking unlock period change proposal.
Workflow
- Admin Verification: Validates caller has admin privileges
- Proposal Cancellation: Resets
secondsToUnllockFullUnstaking.proposal = 0
- Time Lock Reset: Resets
secondsToUnllockFullUnstaking.timeToAccept = 0
confirmSetSecondsToUnlockFullUnstaking
Function Type: external
Function Signature: confirmSetSecondsToUnllockFullUnstaking()
Allows the admin to confirm the new full unstaking unlock period after the waiting period.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Validation: Confirms
secondsToUnllockFullUnstaking.timeToAccept <= block.timestamp
- Configuration Update: Updates
secondsToUnllockFullUnstaking.actual = secondsToUnllockFullUnstaking.proposal
- Cleanup: Resets
secondsToUnllockFullUnstaking.proposal = 0
andsecondsToUnllockFullUnstaking.timeToAccept = 0
Public Staking Flag Management
prepareChangeAllowPublicStaking
Function Type: external
Function Signature: prepareChangeAllowPublicStaking()
Initiates the process to toggle the public staking availability flag.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Activation: Sets
allowPublicStaking.timeToAccept = block.timestamp + 1 days
cancelChangeAllowPublicStaking
Function Type: external
Function Signature: cancelChangeAllowPublicStaking()
Allows the current admin to cancel a pending public staking flag change proposal.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Reset: Resets
allowPublicStaking.timeToAccept = 0
confirmChangeAllowPublicStaking
Function Type: external
Function Signature: confirmChangeAllowPublicStaking()
Allows the admin to confirm the public staking flag toggle after the waiting period.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Validation: Confirms
allowPublicStaking.timeToAccept <= block.timestamp
- Flag Toggle: Creates new
BoolTypeProposal
withflag: !allowPublicStaking.flag
- Cleanup: Sets
timeToAccept: 0
Presale Staking Flag Management
prepareChangeAllowPresaleStaking
Function Type: external
Function Signature: prepareChangeAllowPresaleStaking()
Initiates the process to toggle the presale staking availability flag.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Activation: Sets
allowPresaleStaking.timeToAccept = block.timestamp + 1 days
cancelChangeAllowPresaleStaking
Function Type: external
Function Signature: cancelChangeAllowPresaleStaking()
Allows the current admin to cancel a pending presale staking flag change proposal.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Reset: Resets
allowPresaleStaking.timeToAccept = 0
confirmChangeAllowPresaleStaking
Function Type: external
Function Signature: confirmChangeAllowPresaleStaking()
Allows the admin to confirm the presale staking flag toggle after the waiting period.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Validation: Confirms
allowPresaleStaking.timeToAccept <= block.timestamp
- Flag Toggle: Creates new
BoolTypeProposal
withflag: !allowPresaleStaking.flag
- Cleanup: Sets
timeToAccept: 0
Estimator Contract Management
proposeEstimator
Function Type: external
Function Signature: proposeEstimator(address)
Initiates the process to change the estimator contract address.
Parameters
Parameter | Type | Description |
---|---|---|
_estimator | address | Address of the proposed new estimator |
Workflow
- Admin Verification: Validates caller has admin privileges
- Proposal Setup: Sets
estimator.proposal = _estimator
- Time Lock Activation: Sets
estimator.timeToAccept = block.timestamp + 1 days
rejectProposalEstimator
Function Type: external
Function Signature: rejectProposalEstimator()
Allows the current admin to cancel a pending estimator change proposal.
Workflow
- Admin Verification: Validates caller has admin privileges
- Proposal Cancellation: Resets
estimator.proposal = address(0)
- Time Lock Reset: Resets
estimator.timeToAccept = 0
acceptNewEstimator
Function Type: external
Function Signature: acceptNewEstimator()
Allows the admin to confirm the new estimator address after the waiting period.
Workflow
- Admin Verification: Validates caller has admin privileges
- Time Lock Validation: Confirms
estimator.timeToAccept <= block.timestamp
- Contract Update: Updates
estimator.actual = estimator.proposal
- Cleanup: Resets
estimator.proposal = address(0)
andestimator.timeToAccept = 0
Data Structures
AddressTypeProposal
struct AddressTypeProposal {
address actual; // Current active address
address proposal; // Proposed new address
uint256 timeToAccept; // Timestamp when proposal can be accepted
}
Used for managing: admin
, goldenFisher
, estimator
UintTypeProposal
struct UintTypeProposal {
uint256 actual; // Current active value
uint256 proposal; // Proposed new value
uint256 timeToAccept; // Timestamp when proposal can be accepted
}
Used for managing: secondsToUnlockStaking
, secondsToUnllockFullUnstaking
BoolTypeProposal
struct BoolTypeProposal {
bool flag; // Current boolean state
uint256 timeToAccept; // Timestamp when flag change can be executed
}
Used for managing: allowPresaleStaking
, allowPublicStaking
presaleStakerMetadata
struct presaleStakerMetadata {
bool isAllow; // Whether address can participate in presale staking
uint256 stakingAmount; // Current staking tokens staked (max 2 for presale)
}
Used for tracking presale staker status and limits.