IPolicyHolder
Interface for any contract that wants to be a holder of Ensuro Policies and receive the payouts
Public Functions
onPolicyExpired
function onPolicyExpired(address operator, address from, uint256 policyId) external returns (bytes4)
_Whenever an Policy is expired or resolved with payout = 0, this function is called
It should return its Solidity selector to confirm the payout. If interface is not implemented by the recipient, it will be ignored and the payout will be successful. No mather what's the return value or even if this function reverts, this function will not revert the policy expiration.
The selector can be obtained in Solidity with IPolicyHolder.onPolicyExpired.selector._
onPayoutReceived
function onPayoutReceived(address operator, address from, uint256 policyId, uint256 amount) external returns (bytes4)
_Whenever an Policy is resolved with payout > 0, this function is called
It must return its Solidity selector to confirm the payout. If interface is not implemented by the recipient, it will be ignored and the payout will be successful. If any other value is returned or it reverts, the policy resolution / payout will be reverted.
The selector can be obtained in Solidity with IPolicyHolder.onPayoutReceived.selector._
onPolicyReplaced
function onPolicyReplaced(address operator, address from, uint256 oldPolicyId, uint256 newPolicyId) external returns (bytes4)
_Whenever a policy is replaced, this function is called
It must return its Solidity selector to confirm the operation. If interface is not implemented by the recipient, it will be ignored and the replacement will be successful. If any other value is returned or it reverts, the policy replacement will be reverted.
The selector can be obtained in Solidity with IPolicyHolder.onPolicyReplaced.selector._
onPolicyCancelled
function onPolicyCancelled(address operator, address from, uint256 cancelledPolicyId, uint256 purePremiumRefund, uint256 jrCocRefund, uint256 srCocRefund) external returns (bytes4)
_Whenever a policy is cancelled, this function is called
It must return its Solidity selector to confirm the operation. If interface is not implemented by the recipient, it will be ignored and the cancellation will be successful. If any other value is returned or it reverts, the policy cancellation will be reverted.
The selector can be obtained in Solidity with IPolicyHolder.onPolicyCancelled.selector._