View Source: contracts/core/governance/Reporter.sol
↗ Extends: IReporter, Witness ↘ Derived Contracts: Governance
Reporter
This contract allows any NPM tokenholder to report a new incident
or dispute a previously recorded incident.
When a cover pool is reporting, additional tokenholders may join in to reach a resolution.
The First Reporter
is the user who initially submits an incident,
while Candidate Reporter
is the user who challenges the submitted report.
Valid reporter is one of the aforementioned who receives a favourable decision
when resolution is achieved.
Warning:
Please carefully check the cover rules, cover exclusions, and standard exclusion
in detail before you interact with the Governance contract(s). Your entire stake will be forfeited
if resolution does not go in your favor. You will be able to unstake
and receive back your NPM only if:
- incident resolution is in your favor
- after reporting period ends
By using this contract directly via a smart contract call, through an explorer service such as Etherscan, using an SDK and/or API, or in any other way, you are completely aware, fully understand, and accept the risk that you may lose all of your stake.
- report(bytes32 coverKey, bytes32 productKey, string info, uint256 stake)
- dispute(bytes32 coverKey, bytes32 productKey, uint256 incidentDate, string info, uint256 stake)
- setFirstReportingStake(bytes32 coverKey, uint256 value)
- getFirstReportingStake(bytes32 coverKey)
- setReportingBurnRate(uint256 value)
- setReporterCommission(uint256 value)
- getActiveIncidentDate(bytes32 coverKey, bytes32 productKey)
- getReporter(bytes32 coverKey, bytes32 productKey, uint256 incidentDate)
- getResolutionTimestamp(bytes32 coverKey, bytes32 productKey)
- getAttestation(bytes32 coverKey, bytes32 productKey, address who, uint256 incidentDate)
- getRefutation(bytes32 coverKey, bytes32 productKey, address who, uint256 incidentDate)
Stake NPM tokens to file an incident report.
Check the [getFirstReportingStake(coverKey) method](#getfirstreportingstake)
to get
the minimum amount required to report this cover.
For more info, check out the documentation
Rewards:
If you obtain a favourable resolution, you will enjoy the following benefits:
- A proportional commission in NPM tokens on all rewards earned by qualified camp voters (see Unstakable.unstakeWithClaim).
- A proportional commission on the protocol earnings of all stablecoin claim payouts.
- Your share of the 60 percent pool of invalid camp participants.
function report(bytes32 coverKey, bytes32 productKey, string info, uint256 stake) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Enter the cover key you are reporting |
productKey | bytes32 | Enter the product key you are reporting |
info | string | Enter IPFS hash of the incident in the following format: { |
stake | uint256 | Enter the amount you would like to stake to submit this report |
Source Code
function report(
bytes32 coverKey,
bytes32 productKey,
string calldata info,
uint256 stake
) external override nonReentrant {
s.mustNotBePaused();
s.mustBeSupportedProductOrEmpty(coverKey, productKey);
s.mustHaveNormalProductStatus(coverKey, productKey);
uint256 incidentDate = block.timestamp; // solhint-disable-line
require(stake > 0, "Stake insufficient");
require(stake >= s.getMinReportingStakeInternal(coverKey), "Stake insufficient");
s.setUintByKeys(ProtoUtilV1.NS_GOVERNANCE_REPORTING_INCIDENT_DATE, coverKey, productKey, incidentDate);
// Set the Resolution Timestamp
uint256 resolutionDate = block.timestamp + s.getReportingPeriodInternal(coverKey); // solhint-disable-line
s.setUintByKeys(ProtoUtilV1.NS_GOVERNANCE_RESOLUTION_TS, coverKey, productKey, resolutionDate);
// Update the values
s.addAttestationInternal(coverKey, productKey, msg.sender, incidentDate, stake);
// Transfer the stake to the resolution contract
s.getNpmTokenInstanceInternal().ensureTransferFrom(msg.sender, address(s.getResolutionContract()), stake);
emit Reported(coverKey, productKey, msg.sender, incidentDate, info, stake, resolutionDate);
emit Attested(coverKey, productKey, msg.sender, incidentDate, stake);
}
If you believe that a reported incident is wrong, you can stake NPM tokens to dispute an incident report.
Check the [getFirstReportingStake(coverKey) method](#getfirstreportingstake)
to get
the minimum amount required to report this cover.
Rewards:
If you get resolution in your favor, you will receive these rewards:
- A 10% commission on all reward received by valid camp voters (check
Unstakable.unstakeWithClaim
) in NPM tokens. - Your proportional share of the 60% pool of the invalid camp.
function dispute(bytes32 coverKey, bytes32 productKey, uint256 incidentDate, string info, uint256 stake) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Enter the cover key you are reporting |
productKey | bytes32 | Enter the product key you are reporting |
incidentDate | uint256 | |
info | string | Enter IPFS hash of the incident in the following format: { incidentTitle: 'Wrong Incident Reporting', observed: 1723484937, proofOfIncident: 'https://twitter.com/AnimatedBrand/status/5739383124571205635', description: 'Animated Brands emphasised in its most recent tweet that the report regarding their purported hack was false.', } |
stake | uint256 | Enter the amount you would like to stake to submit this dispute |
Source Code
function dispute(
bytes32 coverKey,
bytes32 productKey,
uint256 incidentDate,
string calldata info,
uint256 stake
) external override nonReentrant {
s.mustNotBePaused();
s.mustBeSupportedProductOrEmpty(coverKey, productKey);
s.mustNotHaveDispute(coverKey, productKey);
s.mustBeReporting(coverKey, productKey);
s.mustBeValidIncidentDate(coverKey, productKey, incidentDate);
s.mustBeDuringReportingPeriod(coverKey, productKey);
require(stake > 0, "Stake insufficient");
require(stake >= s.getMinReportingStakeInternal(coverKey), "Stake insufficient");
s.addRefutationInternal(coverKey, productKey, msg.sender, incidentDate, stake);
// Transfer the stake to the resolution contract
s.getNpmTokenInstanceInternal().ensureTransferFrom(msg.sender, address(s.getResolutionContract()), stake);
emit Disputed(coverKey, productKey, msg.sender, incidentDate, info, stake);
emit Refuted(coverKey, productKey, msg.sender, incidentDate, stake);
}
Allows a cover manager set first reporting (minimum) stake of a given cover.
function setFirstReportingStake(bytes32 coverKey, uint256 value) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Provide a coverKey or leave it empty. If empty, the stake is set as fallback value. Covers that do not have customized first reporting stake will infer to the fallback value. |
value | uint256 | Enter the first reporting stake in NPM units |
Source Code
function setFirstReportingStake(bytes32 coverKey, uint256 value) external override nonReentrant {
s.mustNotBePaused();
AccessControlLibV1.mustBeCoverManager(s);
require(value > 0, "Please specify value");
uint256 previous = getFirstReportingStake(coverKey);
if (coverKey > 0) {
s.setUintByKeys(ProtoUtilV1.NS_GOVERNANCE_REPORTING_MIN_FIRST_STAKE, coverKey, value);
} else {
s.setUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTING_MIN_FIRST_STAKE, value);
}
emit FirstReportingStakeSet(coverKey, previous, value);
}
Returns the minimum amount of NPM tokens required to report
or dispute
a cover.
Warning: this function does not validate the cover key supplied.
function getFirstReportingStake(bytes32 coverKey) public view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Specify the cover you want to get the minimum stake required value of. |
Source Code
function getFirstReportingStake(bytes32 coverKey) public view override returns (uint256) {
return s.getMinReportingStakeInternal(coverKey);
}
Allows a cover manager set burn rate of the NPM tokens of the invalid camp.
The protocol forfeits all stakes of invalid camp voters. During unstakeWithClaim
,
NPM tokens get proportionately burned as configured here.
The unclaimed and thus unburned NPM stakes will be manually pulled
and burned on a periodic but not-so-frequent basis.
function setReportingBurnRate(uint256 value) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
value | uint256 | Enter the burn rate in percentage value (Check ProtoUtilV1.MULTIPLIER for division) |
Source Code
function setReportingBurnRate(uint256 value) external override nonReentrant {
require(value > 0, "Please specify value");
s.mustNotBePaused();
AccessControlLibV1.mustBeCoverManager(s);
require(s.getGovernanceReporterCommissionInternal() + value <= ProtoUtilV1.MULTIPLIER, "Rate too high");
uint256 previous = s.getUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTING_BURN_RATE);
s.setUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTING_BURN_RATE, value);
emit ReportingBurnRateSet(previous, value);
}
Allows a cover manager set reporter comission of the NPM tokens from the invalid camp.
The protocol forfeits all stakes of invalid camp voters. During unstakeWithClaim
,
NPM tokens get proportionately transferred to the valid reporter as configured here.
The unclaimed and thus unrewarded NPM stakes will be manually pulled and burned on a periodic but not-so-frequent basis.
function setReporterCommission(uint256 value) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
value | uint256 | Enter the valid reporter comission in percentage value (Check ProtoUtilV1.MULTIPLIER for division) |
Source Code
function setReporterCommission(uint256 value) external override nonReentrant {
require(value > 0, "Please specify value");
s.mustNotBePaused();
AccessControlLibV1.mustBeCoverManager(s);
require(s.getReportingBurnRateInternal() + value <= ProtoUtilV1.MULTIPLIER, "Rate too high");
uint256 previous = s.getUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTER_COMMISSION);
s.setUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTER_COMMISSION, value);
emit ReporterCommissionSet(previous, value);
}
Gets the latest incident date of a given cover product Warning: this function does not validate the cover and product key supplied.
function getActiveIncidentDate(bytes32 coverKey, bytes32 productKey) external view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Enter the cover key you want to get the incident of |
productKey | bytes32 | Enter the product key you want to get the incident of |
Source Code
function getActiveIncidentDate(bytes32 coverKey, bytes32 productKey) external view override returns (uint256) {
return s.getActiveIncidentDateInternal(coverKey, productKey);
}
Gets the reporter of a cover by its incident date Warning: this function does not validate the input arguments.
function getReporter(bytes32 coverKey, bytes32 productKey, uint256 incidentDate) external view
returns(address)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Enter the cover key you would like to get the reporter of |
productKey | bytes32 | Enter the product key you would like to get the reporter of |
incidentDate | uint256 |
Source Code
function getReporter(
bytes32 coverKey,
bytes32 productKey,
uint256 incidentDate
) external view override returns (address) {
return s.getReporterInternal(coverKey, productKey, incidentDate);
}
Returns the resolution date of a given cover Warning: this function does not validate the input arguments.
function getResolutionTimestamp(bytes32 coverKey, bytes32 productKey) external view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Enter the cover key to get the resolution date of |
productKey | bytes32 | Enter the product key to get the resolution date of |
Source Code
function getResolutionTimestamp(bytes32 coverKey, bytes32 productKey) external view override returns (uint256) {
return s.getResolutionTimestampInternal(coverKey, productKey);
}
Gets an account's attestation details. Please also check getRefutation
since an account
can submit both attestations
and refutations
if they wish to.
Warning: this function does not validate the input arguments.
function getAttestation(bytes32 coverKey, bytes32 productKey, address who, uint256 incidentDate) external view
returns(myStake uint256, totalStake uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Enter the cover key you want to get attestation of |
productKey | bytes32 | Enter the product key you want to get attestation of |
who | address | Enter the account you want to get attestation of |
incidentDate | uint256 |
Source Code
function getAttestation(
bytes32 coverKey,
bytes32 productKey,
address who,
uint256 incidentDate
) external view override returns (uint256 myStake, uint256 totalStake) {
return s.getAttestationInternal(coverKey, productKey, who, incidentDate);
}
Gets an account's refutation details. Please also check getAttestation
since an account
can submit both attestations
and refutations
if they wish to.
Warning: this function does not validate the input arguments.
function getRefutation(bytes32 coverKey, bytes32 productKey, address who, uint256 incidentDate) external view
returns(myStake uint256, totalStake uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | Enter the cover key you want to get refutation of |
productKey | bytes32 | Enter the product key you want to get refutation of |
who | address | Enter the account you want to get refutation of |
incidentDate | uint256 |
Source Code
function getRefutation(
bytes32 coverKey,
bytes32 productKey,
address who,
uint256 incidentDate
) external view override returns (uint256 myStake, uint256 totalStake) {
return s.getRefutationInternal(coverKey, productKey, who, incidentDate);
}
- AaveStrategy
- AccessControl
- AccessControlLibV1
- Address
- BaseLibV1
- BokkyPooBahsDateTimeLibrary
- BondPool
- BondPoolBase
- BondPoolLibV1
- CompoundStrategy
- Context
- Cover
- CoverBase
- CoverLibV1
- CoverReassurance
- CoverStake
- CoverUtilV1
- cxToken
- cxTokenFactory
- cxTokenFactoryLibV1
- Delayable
- Destroyable
- ERC165
- ERC20
- FakeAaveLendingPool
- FakeCompoundStablecoinDelegator
- FakePriceOracle
- FakeRecoverable
- FakeStore
- FakeToken
- FakeUniswapPair
- FakeUniswapV2FactoryLike
- FakeUniswapV2PairLike
- FakeUniswapV2RouterLike
- FaultyAaveLendingPool
- FaultyCompoundStablecoinDelegator
- Finalization
- ForceEther
- Governance
- GovernanceUtilV1
- IAaveV2LendingPoolLike
- IAccessControl
- IBondPool
- IClaimsProcessor
- ICompoundERC20DelegatorLike
- ICover
- ICoverReassurance
- ICoverStake
- ICxToken
- ICxTokenFactory
- IERC165
- IERC20
- IERC20Detailed
- IERC20Metadata
- IERC3156FlashBorrower
- IERC3156FlashLender
- IFinalization
- IGovernance
- ILendingStrategy
- ILiquidityEngine
- IMember
- INeptuneRouterV1
- InvalidStrategy
- IPausable
- IPolicy
- IPolicyAdmin
- IPriceOracle
- IProtocol
- IRecoverable
- IReporter
- IResolution
- IResolvable
- IStakingPools
- IStore
- IStoreLike
- IUniswapV2FactoryLike
- IUniswapV2PairLike
- IUniswapV2RouterLike
- IUnstakable
- IVault
- IVaultDelegate
- IVaultFactory
- IWitness
- LiquidityEngine
- MaliciousToken
- MockAccessControlUser
- MockCoverUtilUser
- MockCxToken
- MockCxTokenPolicy
- MockCxTokenStore
- MockFlashBorrower
- MockLiquidityEngineUser
- MockProcessorStore
- MockProcessorStoreLib
- MockProtocol
- MockRegistryClient
- MockStore
- MockStoreKeyUtilUser
- MockValidationLibUser
- MockVault
- MockVaultLibUser
- NeptuneRouterV1
- NPM
- NpmDistributor
- NTransferUtilV2
- NTransferUtilV2Intermediate
- Ownable
- Pausable
- Policy
- PolicyAdmin
- PolicyHelperV1
- PoorMansERC20
- POT
- PriceLibV1
- Processor
- ProtoBase
- Protocol
- ProtoUtilV1
- Recoverable
- ReentrancyGuard
- RegistryLibV1
- Reporter
- Resolution
- Resolvable
- RoutineInvokerLibV1
- SafeERC20
- StakingPoolBase
- StakingPoolCoreLibV1
- StakingPoolInfo
- StakingPoolLibV1
- StakingPoolReward
- StakingPools
- Store
- StoreBase
- StoreKeyUtil
- StrategyLibV1
- Strings
- TimelockController
- Unstakable
- ValidationLibV1
- Vault
- VaultBase
- VaultDelegate
- VaultDelegateBase
- VaultDelegateWithFlashLoan
- VaultFactory
- VaultFactoryLibV1
- VaultLibV1
- VaultLiquidity
- VaultStrategy
- WithFlashLoan
- WithPausability
- WithRecovery
- Witness