/** * Asserts that a debt order meets all consensuality requirements * described in the DebtKernel specification document. */ function assertDebtOrderConsensualityInvariants( DebtOrder debtOrder, address creditor, uint8[3] signaturesV, bytes32[3] signaturesR, bytes32[3] signaturesS ) internal returns (bool _orderIsConsensual) { // Invariant: debtor's signature must be valid, unless debtor is submitting order if (msg.sender != debtOrder.issuance.debtor) { if (!isValidSignature( debtOrder.issuance.debtor, debtOrder.debtOrderHash, signaturesV[0], signaturesR[0], signaturesS[0] )) { LogError(uint8(Errors.ORDER_INVALID_NON_CONSENSUAL), debtOrder.debtOrderHash); return false; } } // Invariant: creditor's signature must be valid, unless creditor is submitting order if (msg.sender != creditor) { if (!isValidSignature( creditor, debtOrder.debtOrderHash, signaturesV[1], signaturesR[1], signaturesS[1] )) { LogError(uint8(Errors.ORDER_INVALID_NON_CONSENSUAL), debtOrder.debtOrderHash); return false; } } // Invariant: underwriter's signature must be valid (if present) if (debtOrder.issuance.underwriter != address(0) && msg.sender != debtOrder.issuance.underwriter) { if (!isValidSignature( debtOrder.issuance.underwriter, getUnderwriterMessageHash(debtOrder), signaturesV[2], signaturesR[2], signaturesS[2] )) { LogError(uint8(Errors.ORDER_INVALID_NON_CONSENSUAL), debtOrder.debtOrderHash); return false; } } return true; }
0.4.18