Assessment
Overview
The Assessment contract manages evaluation of cover claims. Members stake NXM tokens and cast votes to determine the outcome of assessments. The contract distributes rewards for benevolent participation, enforces stake lockup periods, and implements a fraud resolution process by burning tokens from fraudulent assessors.
Key Concepts
Stake & Voting Power
A Stake represents the amount of NXM tokens deposited by a member. Stakes determine voting power:
- Assessors must stake NXM before they can vote.
- The more NXM staked, the greater the vote weight.
- Stakes are locked when used for voting.
Stake Locking
Stakes are locked after voting and cannot be withdrawn immediately. If voting on multiple assessments, the longest lock period applies.
| Lock Type | Purpose | Unlock Condition |
|---|---|---|
| Governance Lock | Prevents withdrawals during voting | Unlocks after governance vote ends |
| Assessment Lock | Prevents voting manipulation | Unlocks after assessment cooldown ends |
Assessment & Poll
An Assessment is a voting process initiated when a claim is raised to determine its validity. It contains:
accepted: Total stake voting in favor.denied: Total stake voting against.start: Timestamp when the poll began.end: Timestamp when the poll ends.
Each assessment contains a Poll, which tracks:
- Accepted votes (
accepted) → Total stake voting for the claim. - Denied votes (
denied) → Total stake voting against the claim. - Start & End timestamps (
start,end) → Voting period.
Voting Outcome
- If more stake is placed on
accept, the claim is approved. - If more stake is placed on
deny, the claim is rejected. - First
acceptvote extends the poll duration. - Late voting activity may further extend the poll (
silentEndingPeriod).
ETH Deposits & Claim Resolution
- Claimants deposit ETH when filing a claim.
- If the claim is denied, the deposit is used to fund rewards for assessors.
- If the claim is approved, the deposit is refunded to the claimant.
Reward Distribution
- NXM rewards are given to honest voters.
- Voters must manually withdraw rewards using
withdrawRewards(). - How rewards are calculated:
- The total reward pool is split proportionally to the stake.
- If an assessor votes incorrectly, they receive no rewards.
- Rewards are only claimable after the payout cooldown ends.
Fraud Resolution
- If fraudulent votes are detected, a Merkle proof is submitted.
- Fraudulent voters:
- Lose their rewards.
- May have their NXM staked for the vote burned.
- Can be banned from future voting.
- How fraud is processed:
- Fraud reports are submitted via
processFraud(). - The system verifies fraud via a Merkle tree proof.
- If confirmed, the fraudulent votes are removed and tokens burned.
- Fraud reports are submitted via
Configuration
The Configuration struct contains parameters that govern the assessment process. These parameters can be updated via governance:
- minVotingPeriodInDays: Minimum duration for which a poll remains open once the first accept vote is cast.
- stakeLockupPeriodInDays: Duration for which staked tokens are locked after a vote.
- payoutCooldownInDays: Cooldown period after a poll ends before rewards can be withdrawn.
- silentEndingPeriodInDays: A period used to extend the poll end time if voting activity is low near closing.****
Mutative Functions
stake
Allows a member to increase their stake by transferring NXM tokens to the contract.
function stake(uint96 amount) public whenNotPaused { ... }
| Parameter | Description |
|---|---|
amount | The amount of NXM tokens to stake. |
- Behavior:
- Increases the sender's stake.
- Transfers NXM from the sender to the contract via the Token Controller.
- Emits the
StakeDepositedevent.
unstake
Withdraws part or all of a member's stake, subject to lockup restrictions.
function unstake(uint96 amount, address to) external override whenNotPaused { ... }
| Parameter | Description |
|---|---|
amount | The amount of NXM tokens to withdraw. |
to | The address to which the tokens will be transferred. |
- Conditions:
- The caller must have sufficient staked tokens.
- The stake is locked until the stake lockup period (and any governance lock) has expired.
- Events:
- Emits the
StakeWithdrawnevent.
- Emits the
unstakeAllFor
Withdraws the full staked amount for a given member. Can only be invoked by the Token Controller.
function unstakeAllFor(address staker) external override whenNotPaused onlyTokenController { ... }
| Parameter | Description |
|---|---|
staker | The address of the member to unstake. |
- Access Control:
- Restricted to the Token Controller.