Pool
Contains interfaces and contracts related to pools.
Contracts
IPoolComponent
import "@etherisc/gif-next/contracts/pool/IPoolComponent.sol";
pool components hold and manage the collateral to cover active policies pools come in different flavors
-
[
verifyApplication(applicationNftId, bundleNftId, collateralizationAmount)
] -
[
applicationMatchesBundle(applicationNftId, applicationData, bundleNftId, bundleFilter, collateralizationAmount)
] -
[
processConfirmedClaim(policyNftId, claimId, amount)
] -
[
getInitialPoolInfo()
]
-
[
withdrawFees(amount)
] -
[
getInstance()
]
-
[
getAuthorization()
]
-
[
getName()
] -
[
getToken()
] -
[
getTokenHandler()
] -
[
getWallet()
] -
[
isNftInterceptor()
] -
[
isRegistered()
] -
[
getComponentInfo()
] -
[
getInitialComponentInfo()
]
-
[
nftTransferFrom(from, to, tokenId, operator)
]
-
[
isActive()
] -
[
getInitialInfo()
]
-
[
getRelease()
]
-
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
]
-
[
getRegistry()
]
-
[
supportsInterface(interfaceId)
]
-
[
authority()
] -
[
setAuthority()
] -
[
isConsumingScheduledOp()
]
-
[
LogPoolVerifiedByPool(pool, applicationNftId, collateralizationAmount)
]
-
[
LogComponentWalletAddressChanged(oldWallet, newWallet)
] -
[
LogComponentWalletTokensTransferred(from, to, amount)
] -
[
LogComponentTokenHandlerApproved(tokenHandler, token, limit, isMaxAmount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
verifyApplication(NftId applicationNftId, NftId bundleNftId, Amount collateralizationAmount)
external
This is a callback function that is called by the product service when underwriting a policy. The pool has the option to check the details and object to underwriting by reverting. The function is only called for "active" pools that ask to be involved/notified. The default implementation is empty.
applicationMatchesBundle(NftId applicationNftId, bytes applicationData, NftId bundleNftId, bytes bundleFilter, Amount collateralizationAmount) → bool isMatching
external
Returns true iff the application matches with the bundle. This is a callback function that is only called if a pool declares itself as a verifying pool The default implementation returns true.
processConfirmedClaim(NftId policyNftId, ClaimId claimId, Amount amount)
external
This is a callback function that is called by the claim service when a claim is confirmed. The pool has the option to implement custom behavirous such as triggering a reinsurance claim or blocking the claim confirmaation. The default implementation is empty.
IPoolService
import "@etherisc/gif-next/contracts/pool/IPoolService.sol";
-
[
setMaxBalanceAmount(maxBalanceAmount)
] -
[
lockCollateral(instance, token, productNftId, applicationNftId, bundleNftId, sumInsuredAmount)
] -
[
releaseCollateral(instance, policyNftId, policyInfo)
] -
[
processPayout(instanceReader, instanceStore, productNftId, policyNftId, bundleNftId, payoutId, payoutAmount, payoutBeneficiary)
] -
[
stake(bundleNftId, amount)
] -
[
unstake(bundleNftId, amount)
] -
[
closeBundle(bundleNftId)
] -
[
withdrawBundleFees(bundleNftId, amount)
] -
[
processFundedClaim(policyNftId, claimId, availableAmount)
] -
[
fundPoolWallet(amount)
] -
[
defundPoolWallet(amount)
] -
[
processSale(bundleNftId, premium)
]
-
[
getDomain()
] -
[
getRoleId()
]
-
[
initializeVersionable(activatedBy, activationData)
] -
[
upgradeVersionable(upgradeData)
] -
[
getVersion()
]
-
[
isActive()
] -
[
getInitialInfo()
]
-
[
getRelease()
]
-
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
]
-
[
getRegistry()
]
-
[
supportsInterface(interfaceId)
]
-
[
authority()
] -
[
setAuthority()
] -
[
isConsumingScheduledOp()
]
-
[
LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxCapitalAmount, currentMaxCapitalAmount)
] -
[
LogPoolServiceWalletFunded(poolNftId, poolOwner, amount)
] -
[
LogPoolServiceWalletDefunded(poolNftId, poolOwner, amount)
] -
[
LogPoolServiceBundleCreated(instanceNftId, poolNftId, bundleNftId)
] -
[
LogPoolServiceBundleClosed(instanceNftId, poolNftId, bundleNftId)
] -
[
LogPoolServiceBundleStaked(instanceNftId, poolNftId, bundleNftId, amount, netAmount)
] -
[
LogPoolServiceBundleUnstaked(instanceNftId, poolNftId, bundleNftId, amount, netAmount)
] -
[
LogPoolServiceFeesWithdrawn(bundleNftId, recipient, tokenAddress, amount)
] -
[
LogPoolServiceProcessFundedClaim(policyNftId, claimId, availableAmount)
] -
[
LogPoolServiceApplicationVerified(poolNftId, bundleNftId, applicationNftId, totalCollateralAmount)
] -
[
LogPoolServiceCollateralLocked(poolNftId, bundleNftId, applicationNftId, totalCollateralAmount, lockedCollateralAmount)
] -
[
LogPoolServiceCollateralReleased(bundleNftId, policyNftId, remainingCollateralAmount)
] -
[
LogPoolServiceSaleProcessed(poolNftId, bundleNftId, bundleNetAmount, bundleFeeAmount, poolFeeAmount)
] -
[
LogPoolServicePayoutProcessed(poolNftId, bundleNftId, policyNftId, payoutId, netPayoutAmount, processingFeeAmount, payoutBeneficiary)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
setMaxBalanceAmount(Amount maxBalanceAmount)
external
sets the max balance amount for the calling pool
lockCollateral(contract IInstance instance, address token, NftId productNftId, NftId applicationNftId, NftId bundleNftId, Amount sumInsuredAmount) → Amount localCollateralAmount, Amount totalCollateralAmount
external
locks required collateral to cover the specified application (and turn it into a policy) - retention level == 1: the full collateral amount will be locked by the specified bundle - retention level < 1: a part of the coverage is provided by the specified bundle, the rest by the pool component in which case the pool component might hold a re-insurance policy may only be called by the policy service for unlocked pool components
releaseCollateral(contract IInstance instance, NftId policyNftId, struct IPolicy.PolicyInfo policyInfo)
external
releases the remaining collateral linked to the specified policy may only be called by the policy service for unlocked pool components
processPayout(contract InstanceReader instanceReader, contract InstanceStore instanceStore, NftId productNftId, NftId policyNftId, NftId bundleNftId, PayoutId payoutId, Amount payoutAmount, address payoutBeneficiary) → Amount netPayoutAmount, Amount processingFeeAmount
external
reduces the locked collateral in the bundle associated with the specified policy and updates pool/bundle counters every payout of a policy reduces the collateral by the payout amount may only be called by the claim service for unlocked pool components
stake(NftId bundleNftId, Amount amount) → Amount netAmount
external
increase stakes for bundle staking fees will be deducted by the pool service from the staking amount may only be called by registered and unlocked pool components
unstake(NftId bundleNftId, Amount amount) → Amount netAmount
external
decrease stakes for bundle performance fees will be deducted by the pool service from the staking amount may only be called by registered and unlocked pool components
closeBundle(NftId bundleNftId)
external
closes the specified bundle only open bundles (active or locked) may be closed to close a bundle it may not have any non-closed polices attached to it bundle fees and remaining capital (after deduction of the performance fee) will be transferred to the bundle owner may only be called by registered and unlocked pool components
withdrawBundleFees(NftId bundleNftId, Amount amount) → Amount withdrawnAmount
external
Withdraw bundle feeds for the specified bundle.
processFundedClaim(NftId policyNftId, ClaimId claimId, Amount availableAmount)
external
Informs product about available funds to process a confirmed claim. The function triggers a callback to the product component when the product’s property isProcessingFundedClaims is set.
fundPoolWallet(Amount amount)
external
Fund the pool wallet with the provided amount. This function will collect the amount from the pool owner and transfers it to the pool wallet. The function will not update balance amounts managed by the framework. Only available for externally managed pools.
defundPoolWallet(Amount amount)
external
Defund the specified pool wallet with the provided amount. This function will transfer the amount from the pool wallet to the pool owner. The function will not update balance amounts managed by the framework. Only available for externally managed pools.
processSale(NftId bundleNftId, struct IPolicy.PremiumInfo premium)
external
processes the sale of a bundle and track the pool fee and bundle fee amounts
LogPoolServiceMaxBalanceAmountUpdated(NftId poolNftId, Amount previousMaxCapitalAmount, Amount currentMaxCapitalAmount)
event
LogPoolServiceBundleStaked(NftId instanceNftId, NftId poolNftId, NftId bundleNftId, Amount amount, Amount netAmount)
event
LogPoolServiceBundleUnstaked(NftId instanceNftId, NftId poolNftId, NftId bundleNftId, Amount amount, Amount netAmount)
event
LogPoolServiceFeesWithdrawn(NftId bundleNftId, address recipient, address tokenAddress, Amount amount)
event
LogPoolServiceApplicationVerified(NftId poolNftId, NftId bundleNftId, NftId applicationNftId, Amount totalCollateralAmount)
event
LogPoolServiceCollateralLocked(NftId poolNftId, NftId bundleNftId, NftId applicationNftId, Amount totalCollateralAmount, Amount lockedCollateralAmount)
event
LogPoolServiceCollateralReleased(NftId bundleNftId, NftId policyNftId, Amount remainingCollateralAmount)
event
IBundleService
import "@etherisc/gif-next/contracts/pool/IBundleService.sol";
-
[
create(owner, fee, lifetime, filter)
] -
[
stake(instanceReader, instanceStore, bundleNftId, amount)
] -
[
unstake(instanceStore, bundleNftId, amount)
] -
[
extend(bundleNftId, lifetimeExtension)
] -
[
setLocked(bundleNftId, locked)
] -
[
close(instance, bundleNftId)
] -
[
setFee(bundleNftId, fee)
] -
[
lockCollateral(instance, policyNftId, bundleNftId, collateralAmount)
] -
[
releaseCollateral(instanceStore, policyNftId, bundleNftId, collateralAmount)
]
-
[
getDomain()
] -
[
getRoleId()
]
-
[
initializeVersionable(activatedBy, activationData)
] -
[
upgradeVersionable(upgradeData)
] -
[
getVersion()
]
-
[
isActive()
] -
[
getInitialInfo()
]
-
[
getRelease()
]
-
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
]
-
[
getRegistry()
]
-
[
supportsInterface(interfaceId)
]
-
[
authority()
] -
[
setAuthority()
] -
[
isConsumingScheduledOp()
]
-
[
LogBundleServiceBundleCreated(bundleNftId, poolNftId, lifetime)
] -
[
LogBundleServiceBundleClosed(bundleNftId)
] -
[
LogBundleServiceBundleLocked(bundleNftId)
] -
[
LogBundleServiceBundleUnlocked(bundleNftId)
] -
[
LogBundleServiceBundleExtended(bundleNftId, lifetimeExtension, extendedExpiredAt)
] -
[
LogBundleServiceBundleFeeUpdated(bundleNftId, fixedFee, fractionalFee)
] -
[
LogBundleServiceCollateralLocked(bundleNftId, policyNftId, collateralAmount)
] -
[
LogBundleServiceCollateralReleased(bundleNftId, policyNftId, collateralAmount)
] -
[
LogBundleServiceBundleStaked(bundleNftId, amount)
] -
[
LogBundleServiceBundleUnstaked(bundleNftId, amount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
create(address owner, struct Fee fee, Seconds lifetime, bytes filter) → NftId bundleNftId
external
Create a new bundle for the specified attributes.
stake(contract InstanceReader instanceReader, contract InstanceStore instanceStore, NftId bundleNftId, Amount amount)
external
increase bundle stakes by the specified amount. bundle must not be expired or closed may only be called by the pool service
unstake(contract InstanceStore instanceStore, NftId bundleNftId, Amount amount) → Amount unstakedAmount
external
decrease bundle stakes by the specified amount may only be called by the pool service
extend(NftId bundleNftId, Seconds lifetimeExtension) → Timestamp extendedExpiredAt
external
extend the lifetime of the bundle by the specified time in seconds
setLocked(NftId bundleNftId, bool locked)
external
locks/unlocks the specified bundle. locked bundles are not available to collateralize new policies. may only be called by registered and unlocked pool components.
close(contract IInstance instance, NftId bundleNftId) → Amount balanceAmount, Amount feeAmount
external
closes the specified bundle only open bundles (active or locked) may be closed to close a bundle it may not have any non-closed polices attached to it may only be called by registered and unlocked pool components
setFee(NftId bundleNftId, struct Fee fee)
external
set bundle fee to provided value may only be called by registered and unlocked pool components
lockCollateral(contract IInstance instance, NftId policyNftId, NftId bundleNftId, Amount collateralAmount)
external
locks the specified collateral in the bundle the locked collateral is added to the bundle locked capital the bundles' fees are updated with the fees for this premium the premium (minus bundle fee) is added to the bundle capital may only be called by pool service
releaseCollateral(contract InstanceStore instanceStore, NftId policyNftId, NftId bundleNftId, Amount collateralAmount)
external
releases the specified collateral in the bundle may only be called by pool service
LogBundleServiceBundleExtended(NftId bundleNftId, Seconds lifetimeExtension, Timestamp extendedExpiredAt)
event
LogBundleServiceCollateralLocked(NftId bundleNftId, NftId policyNftId, Amount collateralAmount)
event
Pool
import "@etherisc/gif-next/contracts/pool/Pool.sol";
-
[
getContractLocation(name)
] -
[
verifyApplication(applicationNftId, bundleNftId, collateralizationAmount)
] -
[
processConfirmedClaim(policyNftId, claimId, amount)
] -
[
applicationMatchesBundle(applicationNftId, applicationData, bundleNftId, bundleFilter, collateralizationAmount)
] -
[
getInitialPoolInfo()
] -
[
__Pool_init(registry, productNftId, name, poolInfo, authorization, initialOwner)
] -
[
_setPoolFees(poolFee, stakingFee, performanceFee)
] -
[
_setMaxBalanceAmount(maxBalanceAmount)
] -
[
_fundPoolWallet(amount)
] -
[
_defundPoolWallet(amount)
] -
[
_createBundle(bundleOwner, fee, lifetime, filter)
] -
[
_setBundleFee(bundleNftId, fee)
] -
[
_stake(bundleNftId, amount)
] -
[
_unstake(bundleNftId, amount)
] -
[
_extend(bundleNftId, lifetimeExtension)
] -
[
_setBundleLocked(bundleNftId, locked)
] -
[
_closeBundle(bundleNftId)
] -
[
_withdrawBundleFees(bundleNftId, amount)
] -
[
_processFundedClaim(policyNftId, claimId, availableAmount)
]
-
[
getInstance()
] -
[
getAuthorization()
] -
[
withdrawFees(amount)
] -
[
_sendRequest(oracleNftId, requestData, expiryAt, callbackMethod)
] -
[
_cancelRequest(requestId)
] -
[
_resendRequest(requestId)
] -
[
__InstanceLinkedComponent_init(registry, parentNftId, name, componentType, authorization, isInterceptor, initialOwner)
] -
[
_checkAndGetInstanceNftId(registryAddress, parentNftId, componentType)
] -
[
_checkAndGetRegistry(registryAddress, objectNftId, requiredType)
] -
[
_setWallet(newWallet)
] -
[
_getComponentInfo()
] -
[
_getInstanceReader()
] -
[
_withdrawFees(amount)
]
-
[
__Component_init(authority, registry, parentNftId, name, componentType, isInterceptor, initialOwner, registryData)
] -
[
nftTransferFrom(from, to, tokenId, operator)
] -
[
getWallet()
] -
[
getTokenHandler()
] -
[
getToken()
] -
[
getName()
] -
[
getVersion()
] -
[
getComponentInfo()
] -
[
getInitialComponentInfo()
] -
[
isNftInterceptor()
] -
[
isRegistered()
] -
[
_approveTokenHandler(token, amount)
] -
[
_nftTransferFrom(from, to, tokenId, operator)
] -
[
_setLocked(locked)
] -
[
_getServiceAddress(domain)
]
-
[
__Registerable_init(authority, registry, parentNftId, objectType, isInterceptor, initialOwner, data)
] -
[
isActive()
] -
[
getRelease()
] -
[
getInitialInfo()
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
__AccessManaged_init(initialAuthority)
] -
[
__AccessManaged_init_unchained(initialAuthority)
] -
[
authority()
] -
[
setAuthority(newAuthority)
] -
[
isConsumingScheduledOp()
] -
[
_setAuthority(newAuthority)
] -
[
_checkCanCall(caller, data)
]
-
[
__Context_init()
] -
[
__Context_init_unchained()
] -
[
_msgSender()
] -
[
_msgData()
] -
[
_contextSuffixLength()
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogPoolVerifiedByPool(pool, applicationNftId, collateralizationAmount)
]
-
[
LogComponentWalletAddressChanged(oldWallet, newWallet)
] -
[
LogComponentWalletTokensTransferred(from, to, amount)
] -
[
LogComponentTokenHandlerApproved(tokenHandler, token, limit, isMaxAmount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
verifyApplication(NftId applicationNftId, NftId bundleNftId, Amount collateralizationAmount)
public
see {IPoolComponent.verifyApplication}
processConfirmedClaim(NftId policyNftId, ClaimId claimId, Amount amount)
public
see {IPoolComponent.processConfirmedClaim}
applicationMatchesBundle(NftId applicationNftId, bytes applicationData, NftId bundleNftId, bytes bundleFilter, Amount collateralizationAmount) → bool isMatching
public
see {IPoolComponent.applicationMatchesBundle} Default implementation always returns true. Override this function to implement any custom application verification. Calling super.applicationMatchesBundle will ensure validation of application and bundle nft ids.
getInitialPoolInfo() → struct IComponents.PoolInfo poolInfo
public
Returns initial pool specific infos for this pool
__Pool_init(address registry, NftId productNftId, string name, struct IComponents.PoolInfo poolInfo, contract IAuthorization authorization, address initialOwner)
internal
_setPoolFees(struct Fee poolFee, struct Fee stakingFee, struct Fee performanceFee)
internal
Update pool fees to the specified values. Pool fee: are deducted from the premium amount and goes to the pool owner. Staking fee: are deducted from the staked tokens by a bundle owner and goes to the pool owner. Performance fee: when a bundle is closed a bundle specific profit is calculated. The performance fee is deducted from this profit and goes to the pool owner.
_setMaxBalanceAmount(Amount maxBalanceAmount)
internal
Sets the maximum balance amound held by this pool. Function may only be called by pool owner.
_fundPoolWallet(Amount amount)
internal
Fund the pool wallet with the specified amount. Function is only available for externally managed pools.
_defundPoolWallet(Amount amount)
internal
Withdraw the specified amount from the pool wallet. Function is only available for externally managed pools.
_createBundle(address bundleOwner, struct Fee fee, Seconds lifetime, bytes filter) → NftId bundleNftId
internal
Creates a new empty bundle using the provided parameter values.
_setBundleFee(NftId bundleNftId, struct Fee fee)
internal
Sets the fee for the specified bundle. The fee is added on top of the poolFee and deducted from the premium amounts Via these fees individual bundler owner may earn income per policy in the context of peer to peer pools.
_stake(NftId bundleNftId, Amount amount) → Amount
internal
increases the staked tokens by the specified amount bundle MUST be in active or locked state
_unstake(NftId bundleNftId, Amount amount) → Amount netAmount
internal
decreases the staked tokens by the specified amount bundle MUST be in active, locked or closed state
_extend(NftId bundleNftId, Seconds lifetimeExtension) → Timestamp extendedExpiredAt
internal
extends the bundle lifetime of the bundle by the specified time bundle MUST be in active or locked state
_setBundleLocked(NftId bundleNftId, bool locked)
internal
Locks the specified bundle. A bundle to be locked MUST be in active state. Locked bundles may not be used to collateralize any new policy.
_closeBundle(NftId bundleNftId)
internal
Close the specified bundle. A bundle to be closed MUST be in active or locked state. To close a bundle all all linked policies MUST be in closed state as well. Closing a bundle finalizes the bundle bookkeeping including overall profit calculation. Once a bundle is closed this action cannot be reversed.
BasicPool
import "@etherisc/gif-next/contracts/pool/BasicPool.sol";
-
[
_initializeBasicPool(registry, productNftId, name, poolInfo, authorization, initialOwner)
] -
[
stake(bundleNftId, amount)
] -
[
unstake(bundleNftId, amount)
] -
[
extend(bundleNftId, lifetimeExtension)
] -
[
setBundleLocked(bundleNftId, locked)
] -
[
closeBundle(bundleNftId)
] -
[
setBundleFee(bundleNftId, fee)
] -
[
withdrawBundleFees(bundleNftId, amount)
] -
[
setMaxBalanceAmount(maxBalanceAmount)
] -
[
setFees(poolFee, stakingFee, performanceFee)
]
-
[
getContractLocation(name)
] -
[
verifyApplication(applicationNftId, bundleNftId, collateralizationAmount)
] -
[
processConfirmedClaim(policyNftId, claimId, amount)
] -
[
applicationMatchesBundle(applicationNftId, applicationData, bundleNftId, bundleFilter, collateralizationAmount)
] -
[
getInitialPoolInfo()
] -
[
__Pool_init(registry, productNftId, name, poolInfo, authorization, initialOwner)
] -
[
_setPoolFees(poolFee, stakingFee, performanceFee)
] -
[
_setMaxBalanceAmount(maxBalanceAmount)
] -
[
_fundPoolWallet(amount)
] -
[
_defundPoolWallet(amount)
] -
[
_createBundle(bundleOwner, fee, lifetime, filter)
] -
[
_setBundleFee(bundleNftId, fee)
] -
[
_stake(bundleNftId, amount)
] -
[
_unstake(bundleNftId, amount)
] -
[
_extend(bundleNftId, lifetimeExtension)
] -
[
_setBundleLocked(bundleNftId, locked)
] -
[
_closeBundle(bundleNftId)
] -
[
_withdrawBundleFees(bundleNftId, amount)
] -
[
_processFundedClaim(policyNftId, claimId, availableAmount)
]
-
[
getInstance()
] -
[
getAuthorization()
] -
[
withdrawFees(amount)
] -
[
_sendRequest(oracleNftId, requestData, expiryAt, callbackMethod)
] -
[
_cancelRequest(requestId)
] -
[
_resendRequest(requestId)
] -
[
__InstanceLinkedComponent_init(registry, parentNftId, name, componentType, authorization, isInterceptor, initialOwner)
] -
[
_checkAndGetInstanceNftId(registryAddress, parentNftId, componentType)
] -
[
_checkAndGetRegistry(registryAddress, objectNftId, requiredType)
] -
[
_setWallet(newWallet)
] -
[
_getComponentInfo()
] -
[
_getInstanceReader()
] -
[
_withdrawFees(amount)
]
-
[
__Component_init(authority, registry, parentNftId, name, componentType, isInterceptor, initialOwner, registryData)
] -
[
nftTransferFrom(from, to, tokenId, operator)
] -
[
getWallet()
] -
[
getTokenHandler()
] -
[
getToken()
] -
[
getName()
] -
[
getVersion()
] -
[
getComponentInfo()
] -
[
getInitialComponentInfo()
] -
[
isNftInterceptor()
] -
[
isRegistered()
] -
[
_approveTokenHandler(token, amount)
] -
[
_nftTransferFrom(from, to, tokenId, operator)
] -
[
_setLocked(locked)
] -
[
_getServiceAddress(domain)
]
-
[
__Registerable_init(authority, registry, parentNftId, objectType, isInterceptor, initialOwner, data)
] -
[
isActive()
] -
[
getRelease()
] -
[
getInitialInfo()
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
__AccessManaged_init(initialAuthority)
] -
[
__AccessManaged_init_unchained(initialAuthority)
] -
[
authority()
] -
[
setAuthority(newAuthority)
] -
[
isConsumingScheduledOp()
] -
[
_setAuthority(newAuthority)
] -
[
_checkCanCall(caller, data)
]
-
[
__Context_init()
] -
[
__Context_init_unchained()
] -
[
_msgSender()
] -
[
_msgData()
] -
[
_contextSuffixLength()
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogPoolVerifiedByPool(pool, applicationNftId, collateralizationAmount)
]
-
[
LogComponentWalletAddressChanged(oldWallet, newWallet)
] -
[
LogComponentWalletTokensTransferred(from, to, amount)
] -
[
LogComponentTokenHandlerApproved(tokenHandler, token, limit, isMaxAmount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
_initializeBasicPool(address registry, NftId productNftId, string name, struct IComponents.PoolInfo poolInfo, contract IAuthorization authorization, address initialOwner)
internal
setBundleFee(NftId bundleNftId, struct Fee fee)
public
Updates the bundle feeds to the specified values.
BasicPoolAuthorization
import "@etherisc/gif-next/contracts/pool/BasicPoolAuthorization.sol";
-
[
constructor(poolName)
] -
[
_setupServiceTargets()
] -
[
_setupTokenHandlerAuthorizations()
] -
[
_setupTargetAuthorizations()
]
-
[
getTokenHandlerName()
] -
[
getTokenHandlerTarget()
] -
[
getTarget(targetName)
] -
[
getTargets()
] -
[
targetExists(target)
] -
[
_setupTargets()
] -
[
_setupRoles()
] -
[
_addCustomRole(roleId, adminRoleId, maxMemberCount, name)
] -
[
_addGifTarget(contractName)
] -
[
_addInstanceTarget(contractName)
] -
[
_addTarget(name)
] -
[
_toTargetRoleId(targetDomain)
] -
[
_toTargetRoleName(targetName)
]
-
[
getDomain()
] -
[
getRelease()
] -
[
getCommitHash()
] -
[
getMainTargetName()
] -
[
getMainTarget()
] -
[
getServiceDomains()
] -
[
getServiceDomain(idx)
] -
[
getServiceTarget(serviceDomain)
] -
[
getServiceRole(serviceDomain)
] -
[
getServiceAddress(serviceDomain)
] -
[
getTargetRole(target)
] -
[
roleExists(roleId)
] -
[
getRoles()
] -
[
getRoleInfo(roleId)
] -
[
getRoleName(roleId)
] -
[
getAuthorizedRoles(target)
] -
[
getAuthorizedFunctions(target, roleId)
] -
[
_setupDomains()
] -
[
_setupDomainAuthorizations()
] -
[
_authorizeServiceDomain(serviceDomain, serviceAddress)
] -
[
_addTargetWithRole(targetName, roleId, roleName)
] -
[
_addRole(roleId, info)
] -
[
_authorizeForService(serviceDomain, authorizedDomain)
] -
[
_authorizeForTarget(target, authorizedRoleId)
] -
[
_authorize(functions, selector, name)
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
Initialized(version)
]
_setupServiceTargets()
internal
Sets up the relevant service targets for the component. Overwrite this function for use case specific authorizations.
PoolService
import "@etherisc/gif-next/contracts/pool/PoolService.sol";
-
[
_initialize(owner, data)
] -
[
setMaxBalanceAmount(maxBalanceAmount)
] -
[
closeBundle(bundleNftId)
] -
[
processFundedClaim(policyNftId, claimId, availableAmount)
] -
[
stake(bundleNftId, amount)
] -
[
unstake(bundleNftId, amount)
] -
[
fundPoolWallet(amount)
] -
[
defundPoolWallet(amount)
] -
[
processSale(bundleNftId, premium)
] -
[
lockCollateral(instance, token, productNftId, applicationNftId, bundleNftId, sumInsuredAmount)
] -
[
processPayout(instanceReader, instanceStore, productNftId, policyNftId, bundleNftId, payoutId, payoutAmount, payoutBeneficiary)
] -
[
withdrawBundleFees(bundleNftId, amount)
] -
[
releaseCollateral(instance, policyNftId, policyInfo)
] -
[
_getAndVerifyActivePool()
] -
[
_getDomain()
]
-
[
__Service_init(authority, registry, initialOwner)
] -
[
getDomain()
] -
[
getVersion()
] -
[
getRoleId()
] -
[
_getServiceAddress(domain)
]
-
[
__ReentrancyGuard_init()
] -
[
__ReentrancyGuard_init_unchained()
] -
[
_reentrancyGuardEntered()
]
-
[
initializeVersionable(activatedBy, data)
] -
[
upgradeVersionable(data)
] -
[
_upgrade(data)
]
-
[
__Registerable_init(authority, registry, parentNftId, objectType, isInterceptor, initialOwner, data)
] -
[
isActive()
] -
[
getRelease()
] -
[
getInitialInfo()
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
__AccessManaged_init(initialAuthority)
] -
[
__AccessManaged_init_unchained(initialAuthority)
] -
[
authority()
] -
[
setAuthority(newAuthority)
] -
[
isConsumingScheduledOp()
] -
[
_setAuthority(newAuthority)
] -
[
_checkCanCall(caller, data)
]
-
[
__Context_init()
] -
[
__Context_init_unchained()
] -
[
_msgSender()
] -
[
_msgData()
] -
[
_contextSuffixLength()
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxCapitalAmount, currentMaxCapitalAmount)
] -
[
LogPoolServiceWalletFunded(poolNftId, poolOwner, amount)
] -
[
LogPoolServiceWalletDefunded(poolNftId, poolOwner, amount)
] -
[
LogPoolServiceBundleCreated(instanceNftId, poolNftId, bundleNftId)
] -
[
LogPoolServiceBundleClosed(instanceNftId, poolNftId, bundleNftId)
] -
[
LogPoolServiceBundleStaked(instanceNftId, poolNftId, bundleNftId, amount, netAmount)
] -
[
LogPoolServiceBundleUnstaked(instanceNftId, poolNftId, bundleNftId, amount, netAmount)
] -
[
LogPoolServiceFeesWithdrawn(bundleNftId, recipient, tokenAddress, amount)
] -
[
LogPoolServiceProcessFundedClaim(policyNftId, claimId, availableAmount)
] -
[
LogPoolServiceApplicationVerified(poolNftId, bundleNftId, applicationNftId, totalCollateralAmount)
] -
[
LogPoolServiceCollateralLocked(poolNftId, bundleNftId, applicationNftId, totalCollateralAmount, lockedCollateralAmount)
] -
[
LogPoolServiceCollateralReleased(bundleNftId, policyNftId, remainingCollateralAmount)
] -
[
LogPoolServiceSaleProcessed(poolNftId, bundleNftId, bundleNetAmount, bundleFeeAmount, poolFeeAmount)
] -
[
LogPoolServicePayoutProcessed(poolNftId, bundleNftId, policyNftId, payoutId, netPayoutAmount, processingFeeAmount, payoutBeneficiary)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
setMaxBalanceAmount(Amount maxBalanceAmount)
external
sets the max balance amount for the calling pool
closeBundle(NftId bundleNftId)
external
closes the specified bundle only open bundles (active or locked) may be closed to close a bundle it may not have any non-closed polices attached to it bundle fees and remaining capital (after deduction of the performance fee) will be transferred to the bundle owner may only be called by registered and unlocked pool components
processFundedClaim(NftId policyNftId, ClaimId claimId, Amount availableAmount)
external
Informs product about available funds to process a confirmed claim. The function triggers a callback to the product component when the product’s property isProcessingFundedClaims is set.
stake(NftId bundleNftId, Amount amount) → Amount netAmount
external
increase stakes for bundle staking fees will be deducted by the pool service from the staking amount may only be called by registered and unlocked pool components
unstake(NftId bundleNftId, Amount amount) → Amount netAmount
external
decrease stakes for bundle performance fees will be deducted by the pool service from the staking amount may only be called by registered and unlocked pool components
fundPoolWallet(Amount amount)
external
Fund the pool wallet with the provided amount. This function will collect the amount from the pool owner and transfers it to the pool wallet. The function will not update balance amounts managed by the framework. Only available for externally managed pools.
defundPoolWallet(Amount amount)
external
Defund the specified pool wallet with the provided amount. This function will transfer the amount from the pool wallet to the pool owner. The function will not update balance amounts managed by the framework. Only available for externally managed pools.
processSale(NftId bundleNftId, struct IPolicy.PremiumInfo premium)
external
processes the sale of a bundle and track the pool fee and bundle fee amounts
lockCollateral(contract IInstance instance, address token, NftId productNftId, NftId applicationNftId, NftId bundleNftId, Amount sumInsuredAmount) → Amount totalCollateralAmount, Amount localCollateralAmount
external
locks required collateral to cover the specified application (and turn it into a policy) - retention level == 1: the full collateral amount will be locked by the specified bundle - retention level < 1: a part of the coverage is provided by the specified bundle, the rest by the pool component in which case the pool component might hold a re-insurance policy may only be called by the policy service for unlocked pool components
processPayout(contract InstanceReader instanceReader, contract InstanceStore instanceStore, NftId productNftId, NftId policyNftId, NftId bundleNftId, PayoutId payoutId, Amount payoutAmount, address payoutBeneficiary) → Amount netPayoutAmount, Amount processingFeeAmount
external
reduces the locked collateral in the bundle associated with the specified policy and updates pool/bundle counters every payout of a policy reduces the collateral by the payout amount may only be called by the claim service for unlocked pool components
withdrawBundleFees(NftId bundleNftId, Amount amount) → Amount withdrawnAmount
public
Withdraw bundle feeds for the specified bundle.
BundleService
import "@etherisc/gif-next/contracts/pool/BundleService.sol";
-
[
_initialize(owner, data)
] -
[
setFee(bundleNftId, fee)
] -
[
create(owner, bundleFee, lifetime, filter)
] -
[
lockCollateral(instance, policyNftId, bundleNftId, collateralAmount)
] -
[
setLocked(bundleNftId, locked)
] -
[
close(instance, bundleNftId)
] -
[
stake(instanceReader, instanceStore, bundleNftId, amount)
] -
[
unstake(instanceStore, bundleNftId, amount)
] -
[
extend(bundleNftId, lifetimeExtension)
] -
[
releaseCollateral(instanceStore, policyNftId, bundleNftId, collateralAmount)
] -
[
_getDomain()
]
-
[
__Service_init(authority, registry, initialOwner)
] -
[
getDomain()
] -
[
getVersion()
] -
[
getRoleId()
] -
[
_getServiceAddress(domain)
]
-
[
__ReentrancyGuard_init()
] -
[
__ReentrancyGuard_init_unchained()
] -
[
_reentrancyGuardEntered()
]
-
[
initializeVersionable(activatedBy, data)
] -
[
upgradeVersionable(data)
] -
[
_upgrade(data)
]
-
[
__Registerable_init(authority, registry, parentNftId, objectType, isInterceptor, initialOwner, data)
] -
[
isActive()
] -
[
getRelease()
] -
[
getInitialInfo()
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
__AccessManaged_init(initialAuthority)
] -
[
__AccessManaged_init_unchained(initialAuthority)
] -
[
authority()
] -
[
setAuthority(newAuthority)
] -
[
isConsumingScheduledOp()
] -
[
_setAuthority(newAuthority)
] -
[
_checkCanCall(caller, data)
]
-
[
__Context_init()
] -
[
__Context_init_unchained()
] -
[
_msgSender()
] -
[
_msgData()
] -
[
_contextSuffixLength()
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogBundleServiceBundleCreated(bundleNftId, poolNftId, lifetime)
] -
[
LogBundleServiceBundleClosed(bundleNftId)
] -
[
LogBundleServiceBundleLocked(bundleNftId)
] -
[
LogBundleServiceBundleUnlocked(bundleNftId)
] -
[
LogBundleServiceBundleExtended(bundleNftId, lifetimeExtension, extendedExpiredAt)
] -
[
LogBundleServiceBundleFeeUpdated(bundleNftId, fixedFee, fractionalFee)
] -
[
LogBundleServiceCollateralLocked(bundleNftId, policyNftId, collateralAmount)
] -
[
LogBundleServiceCollateralReleased(bundleNftId, policyNftId, collateralAmount)
] -
[
LogBundleServiceBundleStaked(bundleNftId, amount)
] -
[
LogBundleServiceBundleUnstaked(bundleNftId, amount)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
setFee(NftId bundleNftId, struct Fee fee)
external
set bundle fee to provided value may only be called by registered and unlocked pool components
create(address owner, struct Fee bundleFee, Seconds lifetime, bytes filter) → NftId bundleNftId
external
lockCollateral(contract IInstance instance, NftId policyNftId, NftId bundleNftId, Amount collateralAmount)
external
locks the specified collateral in the bundle the locked collateral is added to the bundle locked capital the bundles' fees are updated with the fees for this premium the premium (minus bundle fee) is added to the bundle capital may only be called by pool service
setLocked(NftId bundleNftId, bool locked)
external
locks/unlocks the specified bundle. locked bundles are not available to collateralize new policies. may only be called by registered and unlocked pool components.
close(contract IInstance instance, NftId bundleNftId) → Amount unstakedAmount, Amount feeAmount
external
closes the specified bundle only open bundles (active or locked) may be closed to close a bundle it may not have any non-closed polices attached to it may only be called by registered and unlocked pool components
stake(contract InstanceReader instanceReader, contract InstanceStore instanceStore, NftId bundleNftId, Amount amount)
external
increase bundle stakes by the specified amount. bundle must not be expired or closed may only be called by the pool service
unstake(contract InstanceStore instanceStore, NftId bundleNftId, Amount amount) → Amount unstakedAmount
external
decrease bundle stakes by the specified amount may only be called by the pool service
extend(NftId bundleNftId, Seconds lifetimeExtension) → Timestamp extendedExpiredAt
external
extend the lifetime of the bundle by the specified time in seconds
PoolServiceManager
import "@etherisc/gif-next/contracts/pool/PoolServiceManager.sol";
-
[
constructor(authority, registry, salt)
] -
[
getPoolService()
]
-
[
initialize(registry, implementation, data, salt)
] -
[
deploy(registry, initialImplementation, initializationData)
] -
[
deployDetermenistic(registry, initialImplementation, initializationData, salt)
] -
[
upgrade(newImplementation)
] -
[
upgrade(newImplementation, upgradeData)
] -
[
linkToProxy()
] -
[
getDeployData(proxyOwner, deployData)
] -
[
getUpgradeData(upgradeData)
] -
[
getProxy()
] -
[
getVersion()
] -
[
getVersionCount()
] -
[
getVersion(idx)
] -
[
getVersionInfo(_version)
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogProxyManagerVersionableDeployed(proxy, initialImplementation)
] -
[
LogProxyManagerVersionableUpgraded(proxy, upgradedImplementation)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
Initialized(version)
]
BundleServiceManager
import "@etherisc/gif-next/contracts/pool/BundleServiceManager.sol";
-
[
constructor(authority, registry, salt)
] -
[
getBundleService()
]
-
[
initialize(registry, implementation, data, salt)
] -
[
deploy(registry, initialImplementation, initializationData)
] -
[
deployDetermenistic(registry, initialImplementation, initializationData, salt)
] -
[
upgrade(newImplementation)
] -
[
upgrade(newImplementation, upgradeData)
] -
[
linkToProxy()
] -
[
getDeployData(proxyOwner, deployData)
] -
[
getUpgradeData(upgradeData)
] -
[
getProxy()
] -
[
getVersion()
] -
[
getVersionCount()
] -
[
getVersion(idx)
] -
[
getVersionInfo(_version)
]
-
[
_checkNftType(nftId, expectedObjectType)
] -
[
__NftOwnable_init(registry, initialOwner)
] -
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
] -
[
_linkToNftOwnable(nftOwnableAddress)
]
-
[
__RegistryLinked_init(registry)
] -
[
getRegistry()
]
-
[
__ERC165_init()
] -
[
_initializeERC165()
] -
[
_registerInterface(interfaceId)
] -
[
_registerInterfaceNotInitializing(interfaceId)
] -
[
supportsInterface(interfaceId)
]
-
[
_checkInitializing()
] -
[
_disableInitializers()
] -
[
_getInitializedVersion()
] -
[
_isInitializing()
]
-
[
LogProxyManagerVersionableDeployed(proxy, initialImplementation)
] -
[
LogProxyManagerVersionableUpgraded(proxy, upgradedImplementation)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
Initialized(version)
]