Services
| This document is better viewed at https://docs.etherisc.com/contracts/api/services |
Contracts
ComponentOwnerService
import "@etherisc/gif-contracts/contracts/services/ComponentOwnerService.sol";
InstanceOperatorService
import "@etherisc/gif-contracts/contracts/services/InstanceOperatorService.sol";
_afterInitialize() internal
Performs the necessary setup after contract initialization. - Sets the component, pool, and treasury contracts. - Transfers ownership to the message sender. - Links the bundle module to the bundle token. - Sets the default admin role.
prepareRelease(bytes32 _newRelease) external
Prepares a new release by calling the prepareRelease function from the Registry contract.
register(bytes32 _contractName, address _contractAddress) external
Registers a contract in the registry.
registerInRelease(bytes32 _release, bytes32 _contractName, address _contractAddress) external
Registers a contract in a specific release.
deregisterInRelease(bytes32 _release, bytes32 _contractName) external
Deregisters a contract from a specific release in the registry.
approve(uint256 id) external
Approves a component with the given ID and sets its corresponding riskpool ID in the pool contract.
archive(uint256 id) external
Archives a component with the given ID from the instance operator’s address.
setDefaultStaking(uint16 componentType, bytes data) external
Sets the default staking for a specific component type.
adjustStakingRequirements(uint256 id, bytes data) external
Adjusts the staking requirements for a specific instance operator by providing the operator ID and the new staking requirements.
setRiskpoolWallet(uint256 riskpoolId, address riskpoolWalletAddress) external
Sets the wallet address for a specific risk pool.
setProductToken(uint256 productId, address erc20Address) external
Sets the ERC20 token address for a given product ID.
createFeeSpecification(uint256 componentId, uint256 fixedFee, uint256 fractionalFee, bytes feeCalculationData) → struct ITreasury.FeeSpecification external
Returns a FeeSpecification object created with the given parameters.
InstanceService
import "@etherisc/gif-contracts/contracts/services/InstanceService.sol";
_afterInitialize() internal
Internal function that is called after initialization is complete. It sets the bundle, component, policy, pool, and treasury controllers by retrieving their contract addresses. It also sets the chain names.
_setChainNames() internal
Sets the names for several blockchain networks by assigning them to their respective chain IDs.
Sets the names for the Ethereum Mainnet/ETH, Goerli/ETH, Ganache, Gnosis/xDai, Sokol/SPOA, Polygon Mainnet/MATIC, Mumbai/MATIC, Avalanche C-Chain/AVAX and Avalanche Fuji Testnet/AVAX blockchain networks by assigning them to their respective chain IDs.
getInstanceId() → bytes32 instanceId public
Returns the instance ID of the contract, which is a hash of the chain ID and the registry address.
getComponentOwnerService() → contract IComponentOwnerService service external
Returns the address of the Component Owner Service contract.
getInstanceOperatorService() → contract IInstanceOperatorService service external
Returns the instance operator service contract address.
getOracleService() → contract IOracleService service external
Returns the Oracle Service contract instance.
getProductService() → contract IProductService service external
Returns the address of the Product Service contract.
getRiskpoolService() → contract IRiskpoolService service external
Returns the IRiskpoolService contract instance.
getRegistry() → contract IRegistry service external
Returns the current instance of the IRegistry contract.
contracts() → uint256 numberOfContracts external
Returns the number of contracts registered in the registry.
contractName(uint256 idx) → bytes32 name external
Returns the name of the contract at the specified index in the registry.
getDefaultAdminRole() → bytes32 external
Returns the default admin role for the AccessControl contract.
getOracleProviderRole() → bytes32 external
Returns the role identifier for the oracle provider role.
getRiskpoolKeeperRole() → bytes32 external
Returns the role identifier for the Riskpool Keeper role.
getComponentId(address componentAddress) → uint256 componentId external
Returns the component ID of a given component address.
getComponentType(uint256 componentId) → enum IComponent.ComponentType componentType external
Returns the type of a component given its ID.
getComponentState(uint256 componentId) → enum IComponent.ComponentState componentState external
Returns the current state of a specific component.
getComponent(uint256 id) → contract IComponent external
Returns the component with the specified ID.
getProductId(uint256 idx) → uint256 productId public
Returns the product ID of the component at the given index.
getStakingRequirements(uint256 id) → bytes data external
Returns the staking requirements for a specific ID.
processIds() → uint256 numberOfProcessIds external
Returns the number of process IDs in the policy contract.
getMetadata(bytes32 bpKey) → struct IPolicy.Metadata metadata external
Returns the metadata associated with a given business process key.
getApplication(bytes32 processId) → struct IPolicy.Application application external
Returns the application data associated with the given process ID.
getPolicy(bytes32 processId) → struct IPolicy.Policy policy external
Returns the policy associated with the given process ID.
claims(bytes32 processId) → uint256 numberOfClaims external
Returns the number of claims associated with a given process ID.
payouts(bytes32 processId) → uint256 numberOfPayouts external
Returns the number of payouts for a given processId.
getClaim(bytes32 processId, uint256 claimId) → struct IPolicy.Claim claim external
Returns the claim with the given claimId for the specified processId.
getPayout(bytes32 processId, uint256 payoutId) → struct IPolicy.Payout payout external
Returns the information of a specific payout.
getRiskpool(uint256 riskpoolId) → struct IPool.Pool riskPool external
Returns the risk pool with the given ID.
getFullCollateralizationLevel() → uint256 external
Returns the full collateralization level of the pool.
getCapital(uint256 riskpoolId) → uint256 capitalAmount external
Returns the capital amount of a given risk pool.
getTotalValueLocked(uint256 riskpoolId) → uint256 totalValueLockedAmount external
Returns the total value locked in a specific risk pool.
getCapacity(uint256 riskpoolId) → uint256 capacityAmount external
Returns the available capacity of a risk pool.
getBalance(uint256 riskpoolId) → uint256 balanceAmount external
Returns the balance amount of a specific risk pool.
activeBundles(uint256 riskpoolId) → uint256 numberOfActiveBundles external
Returns the number of active bundles for a given risk pool.
getActiveBundleId(uint256 riskpoolId, uint256 bundleIdx) → uint256 bundleId external
Returns the active bundle ID for a given risk pool and bundle index.
getMaximumNumberOfActiveBundles(uint256 riskpoolId) → uint256 maximumNumberOfActiveBundles external
Returns the maximum number of active bundles for a given risk pool ID.
getBundle(uint256 bundleId) → struct IBundle.Bundle bundle external
Returns the bundle with the given ID.
unburntBundles(uint256 riskpoolId) → uint256 numberOfUnburntBundles external
Returns the number of unburnt bundles for a given risk pool ID.
getInstanceWallet() → address external
Returns the address of the instance wallet associated with the treasury.
getRiskpoolWallet(uint256 riskpoolId) → address external
Returns the wallet address of the specified riskpool.
OracleService
import "@etherisc/gif-contracts/contracts/services/OracleService.sol";
ProductService
import "@etherisc/gif-contracts/contracts/services/ProductService.sol";
constructor(address _registry) public
Constructor function that initializes the contract with a registry address.
RiskpoolService
import "@etherisc/gif-contracts/contracts/services/RiskpoolService.sol";
_afterInitialize() internal
Sets the addresses of the BundleController, ComponentController, PoolController, and TreasuryModule contracts.
registerRiskpool(address wallet, address erc20Token, uint256 collateralizationLevel, uint256 sumOfSumInsuredCap) external
Registers a new risk pool with the given parameters.
createBundle(address owner, bytes filter, uint256 initialCapital) → uint256 bundleId external
Creates a new bundle with the given parameters and adds it to the active set of the riskpool.
fundBundle(uint256 bundleId, uint256 amount) → uint256 netAmount external
This function allows a user to fund a bundle with a specified amount.
defundBundle(uint256 bundleId, uint256 amount) → uint256 netAmount external
Defunds a bundle by withdrawing a specified amount of tokens from it.
unlockBundle(uint256 bundleId) external
Unlocks a bundle for trading by adding its ID to the active set of a risk pool and unlocking the bundle.
closeBundle(uint256 bundleId) external
Closes a bundle and removes it from the active set of the owning riskpool.
burnBundle(uint256 bundleId) external
Burns a closed bundle, withdrawing its remaining balance and defunding it from the riskpool and the pool.
collateralizePolicy(uint256 bundleId, bytes32 processId, uint256 collateralAmount) external
Collateralizes a policy by locking a specified amount of collateral for a given bundle and process ID.
processPremium(uint256 bundleId, bytes32 processId, uint256 amount) external
Processes a premium payment for a specific bundle.
processPayout(uint256 bundleId, bytes32 processId, uint256 amount) external
Processes a payout for a specific bundle.