FullSignedUW
Underwriter that just decodes what it receives and checks it was signed by an authorized account. The signer needs to have the specific selectors granted in the target RM
Variables
FULL_PRICE_NEW_POLICY
bytes4 FULL_PRICE_NEW_POLICY
FULL_PRICE_REPLACE_POLICY
bytes4 FULL_PRICE_REPLACE_POLICY
FULL_PRICE_CANCEL_POLICY
bytes4 FULL_PRICE_CANCEL_POLICY
Errors
UnauthorizedSigner
error UnauthorizedSigner(address signer, bytes4 selector)
Thrown when the recovered signer is not authorized to perform the requested pricing operation on rm.
selector is the permission/role identifier checked through the RM's AccessManager (one of FULL_PRICE_*).
Parameters
| Name | Type | Description |
|---|---|---|
| signer | address | The address recovered from the appended ECDSA signature. |
| selector | bytes4 | The required permission/role id for the operation. |
InvalidInputSize
error InvalidInputSize(uint256 actual, uint256 expected)
Thrown when inputData does not have the expected length: payload || signature.
The signature is expected to be exactly 65 bytes, so inputData.length must be inputSize + 65.
Parameters
| Name | Type | Description |
|---|---|---|
| actual | uint256 | The actual length of inputData in bytes. |
| expected | uint256 | The expected length of inputData in bytes. |
SignatureRmMismatch
error SignatureRmMismatch()
Thrown when the received signature doesn't match the calling rm
Public Functions
priceNewPolicy
function priceNewPolicy(address rm, bytes inputData) external view returns (uint256 payout, uint256 premium, uint256 lossProb, uint40 expiration, uint96 internalId, struct Policy.Params params)
Prices a new policy request for RiskModule rm.
Parameters
| Name | Type | Description |
|---|---|---|
| rm | address | The RiskModule address requesting pricing (implementations may use it for access checks). |
| inputData | bytes | Opaque payload consumed by the Underwriter implementation. |
Return Values
| Name | Type | Description |
|---|---|---|
| payout | uint256 | The policy payout. |
| premium | uint256 | The total premium for the policy. |
| lossProb | uint256 | Loss probability used for pricing/risk calculations. |
| expiration | uint40 | Policy expiration timestamp (seconds since epoch). |
| internalId | uint96 | Unique id within rm used to derive the policy id. |
| params | struct Policy.Params | Additional policy parameters used by {Policy-initialize}. |
Pre-conditions
inputDatamust follow the ABI/layout expected by the concrete Underwriter implementation.- The caller must satisfy any access/authentication requirements imposed by the implementation.
pricePolicyReplacement
function pricePolicyReplacement(address rm, bytes inputData) external view returns (struct Policy.PolicyData oldPolicy, uint256 payout, uint256 premium, uint256 lossProb, uint40 expiration, uint96 internalId, struct Policy.Params params)
Prices a policy replacement request for RiskModule rm.
Parameters
| Name | Type | Description |
|---|---|---|
| rm | address | The RiskModule address requesting pricing (implementations may use it for access checks). |
| inputData | bytes | Opaque payload consumed by the Underwriter implementation. |
Return Values
| Name | Type | Description |
|---|---|---|
| oldPolicy | struct Policy.PolicyData | The policy being replaced (as {Policy-PolicyData}). |
| payout | uint256 | The replacement policy payout. |
| premium | uint256 | The replacement policy premium. |
| lossProb | uint256 | Loss probability used for pricing/risk calculations. |
| expiration | uint40 | Replacement policy expiration timestamp. |
| internalId | uint96 | Unique id within rm for the replacement policy. |
| params | struct Policy.Params | Additional policy parameters used by {Policy-initialize}. |
Pre-conditions
inputDatamust follow the ABI/layout expected by the concrete Underwriter implementation.- The caller must satisfy any access/authentication requirements imposed by the implementation.
pricePolicyCancellation
function pricePolicyCancellation(address rm, bytes inputData) external view returns (struct Policy.PolicyData policyToCancel, uint256 purePremiumRefund, uint256 jrCocRefund, uint256 srCocRefund)
Prices a policy cancellation request for RiskModule rm.
Parameters
| Name | Type | Description |
|---|---|---|
| rm | address | The RiskModule address requesting pricing (implementations may use it for access checks). |
| inputData | bytes | Opaque payload consumed by the Underwriter implementation. |
Return Values
| Name | Type | Description |
|---|---|---|
| policyToCancel | struct Policy.PolicyData | The policy to cancel (as {Policy-PolicyData}). |
| purePremiumRefund | uint256 | Amount to refund from pure premium. |
| jrCocRefund | uint256 | Amount to refund from junior CoC (or a sentinel value, if supported). |
| srCocRefund | uint256 | Amount to refund from senior CoC (or a sentinel value, if supported). |
Pre-conditions
inputDatamust follow the ABI/layout expected by the concrete Underwriter implementation.- The caller must satisfy any access/authentication requirements imposed by the implementation.
Private Functions
_checkSignature
function _checkSignature(address rm, bytes inputData, uint256 inputSize, bytes4 requiredRole) internal view
Validates the signature appended to inputData and checks the recovered signer is authorized in rm.
Parameters
| Name | Type | Description |
|---|---|---|
| rm | address | Target RiskModule (must be an {AccessManagedProxy}). |
| inputData | bytes | Concatenated bytes: payload || signature. |
| inputSize | uint256 | Expected length of the payload portion (without signature). |
| requiredRole | bytes4 | Role/selector id required for this operation (one of the FULL_PRICE_* constants). |
Pre-conditions
inputDatais exactlyinputSize + 65bytes long.rmis an {AccessManagedProxy} instance whoseACCESS_MANAGER()supportscanCall(...).
Throws
- InvalidInputSize
- if `inputData.length != inputSize + 65`.
- (via
- {ECDSA-recover}) if the signature is malformed/invalid.
- UnauthorizedSigner
- if the recovered signer is not permitted to call `rm` with `requiredRole`.