Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion contracts/abstract/RegistryAware.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ uint constant PAUSE_RAMM = 1 << 1; // 2
uint constant PAUSE_SWAPS = 1 << 2; // 4
uint constant PAUSE_MEMBERSHIP = 1 << 3; // 8
uint constant PAUSE_ASSESSMENTS = 1 << 4; // 16
uint constant PAUSE_CLAIMS_PAYOUT = 1 << 5; // 32
uint constant PAUSE_CLAIM_PAYOUTS = 1 << 5; // 32

contract RegistryAware {

IRegistry public immutable registry;

error Paused(uint currentState, uint checks);
error Unauthorized(address caller, uint callerIndex, uint authorizedBitmap);
error OnlyMember();

modifier whenNotPaused(uint mask) {
uint config = registry.getPauseConfig();
Expand All @@ -55,6 +56,11 @@ contract RegistryAware {
_;
}

modifier onlyMember() {
require(registry.isMember(msg.sender), OnlyMember());
_;
}

// TODO: find a better short name for this function
function fetch(uint index) internal view returns (address) {
return registry.getContractAddressByIndex(index);
Expand Down
15 changes: 12 additions & 3 deletions contracts/interfaces/IAssessment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface IAssessment {
struct AssessmentData {
uint16 assessingGroupId;
uint32 cooldownPeriod;
uint32 payoutRedemptionPeriod;
}

struct AssessmentGroupView {
Expand All @@ -22,6 +23,7 @@ interface IAssessment {
struct Assessment {
uint16 assessingGroupId;
uint32 cooldownPeriod;
uint32 payoutRedemptionPeriod;
uint32 start;
uint32 votingEnd;
uint8 acceptVotes;
Expand Down Expand Up @@ -49,6 +51,7 @@ interface IAssessment {
function setAssessmentDataForProductTypes(
uint[] calldata productTypeIds,
uint cooldownPeriod,
uint redemptionPeriod,
uint groupId
) external;

Expand Down Expand Up @@ -82,7 +85,9 @@ interface IAssessment {

function payoutCooldown(uint productTypeId) external view returns (uint);

function getAssessmentResult(uint claimId) external view returns(uint cooldownEnd, AssessmentStatus status);
function getAssessmentDataForProductType(uint productTypeId) external view returns (AssessmentData memory assessmentData);

function getAssessmentResult(uint claimId) external view returns(AssessmentStatus status, uint payoutRedemptionPeriod, uint cooldownEnd);

function ballotOf(uint claimId, uint assessorMemberId) external view returns (Ballot memory);

Expand All @@ -92,7 +97,12 @@ interface IAssessment {

/* ========= EVENTS ========== */

event AssessmentDataForProductTypesSet(uint[] productTypeIds, uint cooldownPeriod, uint groupId);
event AssessmentDataForProductTypeSet(
uint indexed productTypeId,
uint indexed groupId,
uint cooldownPeriod,
uint payoutRedemptionPeriod
);
event AssessorAddedToGroup(uint indexed groupId, uint assessorMemberId);
event AssessorRemovedFromGroup(uint indexed groupId, uint assessorMemberId);
event GroupMetadataSet(uint indexed groupId, bytes32 ipfsMetadata);
Expand Down Expand Up @@ -127,7 +137,6 @@ interface IAssessment {
error InvalidGroupId();
error InvalidMemberId();
error InvalidProductType();
error OnlyMember();
error VotingPeriodEnded();
error AssessmentCooldownPassed(uint claimId);
error HasNotVoted(uint claimId);
Expand Down
6 changes: 2 additions & 4 deletions contracts/interfaces/IClaims.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ interface IClaims {
uint assessmentVotingEnd;
uint assessmentCooldownEnd;
uint assessmentStatus;
uint payoutRedemptionEnd;
bool payoutRedeemed;
}

/* ========== VIEWS ========== */

function getClaimInfo(uint claimId) external view returns (Claim memory);

function getPayoutRedemptionPeriod() external view returns (uint);

function getClaimsCount() external view returns (uint);

/* === MUTATIVE FUNCTIONS ==== */
Expand All @@ -69,7 +68,7 @@ interface IClaims {
error ClaimIsBeingAssessed();
error PayoutCanStillBeRedeemed();
error ClaimAlreadyPaidOut();
error OnlyOwnerOrApprovedCanSubmitClaim();
error NotCoverOwner();
error InvalidClaimMethod();
error CoveredAmountExceeded();
error CantBuyCoverAndClaimInTheSameBlock();
Expand All @@ -80,7 +79,6 @@ interface IClaims {
error RedemptionPeriodExpired();
error PayoutAlreadyRedeemed();
error DepositAlreadyRetrieved();
error OnlyMember();
error InvalidClaimId();
error AlreadyInitialized();
}
1 change: 0 additions & 1 deletion contracts/interfaces/IGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ interface IGovernor {
error AlreadyAdvisoryBoardMember();
error OnlyAdvisoryBoardMember();
error OnlyGovernor();
error OnlyMember();
error NotMember();
error NotAuthorizedToVote();

Expand Down
101 changes: 0 additions & 101 deletions contracts/interfaces/IIndividualClaims.sol

This file was deleted.

1 change: 0 additions & 1 deletion contracts/interfaces/IMemberRolesErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ interface IMemberRolesErrors {
error SignatureAlreadyUsed();
error InvalidSignature();
error TransferToPoolFailed();
error OnlyMember();
error LockedForVoting();
error CantBeStakingPoolManager();
error HasNXMStakedInClaimAssessmentV1();
Expand Down
8 changes: 6 additions & 2 deletions contracts/mocks/generic/AssessmentGeneric.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract AssessmentGeneric is IAssessment {
revert("Unsupported");
}

function setAssessmentDataForProductTypes(uint[] calldata, uint, uint) external virtual {
function setAssessmentDataForProductTypes(uint[] calldata, uint, uint, uint) external virtual {
revert("Unsupported");
}

Expand Down Expand Up @@ -99,7 +99,11 @@ contract AssessmentGeneric is IAssessment {
revert("Unsupported");
}

function getAssessmentResult(uint) external virtual view returns (uint, AssessmentStatus) {
function getAssessmentDataForProductType(uint) external virtual view returns (AssessmentData memory) {
revert("Unsupported");
}

function getAssessmentResult(uint) external virtual view returns (AssessmentStatus, uint, uint) {
revert("Unsupported");
}

Expand Down
37 changes: 0 additions & 37 deletions contracts/mocks/generic/IndividualClaimsGeneric.sol

This file was deleted.

9 changes: 3 additions & 6 deletions contracts/mocks/modules/Assessment/ASMockClaims.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,11 @@ contract ASMockClaims is IClaims, RegistryAware {
return _claims[claimId];
}

function getPayoutRedemptionPeriod() external override pure returns (uint) {
return PAYOUT_REDEMPTION_PERIOD;
}

/* ========== MUTATIVE FUNCTIONS ========== */

/// @notice Simplified submit claim for testing
/// @dev Calls assessment.startAssessment and stores the claim
/// @dev productTypeId is set to coverId for testing
function submitClaim(
uint32 coverId,
uint96 requestedAmount,
Expand All @@ -62,8 +59,8 @@ contract ASMockClaims is IClaims, RegistryAware {
uint claimId = _nextClaimId++;
lastClaimSubmissionOnCover[coverId] = claimId;

// For testing, use a simple product type ID
uint16 productTypeId = 1;
// For testing, set product type id to coverId
uint16 productTypeId = uint16(coverId);

// Start the assessment
_assessment().startAssessment(claimId, productTypeId);
Expand Down
12 changes: 7 additions & 5 deletions contracts/mocks/modules/Claims/CLMockAssessment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ import "../../generic/AssessmentGeneric.sol";

contract CLMockAssessment is AssessmentGeneric {

mapping(uint claimId => uint) public _cooldown;
mapping(uint claimId => AssessmentStatus) public _status;
mapping(uint claimId => uint) public _payoutRedemptionEnd;
mapping(uint claimId => uint) public _cooldownEnd;
mapping(uint claimId => uint) public _productTypeForClaimId;

function startAssessment(uint claimId, uint productTypeId) external override {
_productTypeForClaimId[claimId] = productTypeId;
}

function getAssessmentResult(uint claimId) external override view returns (uint, AssessmentStatus) {
return(_cooldown[claimId], _status[claimId]);
function getAssessmentResult(uint claimId) external override view returns (AssessmentStatus, uint, uint) {
return(_status[claimId], _payoutRedemptionEnd[claimId], _cooldownEnd[claimId]);
}

function setAssessmentResult(uint claimId, uint cooldown, AssessmentStatus status) external {
_cooldown[claimId] = cooldown;
function setAssessmentResult(uint claimId, AssessmentStatus status, uint payoutRedemptionEnd, uint cooldownEnd) external {
_status[claimId] = status;
_payoutRedemptionEnd[claimId] = payoutRedemptionEnd;
_cooldownEnd[claimId] = cooldownEnd;
}

}
Loading
Loading