// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.2; interface IBundle { event LogBundleCreated( uint256 bundleId, uint256 riskpoolId, address owner, BundleState state, uint256 amount ); event LogBundleStateChanged(uint256 bundleId, BundleState oldState, BundleState newState); event LogBundleCapitalProvided(uint256 bundleId, address sender, uint256 amount, uint256 capacity); event LogBundleCapitalWithdrawn(uint256 bundleId, address recipient, uint256 amount, uint256 capacity); event LogBundlePolicyCollateralized(uint256 bundleId, bytes32 processId, uint256 amount, uint256 capacity); event LogBundlePayoutProcessed(uint256 bundleId, bytes32 processId, uint256 amount); event LogBundlePolicyReleased(uint256 bundleId, bytes32 processId, uint256 amount, uint256 capacity); enum BundleState { Active, Locked, Closed, Burned } struct Bundle { uint256 id; uint256 riskpoolId; uint256 tokenId; BundleState state; bytes filter; // required conditions for applications to be considered for collateralization by this bundle uint256 capital; // net investment capital amount (<= balance) uint256 lockedCapital; // capital amount linked to collateralizaion of non-closed policies (<= capital) uint256 balance; // total amount of funds: net investment capital + net premiums - payouts uint256 createdAt; uint256 updatedAt; } function create(address owner_, uint256 riskpoolId_, bytes calldata filter_, uint256 amount_) external returns(uint256 bundleId); function fund(uint256 bundleId, uint256 amount) external; function defund(uint256 bundleId, uint256 amount) external; function lock(uint256 bundleId) external; function unlock(uint256 bundleId) external; function close(uint256 bundleId) external; function burn(uint256 bundleId) external; function collateralizePolicy(uint256 bundleId, bytes32 processId, uint256 collateralAmount) external; function processPremium(uint256 bundleId, bytes32 processId, uint256 amount) external; function processPayout(uint256 bundleId, bytes32 processId, uint256 amount) external; function releasePolicy(uint256 bundleId, bytes32 processId) external returns(uint256 collateralAmount); }