View Source: contracts/core/governance/Reporter.sol
↗ Extends: IReporter, Witness ↘ Derived Contracts: Governance
Reporter
This contract enables any NPM tokenholder to
report an incident or dispute a reported incident.
The reporters can submit incidents and/or dispute them as well.
When a cover pool is reporting, other tokenholders can also join
the reporters achieve a resolution.
The reporter who first submits an incident is known as First Reporter
whereas
the reporter who disputes the reported incident is called Candidate Reporter
.
- report(bytes32 coverKey, bytes32 info, uint256 stake)
- dispute(bytes32 coverKey, uint256 incidentDate, bytes32 info, uint256 stake)
- setFirstReportingStake(uint256 value)
- getFirstReportingStake()
- getFirstReportingStake(bytes32 coverKey)
- setReportingBurnRate(uint256 value)
- setReporterCommission(uint256 value)
- getActiveIncidentDate(bytes32 coverKey)
- getReporter(bytes32 coverKey, uint256 incidentDate)
- getResolutionTimestamp(bytes32 coverKey)
- getAttestation(bytes32 coverKey, address who, uint256 incidentDate)
- getDispute(bytes32 coverKey, address who, uint256 incidentDate)
function report(bytes32 coverKey, bytes32 info, uint256 stake) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | |
info | bytes32 | |
stake | uint256 |
Source Code
function report(
bytes32 coverKey,
bytes32 info,
uint256 stake
) external override nonReentrant {
// @suppress-acl Marking this as publicly accessible
s.mustNotBePaused();
s.mustHaveNormalCoverStatus(coverKey);
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, incidentDate);
// Set the Resolution Timestamp
uint256 resolutionDate = block.timestamp + s.getReportingPeriodInternal(coverKey); // solhint-disable-line
s.setUintByKeys(ProtoUtilV1.NS_GOVERNANCE_RESOLUTION_TS, coverKey, resolutionDate);
// Update the values
s.addAttestationInternal(coverKey, msg.sender, incidentDate, stake);
// Transfer the stake to the resolution contract
s.npmToken().ensureTransferFrom(msg.sender, address(s.getResolutionContract()), stake);
emit Reported(coverKey, msg.sender, incidentDate, info, stake, resolutionDate);
emit Attested(coverKey, msg.sender, incidentDate, stake);
}
function dispute(bytes32 coverKey, uint256 incidentDate, bytes32 info, uint256 stake) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | |
incidentDate | uint256 | |
info | bytes32 | |
stake | uint256 |
Source Code
function dispute(
bytes32 coverKey,
uint256 incidentDate,
bytes32 info,
uint256 stake
) external override nonReentrant {
// @suppress-acl Marking this as publicly accessible
s.mustNotBePaused();
s.mustNotHaveDispute(coverKey);
s.mustBeReporting(coverKey);
s.mustBeValidIncidentDate(coverKey, incidentDate);
s.mustBeDuringReportingPeriod(coverKey);
require(stake > 0, "Stake insufficient");
require(stake >= s.getMinReportingStakeInternal(coverKey), "Stake insufficient");
s.addDisputeInternal(coverKey, msg.sender, incidentDate, stake);
// Transfer the stake to the resolution contract
s.npmToken().ensureTransferFrom(msg.sender, address(s.getResolutionContract()), stake);
emit Disputed(coverKey, msg.sender, incidentDate, info, stake);
emit Refuted(coverKey, msg.sender, incidentDate, stake);
}
function setFirstReportingStake(uint256 value) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
value | uint256 |
Source Code
function setFirstReportingStake(uint256 value) external override nonReentrant {
s.mustNotBePaused();
AccessControlLibV1.mustBeCoverManager(s);
require(value > 0, "Please specify value");
uint256 previous = s.getUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTING_MIN_FIRST_STAKE);
s.setUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTING_MIN_FIRST_STAKE, value);
emit FirstReportingStakeSet(previous, value);
}
function getFirstReportingStake() external view
returns(uint256)
Arguments
Name | Type | Description |
---|
Source Code
function getFirstReportingStake() external view override returns (uint256) {
return s.getUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTING_MIN_FIRST_STAKE);
}
function getFirstReportingStake(bytes32 coverKey) external view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 |
Source Code
function getFirstReportingStake(bytes32 coverKey) external view override returns (uint256) {
return s.getMinReportingStakeInternal(coverKey);
}
function setReportingBurnRate(uint256 value) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
value | uint256 |
Source Code
function setReportingBurnRate(uint256 value) external override nonReentrant {
require(value > 0, "Please specify value");
s.mustNotBePaused();
AccessControlLibV1.mustBeCoverManager(s);
uint256 previous = s.getUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTING_BURN_RATE);
s.setUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTING_BURN_RATE, value);
emit ReportingBurnRateSet(previous, value);
}
function setReporterCommission(uint256 value) external nonpayable nonReentrant
Arguments
Name | Type | Description |
---|---|---|
value | uint256 |
Source Code
function setReporterCommission(uint256 value) external override nonReentrant {
s.mustNotBePaused();
AccessControlLibV1.mustBeCoverManager(s);
require(value > 0, "Please specify value");
uint256 previous = s.getUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTER_COMMISSION);
s.setUintByKey(ProtoUtilV1.NS_GOVERNANCE_REPORTER_COMMISSION, value);
emit ReporterCommissionSet(previous, value);
}
function getActiveIncidentDate(bytes32 coverKey) external view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 |
Source Code
function getActiveIncidentDate(bytes32 coverKey) external view override returns (uint256) {
return s.getActiveIncidentDateInternal(coverKey);
}
function getReporter(bytes32 coverKey, uint256 incidentDate) external view
returns(address)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | |
incidentDate | uint256 |
Source Code
function getReporter(bytes32 coverKey, uint256 incidentDate) external view override returns (address) {
return s.getReporterInternal(coverKey, incidentDate);
}
function getResolutionTimestamp(bytes32 coverKey) external view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 |
Source Code
function getResolutionTimestamp(bytes32 coverKey) external view override returns (uint256) {
return s.getResolutionTimestampInternal(coverKey);
}
function getAttestation(bytes32 coverKey, address who, uint256 incidentDate) external view
returns(myStake uint256, totalStake uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | |
who | address | |
incidentDate | uint256 |
Source Code
function getAttestation(
bytes32 coverKey,
address who,
uint256 incidentDate
) external view override returns (uint256 myStake, uint256 totalStake) {
return s.getAttestationInternal(coverKey, who, incidentDate);
}
function getDispute(bytes32 coverKey, address who, uint256 incidentDate) external view
returns(myStake uint256, totalStake uint256)
Arguments
Name | Type | Description |
---|---|---|
coverKey | bytes32 | |
who | address | |
incidentDate | uint256 |
Source Code
function getDispute(
bytes32 coverKey,
address who,
uint256 incidentDate
) external view override returns (uint256 myStake, uint256 totalStake) {
return s.getDisputeInternal(coverKey, who, incidentDate);
}
- AaveStrategy
- AccessControl
- AccessControlLibV1
- Address
- BaseLibV1
- BokkyPooBahsDateTimeLibrary
- BondPool
- BondPoolBase
- BondPoolLibV1
- CompoundStrategy
- console
- Context
- Cover
- CoverBase
- CoverLibV1
- CoverReassurance
- CoverStake
- CoverUtilV1
- cxToken
- cxTokenFactory
- cxTokenFactoryLibV1
- Delayable
- Destroyable
- ERC165
- ERC20
- FakeAaveLendingPool
- FakeCompoundDaiDelegator
- FakeRecoverable
- FakeStore
- FakeToken
- FakeUniswapPair
- FakeUniswapV2FactoryLike
- FakeUniswapV2PairLike
- FakeUniswapV2RouterLike
- FaultyAaveLendingPool
- FaultyCompoundDaiDelegator
- 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
- InvalidStrategy
- IPausable
- IPolicy
- IPolicyAdmin
- IPriceDiscovery
- IProtocol
- IRecoverable
- IReporter
- IResolution
- IResolvable
- IStakingPools
- IStore
- IStoreLike
- IUniswapV2FactoryLike
- IUniswapV2PairLike
- IUniswapV2RouterLike
- IUnstakable
- IVault
- IVaultDelegate
- IVaultFactory
- IWitness
- LiquidityEngine
- MaliciousToken
- MockAccessControlUser
- MockCoverUtilUser
- MockCxToken
- MockCxTokenPolicy
- MockCxTokenStore
- MockFlashBorrower
- MockProcessorStore
- MockProcessorStoreLib
- MockProtocol
- MockRegistryClient
- MockStore
- MockStoreKeyUtilUser
- MockValidationLibUser
- MockVault
- MockVaultLibUser
- NPM
- NPMDistributor
- NTransferUtilV2
- NTransferUtilV2Intermediate
- Ownable
- Pausable
- Policy
- PolicyAdmin
- PolicyHelperV1
- PoorMansERC20
- PriceDiscovery
- 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