Instance
Contains the instance related contracts.
Contracts
InstanceAdmin
import "@etherisc/gif-next/contracts/instance/InstanceAdmin.sol";
-
[
constructor(accessManager)
] -
[
completeSetup(registry, authorization, release, instance)
] -
[
_setupServices(authorization)
] -
[
_createInstanceTargets(instanceTargetName)
] -
[
_createInstanceTarget(target, name)
] -
[
initializeComponentAuthorization(componentAddress, expectedType)
] -
[
createRole(name, adminRoleId, maxMemberCount)
] -
[
setRoleActive(roleId, active)
] -
[
grantRole(roleId, account)
] -
[
revokeRole(roleId, account)
] -
[
createTarget(target, name)
] -
[
authorizeFunctions(target, roleId, functions)
] -
[
unauthorizeFunctions(target, functions)
] -
[
setInstanceLocked(locked)
] -
[
setTargetLocked(target, locked)
] -
[
setContractLocked(target, locked)
] -
[
getInstanceAuthorization()
] -
[
_createTargetAuthorizations(authorization)
]
-
[
initialize(authority, adminName)
] -
[
__AccessAdmin_init(authority, adminName)
] -
[
getRelease()
] -
[
getRegistry()
] -
[
getLinkedNftId()
] -
[
getAuthorization()
] -
[
isLocked()
] -
[
roles()
] -
[
getRoleId(idx)
] -
[
getAdminRole()
] -
[
getPublicRole()
] -
[
roleExists(roleId)
] -
[
getRoleForName(name)
] -
[
getRoleInfo(roleId)
] -
[
isRoleActive(roleId)
] -
[
isRoleCustom(roleId)
] -
[
roleMembers(roleId)
] -
[
getRoleMember(roleId, idx)
] -
[
isRoleMember(roleId, account)
] -
[
isRoleAdmin(roleId, account)
] -
[
targetExists(target)
] -
[
targets()
] -
[
getTargetAddress(idx)
] -
[
getTargetInfo(target)
] -
[
getTargetForName(name)
] -
[
isTargetLocked(target)
] -
[
authorizedFunctions(target)
] -
[
getAuthorizedFunction(target, idx)
] -
[
getFunctionInfo(target, selector)
] -
[
_linkToNftOwnable(registerable)
] -
[
_createRoles(authorization)
] -
[
_createRole(roleId, info, revertOnExistingRole)
] -
[
_setRoleActive(roleId, active)
] -
[
_grantRoleToAccount(roleId, account)
] -
[
_revokeRoleFromAccount(roleId, account)
] -
[
_getOrCreateTargetRoleIdAndName(target, targetName, targetType)
] -
[
_createTarget(target, targetName, targetType, checkAuthority)
] -
[
_createTargetUnchecked(target, targetName, targetType, managed)
] -
[
_setTargetLocked(target, locked)
] -
[
_authorizeFunctions(authorization, target, roleId)
] -
[
_authorizeTargetFunctions(target, roleId, functions, onlyComponentOrContractTargets, addFunctions)
] -
[
_updateFunctionAccess(target, roleId, func, addFunction)
]
-
[
__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()
]
-
[
LogAccessAdminRoleCreated(admin, roleId, targetType, roleAdminId, name)
] -
[
LogAccessAdminTargetCreated(admin, name, managed, target, roleId)
] -
[
LogAccessAdminRoleActivatedSet(admin, roleId, active, lastUpdateIn)
] -
[
LogAccessAdminRoleGranted(admin, account, roleName)
] -
[
LogAccessAdminRoleRevoked(admin, account, roleName)
] -
[
LogAccessAdminTargetLockedSet(admin, target, locked, lastUpdateIn)
] -
[
LogAccessAdminFunctionGranted(admin, target, func, lastUpdateIn)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
completeSetup(address registry, address authorization, VersionPart release, address instance)
external
Completes the initialization of this instance admin using the provided instance, registry and version. Important: Initialization of instance admin is only complete after calling this function. Important: The instance MUST be registered and all instance supporting contracts must be wired to this instance.
_setupServices(contract IAuthorization authorization)
internal
grants the service roles to the service addresses based on the authorization specification. Service addresses used for the granting are determined by the registry and the release of this instance.
initializeComponentAuthorization(address componentAddress, ObjectType expectedType)
external
Initializes the authorization for the specified component. Important: The component MUST be registered.
createRole(string name, RoleId adminRoleId, uint32 maxMemberCount) → RoleId roleId
external
Creates a custom role.
grantRole(RoleId roleId, address account)
external
Grants the provided role to the specified account
revokeRole(RoleId roleId, address account)
external
Revokes the provided role from the specified account
createTarget(address target, string name) → RoleId contractRoleId
external
Create a new contract target. The target needs to be an access managed contract.
authorizeFunctions(address target, RoleId roleId, struct IAccess.FunctionInfo[] functions)
external
Add function authorizations for the specified component or custom target.
unauthorizeFunctions(address target, struct IAccess.FunctionInfo[] functions)
external
Removes function authorizations for the specified component or custom target.
setInstanceLocked(bool locked)
external
locks the instance and all its releated targets including component and custom targets.
InstanceService
import "@etherisc/gif-next/contracts/instance/InstanceService.sol";
-
[
createRole(roleName, adminRoleId, maxMemberCount)
] -
[
setRoleActive(roleId, active)
] -
[
grantRole(roleId, account)
] -
[
revokeRole(roleId, account)
] -
[
createTarget(target, name)
] -
[
authorizeFunctions(target, roleId, functions)
] -
[
unauthorizeFunctions(target, functions)
] -
[
setTargetLocked(target, locked)
] -
[
setInstanceLocked(locked)
] -
[
createInstance(allowAnyToken)
] -
[
setStakingLockingPeriod(stakeLockingPeriod)
] -
[
setStakingRewardRate(rewardRate)
] -
[
setStakingMaxAmount(maxStakedAmount)
] -
[
refillInstanceRewardReserves(rewardProvider, dipAmount)
] -
[
withdrawInstanceRewardReserves(dipAmount)
] -
[
upgradeInstanceReader()
] -
[
setAndRegisterMasterInstance(instanceAddress)
] -
[
upgradeMasterInstanceReader(instanceReaderAddress)
] -
[
getMasterInstanceReader()
] -
[
_cloneNewInstanceAdmin()
] -
[
_createInstance(instanceAdmin, instanceOwner, allowAnyToken)
] -
[
_initialize(owner, data)
] -
[
_checkInstance(instanceAddress, expectedRelease)
] -
[
_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()
]
-
[
LogInstanceServiceInstanceLocked(instanceNftId, locked)
] -
[
LogInstanceServiceInstanceCreated(instanceNftId, instance)
] -
[
LogInstanceServiceMasterInstanceReaderUpgraded(instanceNfId, newInstanceReader)
] -
[
LogInstanceServiceInstanceReaderUpgraded(instanceNfId, newInstanceReader)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
createRole(string roleName, RoleId adminRoleId, uint32 maxMemberCount) → RoleId roleId
external
Creates a new custom role for the calling instance.
setRoleActive(RoleId roleId, bool active)
external
Sets the specified custom role as active or inactive for the calling instance.
grantRole(RoleId roleId, address account)
external
Grants the specified custom role to the specified account for the calling instance.
revokeRole(RoleId roleId, address account)
external
Revokes the specified custom role from the specified account for the calling instance.
createTarget(address target, string name) → RoleId contractRoleId
external
Creates a new custom target for the calling instance. All custom trargets are created with a corresponding contract role.
authorizeFunctions(address target, RoleId roleId, struct IAccess.FunctionInfo[] functions)
external
Authorizes the specified functions for the specified target.
unauthorizeFunctions(address target, struct IAccess.FunctionInfo[] functions)
external
Removes any role authorization for the specified functions.
setTargetLocked(address target, bool locked)
external
Locks/unlocks the specified target constrolled by the corresponding instance admin.
createInstance(bool allowAnyToken) → contract IInstance instance, NftId instanceNftId
external
Creates a new instance. The caller becomes the owner of the new instance. Creation of a new instance is achieved by this service through the creation and registration of a new clone of the master instance and then setting up the initial wiring and authorization of the necessary components.
withdrawInstanceRewardReserves(Amount dipAmount) → Amount newBalance
external
Defunds the staking reward reserves for the specified target.
_cloneNewInstanceAdmin() → contract InstanceAdmin clonedAdmin
internal
create new cloned instance admin function used to setup a new instance
IInstanceService
import "@etherisc/gif-next/contracts/instance/IInstanceService.sol";
-
[
createRole(roleName, adminRoleId, maxMemberCount)
] -
[
setRoleActive(roleId, active)
] -
[
grantRole(roleId, account)
] -
[
revokeRole(roleId, account)
] -
[
createTarget(target, name)
] -
[
authorizeFunctions(target, roleId, functions)
] -
[
unauthorizeFunctions(target, functions)
] -
[
setTargetLocked(target, locked)
] -
[
setInstanceLocked(locked)
] -
[
createInstance(allowAnyToken)
] -
[
upgradeInstanceReader()
] -
[
upgradeMasterInstanceReader(instanceReaderAddress)
] -
[
setStakingLockingPeriod(stakeLockingPeriod)
] -
[
setStakingRewardRate(rewardRate)
] -
[
setStakingMaxAmount(maxStakedAmount)
] -
[
refillInstanceRewardReserves(rewardProvider, dipAmount)
] -
[
withdrawInstanceRewardReserves(dipAmount)
]
-
[
getDomain()
] -
[
getRoleId()
]
-
[
initializeVersionable(activatedBy, activationData)
] -
[
upgradeVersionable(upgradeData)
] -
[
getVersion()
]
-
[
isActive()
] -
[
getInitialInfo()
]
-
[
getRelease()
]
-
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
]
-
[
getRegistry()
]
-
[
supportsInterface(interfaceId)
]
-
[
authority()
] -
[
setAuthority()
] -
[
isConsumingScheduledOp()
]
-
[
LogInstanceServiceInstanceLocked(instanceNftId, locked)
] -
[
LogInstanceServiceInstanceCreated(instanceNftId, instance)
] -
[
LogInstanceServiceMasterInstanceReaderUpgraded(instanceNfId, newInstanceReader)
] -
[
LogInstanceServiceInstanceReaderUpgraded(instanceNfId, newInstanceReader)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
createRole(string roleName, RoleId adminRoleId, uint32 maxMemberCount) → RoleId roleId
external
Creates a new custom role for the calling instance.
setRoleActive(RoleId roleId, bool active)
external
Sets the specified custom role as active or inactive for the calling instance.
grantRole(RoleId roleId, address account)
external
Grants the specified custom role to the specified account for the calling instance.
revokeRole(RoleId roleId, address account)
external
Revokes the specified custom role from the specified account for the calling instance.
createTarget(address target, string name) → RoleId contractRoleId
external
Creates a new custom target for the calling instance. All custom trargets are created with a corresponding contract role.
authorizeFunctions(address target, RoleId roleId, struct IAccess.FunctionInfo[] functions)
external
Authorizes the specified functions for the specified target.
unauthorizeFunctions(address target, struct IAccess.FunctionInfo[] functions)
external
Removes any role authorization for the specified functions.
setTargetLocked(address target, bool locked)
external
Locks/unlocks the specified target constrolled by the corresponding instance admin.
createInstance(bool allowAnyToken) → contract IInstance instance, NftId instanceNftId
external
Creates a new instance. The caller becomes the owner of the new instance. Creation of a new instance is achieved by this service through the creation and registration of a new clone of the master instance and then setting up the initial wiring and authorization of the necessary components.
InstanceReader
import "@etherisc/gif-next/contracts/instance/InstanceReader.sol";
Central reader contract for a specific instance. Provides reading functions for all instance data and related component data.
-
[
initialize()
] -
[
initializeWithInstance(instanceAddress)
] -
[
getRegistry()
] -
[
getInstanceNftId()
] -
[
getInstance()
] -
[
getComponentInfo(componentNftId)
] -
[
getToken(componentNftId)
] -
[
getWallet(componentNftId)
] -
[
getTokenHandler(componentNftId)
] -
[
getBalanceAmount(targetNftId)
] -
[
getFeeAmount(targetNftId)
] -
[
getLockedAmount(targetNftId)
] -
[
products()
] -
[
getProduct(idx)
] -
[
getProductInfo(productNftId)
] -
[
getFeeInfo(productNftId)
] -
[
risks(productNftId)
] -
[
activeRisks(productNftId)
] -
[
getRiskId(productNftId, idx)
] -
[
getActiveRiskId(productNftId, idx)
] -
[
isProductRisk(productNftId, riskId)
] -
[
getRiskInfo(riskId)
] -
[
getRiskState(riskId)
] -
[
policiesForRisk(riskId)
] -
[
getPolicyForRisk(riskId, idx)
] -
[
policiesForBundle(bundleNftId)
] -
[
getPolicyForBundle(bundleNftId, idx)
] -
[
getPolicyInfo(policyNftId)
] -
[
getPolicyState(policyNftId)
] -
[
policyIsActive(policyNftId)
] -
[
claims(policyNftId)
] -
[
getClaimId(idx)
] -
[
getClaimInfo(policyNftId, claimId)
] -
[
getClaimState(policyNftId, claimId)
] -
[
getRemainingClaimableAmount(policyNftId)
] -
[
payouts(policyNftId, claimId)
] -
[
getPayoutId(claimId, idx)
] -
[
getPayoutInfo(policyNftId, payoutId)
] -
[
getPayoutState(policyNftId, payoutId)
] -
[
getPremiumInfo(policyNftId)
] -
[
getPremiumState(policyNftId)
] -
[
getRequestInfo(requestId)
] -
[
getRequestState(requestId)
] -
[
getPoolInfo(poolNftId)
] -
[
bundles(poolNftId)
] -
[
activeBundles(poolNftId)
] -
[
getBundleNftId(poolNftId, idx)
] -
[
getActiveBundleNftId(poolNftId, idx)
] -
[
getBundleInfo(bundleNftId)
] -
[
getBundleState(bundleNftId)
] -
[
getDistributorTypeInfo(distributorType)
] -
[
getDistributorInfo(distributorNftId)
] -
[
toReferralId(distributionNftId, referralCode)
] -
[
isReferralValid(distributionNftId, referralId)
] -
[
getReferralInfo(referralId)
] -
[
getDiscountPercentage(referralId)
] -
[
roles()
] -
[
getRoleId(idx)
] -
[
getRoleForName(name)
] -
[
getInstanceOwnerRole()
] -
[
getRoleInfo(roleId)
] -
[
roleExists(roleId)
] -
[
isRoleCustom(roleId)
] -
[
isRoleActive(roleId)
] -
[
roleMembers(roleId)
] -
[
getRoleMember(roleId, idx)
] -
[
isRoleMember(roleId, account)
] -
[
isRoleAdmin(roleId, account)
] -
[
targets()
] -
[
getTargetAddress(idx)
] -
[
getTargetInfo(target)
] -
[
targetExists(target)
] -
[
isLocked(target)
] -
[
authorizedFunctions(target)
] -
[
getAuthorizedFunction(target, idx)
] -
[
toFunction(signature, name)
] -
[
getInstanceAdmin()
] -
[
getBundleSet()
] -
[
getRiskSet()
] -
[
getMetadata(key)
] -
[
getState(key)
] -
[
toInt(value)
] -
[
toString(str)
] -
[
toUFixed(value, exp)
] -
[
_toPolicyKey(policyNftId)
] -
[
_toPremiumKey(policyNftId)
] -
[
_toBundleKey(poolNftId)
] -
[
_toComponentKey(componentNftId)
]
initializeWithInstance(address instanceAddress)
public
Initializer to upgrade instance reader via instance service
getRegistry() → contract IRegistry registry
public
Returns the registry this instance is registered in.
getComponentInfo(NftId componentNftId) → struct IComponents.ComponentInfo info
public
Returns the component info for the given component NFT ID.
getToken(NftId componentNftId) → contract IERC20Metadata token
public
Returns the registered token for the given component NFT ID.
getWallet(NftId componentNftId) → address wallet
public
Returns the current wallet address for the given component NFT ID. The wallet address is either the component’s own address or any other wallet address specified by the component owner. The wallet holds the component’s funds. Tokens collected by the component are transferred to the wallet and Tokens distributed from the component are transferred from this wallet.
getTokenHandler(NftId componentNftId) → contract TokenHandler tokenHandler
public
Returns the token handler for the given component NFT ID. The token handler manages all transfers from/to the component’s wallet. To allow a component to collect funds from an account, it has to create a corresponding allowance from the account to the address of the component’s token handler.
getBalanceAmount(NftId targetNftId) → Amount
external
Returns the current token balance amount for the given component NFT ID. The balance amount includes the fee amount.
getFeeAmount(NftId targetNftId) → Amount
external
Returns the current fee amount for the given NFT ID. The target NFT ID may reference a component, a distributor or a bundle.
getLockedAmount(NftId targetNftId) → Amount
external
Returns the currently locked amount for the given NFT ID. The target NFT ID may reference a pool or a bundle.
getProductInfo(NftId productNftId) → struct IComponents.ProductInfo info
public
Returns the product info for the given product NFT ID.
getFeeInfo(NftId productNftId) → struct IComponents.FeeInfo feeInfo
public
Returns the current fee settings for the given product NFT ID.
risks(NftId productNftId) → uint256 riskCount
public
Returns the total number of registered risks for the specified product.
activeRisks(NftId productNftId) → uint256 activeRiskCount
public
Returns the number of active risks for the specified product.
getRiskId(NftId productNftId, uint256 idx) → RiskId riskId
public
Returns the risk ID for the given product NFT ID and (registered) risk index.
getActiveRiskId(NftId productNftId, uint256 idx) → RiskId riskId
public
Returns the active risk ID for the given product NFT ID and (active) risk index.
isProductRisk(NftId productNftId, RiskId riskId) → bool exists
public
Returns true if the specified risk exists for the given product NFT ID.
getRiskInfo(RiskId riskId) → struct IRisk.RiskInfo info
public
Returns the risk info for the given risk ID.
policiesForRisk(RiskId riskId) → uint256 linkedPolicies
public
Returns the number of linked policies for the given risk ID.
getPolicyForRisk(RiskId riskId, uint256 idx) → NftId linkedPolicyNftId
public
Returns the linked policy NFT ID for the given risk ID and index.
policiesForBundle(NftId bundleNftId) → uint256 linkedPolicies
public
Returns the number of linked policies for the given bundle NFT ID.
getPolicyForBundle(NftId bundleNftId, uint256 idx) → NftId linkedPolicyNftId
public
Returns the linked policy NFT ID for the given risk ID and index.
getPolicyInfo(NftId policyNftId) → struct IPolicy.PolicyInfo info
public
Returns the info for the given policy NFT ID.
getPolicyState(NftId policyNftId) → StateId state
public
Returns the state for the given policy NFT ID.
claims(NftId policyNftId) → uint16 claimCount
public
Returns the number of claims for the given policy NFT ID.
getClaimId(uint256 idx) → ClaimId claimId
public
Returns the claim ID for the given policy NFT ID and index.
getClaimInfo(NftId policyNftId, ClaimId claimId) → struct IPolicy.ClaimInfo info
public
Returns the claim info for the given policy NFT ID and claim ID.
getClaimState(NftId policyNftId, ClaimId claimId) → StateId state
public
Returns the current claim state for the given policy NFT ID and claim ID.
getRemainingClaimableAmount(NftId policyNftId) → Amount remainingClaimableAmount
public
Returns the remaining claimable amount for the given policy NFT ID. The remaining claimable amount is the difference between the sum insured amount and total approved claim amounts so far.
payouts(NftId policyNftId, ClaimId claimId) → uint24 payoutCount
public
Returns the number of payouts for the given policy NFT ID and claim ID.
getPayoutId(ClaimId claimId, uint24 idx) → PayoutId payoutId
public
Returns the payout ID for the given claim ID and index.
getPayoutInfo(NftId policyNftId, PayoutId payoutId) → struct IPolicy.PayoutInfo info
public
Returns the payout info for the given policy NFT ID and payout ID.
getPayoutState(NftId policyNftId, PayoutId payoutId) → StateId state
public
Returns the payout state for the given policy NFT ID and payout ID.
getPremiumInfo(NftId policyNftId) → struct IPolicy.PremiumInfo info
public
Returns the premium info for the given policy NFT ID.
getPremiumState(NftId policyNftId) → StateId state
public
Returns the premium state for the given policy NFT ID.
getRequestInfo(RequestId requestId) → struct IOracle.RequestInfo requestInfo
public
Returns the request info for the given oracle request ID.
getRequestState(RequestId requestId) → StateId state
public
Returns the request info for the given oracle request ID.
getPoolInfo(NftId poolNftId) → struct IComponents.PoolInfo info
public
Returns the pool info for the given pool NFT ID.
bundles(NftId poolNftId) → uint256 bundleCount
public
Returns the total number of registered bundles for the given pool.
activeBundles(NftId poolNftId) → uint256 bundleCount
public
Returns the number of active bundles for the given pool.
getBundleNftId(NftId poolNftId, uint256 idx) → NftId bundleNftId
public
Returns the bunde NFT ID for the given pool and index.
getActiveBundleNftId(NftId poolNftId, uint256 idx) → NftId bundleNftId
public
Returns the active bunde NFT ID for the given pool and index.
getBundleInfo(NftId bundleNftId) → struct IBundle.BundleInfo info
public
Returns the bundle info for the given bundle NFT ID.
getBundleState(NftId bundleNftId) → StateId state
public
Returns the bundle state for the given bundle NFT ID.
getDistributorTypeInfo(DistributorType distributorType) → struct IDistribution.DistributorTypeInfo info
public
getDiscountPercentage(ReferralId referralId) → UFixed discountPercentage, ReferralStatus status
public
getRoleForName(string name) → RoleId roleId, bool exists
public
Returns the role ID for the given index.
getInstanceOwnerRole() → RoleId roleId
public
Returns the role ID for the instance owner role. This role may be used as a "root" admin role for other custom roles defined for this instance.
getRoleInfo(RoleId roleId) → struct IAccess.RoleInfo roleInfo
public
Returns the role info for the given role ID.
roleExists(RoleId roleId) → bool exists
public
Returns true iff the provided role ID is defined for this instance.
isRoleCustom(RoleId roleId) → bool isCustom
public
Returns true iff the provided role ID represents a custom role ID.
roleMembers(RoleId roleId) → uint256 numberOfMembers
public
Returns the number of members (accounts) for the given role ID.
getRoleMember(RoleId roleId, uint256 idx) → address account
public
Returns the member (account address) for the given role ID and index.
isRoleMember(RoleId roleId, address account) → bool isMember
public
Returns true iff the given account is a member of the specified role ID.
isRoleAdmin(RoleId roleId, address account) → bool isMember
public
Returns true iff the given account is an admin of the specified role ID. Role admins may grant and revoke the role to other accounts.
targets() → uint256 targetCount
public
Returns the number of targets (contracts) defined for this instance.
getTargetAddress(uint256 idx) → address target
public
Returns the target address for the given index.
getTargetInfo(address target) → struct IAccess.TargetInfo targetInfo
public
Returns the target info for the given target address.
targetExists(address target) → bool exists
public
Returns true iff the given target is defined for this instance.
authorizedFunctions(address target) → uint256 numberOfFunctions
external
Returns the number of authorized functions for the given target.
getAuthorizedFunction(address target, uint256 idx) → struct IAccess.FunctionInfo func, RoleId roleId
external
Returns the authorized function info for the given target and index.
Instance
import "@etherisc/gif-next/contracts/instance/Instance.sol";
-
[
initialize(instanceContracts, registry, release, initialOwner, tokenRegistryDisabled)
] -
[
setInstanceLocked(locked)
] -
[
upgradeInstanceReader()
] -
[
registerProduct(product, token)
] -
[
setStakingLockingPeriod(stakeLockingPeriod)
] -
[
setStakingRewardRate(rewardRate)
] -
[
setStakingMaxAmount(maxStakedAmount)
] -
[
refillStakingRewardReserves(dipAmount)
] -
[
withdrawStakingRewardReserves(dipAmount)
] -
[
createRole(roleName, adminRoleId, maxMemberCount)
] -
[
setRoleActive(roleId, active)
] -
[
grantRole(roleId, account)
] -
[
revokeRole(roleId, account)
] -
[
createTarget(target, name)
] -
[
setTargetLocked(target, locked)
] -
[
authorizeFunctions(target, roleId, functions)
] -
[
unauthorizeFunctions(target, functions)
] -
[
setInstanceReader(instanceReader)
] -
[
isInstanceLocked()
] -
[
isTargetLocked(target)
] -
[
products()
] -
[
getProduct(idx)
] -
[
getInstanceReader()
] -
[
getBundleSet()
] -
[
getRiskSet()
] -
[
getInstanceAdmin()
] -
[
getInstanceStore()
] -
[
getProductStore()
] -
[
isTokenRegistryDisabled()
]
-
[
__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()
]
-
[
LogInstanceCustomRoleCreated(roleId, roleName, adminRoleId, maxMemberCount)
] -
[
LogInstanceCustomRoleActiveSet(roleId, active, caller)
] -
[
LogInstanceCustomRoleGranted(roleId, account, caller)
] -
[
LogInstanceCustomRoleRevoked(roleId, account, caller)
] -
[
LogInstanceCustomTargetCreated(target, targetRoleId, name)
] -
[
LogInstanceTargetLocked(target, locked)
] -
[
LogInstanceCustomTargetFunctionRoleSet(target, selectors, roleId)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]
initialize(struct IInstance.InstanceContracts instanceContracts, contract IRegistry registry, VersionPart release, address initialOwner, bool tokenRegistryDisabled)
external
setInstanceLocked(bool locked)
external
Locks/unlocks the complete instance, including all its components.
registerProduct(address product, address token) → NftId productNftId
external
Register a product with the instance.
setStakingLockingPeriod(Seconds stakeLockingPeriod)
external
Sets the duration for locking new stakes on this instance..
setStakingRewardRate(UFixed rewardRate)
external
Sets the staking reward rate [apr] for this instance.
setStakingMaxAmount(Amount maxStakedAmount)
external
Sets the maximum staked amount for this instance.
refillStakingRewardReserves(Amount dipAmount) → Amount newRewardReserveBalance
external
Refills the staking reward reserves for the specified target.
withdrawStakingRewardReserves(Amount dipAmount) → Amount newRewardReserveBalance
external
Defunds the staking reward reserves for the specified target.
createRole(string roleName, RoleId adminRoleId, uint32 maxMemberCount) → RoleId roleId
external
Creates a new custom role for the calling instance. Custom roles are intended to be used for access control of custom components and its helper contracts. Custom roles are not intended to be used as target roles for custom contracts.
setRoleActive(RoleId roleId, bool active)
external
Activates/deactivates the specified role. Only instance owner or account with role admin role can call this function.
grantRole(RoleId roleId, address account)
external
Grants the specified role to the account. Only active roles can be granted. Only instance owner or account with role admin role can call this function.
revokeRole(RoleId roleId, address account)
external
Revokes the specified role from the account. Only instance owner or account with role admin role can call this function.
createTarget(address target, string name) → RoleId targetRoleId
external
Creates a new custom target. Custom targets are intended to be used for access control helper contracts of components. Custom targets are not intended to be used for components.
authorizeFunctions(address target, RoleId roleId, struct IAccess.FunctionInfo[] functions)
external
Authorizes the specified functions for the target and provided role.
unauthorizeFunctions(address target, struct IAccess.FunctionInfo[] functions)
external
Removes any role authorization for the specified functions.
setInstanceReader(contract InstanceReader instanceReader)
external
Sets the instance reader for the instance. Permissioned: only the instance service may call this function.
IInstance
import "@etherisc/gif-next/contracts/instance/IInstance.sol";
-
[
setInstanceLocked(locked)
] -
[
upgradeInstanceReader()
] -
[
setInstanceReader(instanceReader)
] -
[
setStakingLockingPeriod(stakeLockingPeriod)
] -
[
setStakingRewardRate(rewardRate)
] -
[
setStakingMaxAmount(maxStakedAmount)
] -
[
refillStakingRewardReserves(dipAmount)
] -
[
withdrawStakingRewardReserves(dipAmount)
] -
[
setTargetLocked(target, locked)
] -
[
registerProduct(product, token)
] -
[
createRole(roleName, adminRoleId, maxMemberCount)
] -
[
setRoleActive(roleId, active)
] -
[
grantRole(roleId, account)
] -
[
revokeRole(roleId, account)
] -
[
createTarget(target, name)
] -
[
authorizeFunctions(target, roleId, functions)
] -
[
unauthorizeFunctions(target, functions)
] -
[
isInstanceLocked()
] -
[
isTargetLocked(target)
] -
[
products()
] -
[
getProduct(idx)
] -
[
getInstanceReader()
] -
[
getBundleSet()
] -
[
getRiskSet()
] -
[
getInstanceAdmin()
] -
[
getInstanceStore()
] -
[
getProductStore()
] -
[
isTokenRegistryDisabled()
]
-
[
isActive()
] -
[
getInitialInfo()
]
-
[
getRelease()
]
-
[
linkToRegisteredNftId()
] -
[
getNftId()
] -
[
getOwner()
]
-
[
getRegistry()
]
-
[
supportsInterface(interfaceId)
]
-
[
authority()
] -
[
setAuthority()
] -
[
isConsumingScheduledOp()
]
-
[
LogInstanceCustomRoleCreated(roleId, roleName, adminRoleId, maxMemberCount)
] -
[
LogInstanceCustomRoleActiveSet(roleId, active, caller)
] -
[
LogInstanceCustomRoleGranted(roleId, account, caller)
] -
[
LogInstanceCustomRoleRevoked(roleId, account, caller)
] -
[
LogInstanceCustomTargetCreated(target, targetRoleId, name)
] -
[
LogInstanceTargetLocked(target, locked)
] -
[
LogInstanceCustomTargetFunctionRoleSet(target, selectors, roleId)
]
-
[
LogNftOwnableNftLinkedToAddress(nftId, owner)
]
-
[
AuthorityUpdated(authority)
]
setInstanceLocked(bool locked)
external
Locks/unlocks the complete instance, including all its components.
setInstanceReader(contract InstanceReader instanceReader)
external
Sets the instance reader for the instance. Permissioned: only the instance service may call this function.
setStakingLockingPeriod(Seconds stakeLockingPeriod)
external
Sets the duration for locking new stakes on this instance..
setStakingRewardRate(UFixed rewardRate)
external
Sets the staking reward rate [apr] for this instance.
setStakingMaxAmount(Amount maxStakedAmount)
external
Sets the maximum staked amount for this instance.
refillStakingRewardReserves(Amount dipAmount) → Amount newBalance
external
Refills the staking reward reserves for the specified target.
withdrawStakingRewardReserves(Amount dipAmount) → Amount newBalance
external
Defunds the staking reward reserves for the specified target.
registerProduct(address product, address token) → NftId productNftId
external
Register a product with the instance.
createRole(string roleName, RoleId adminRoleId, uint32 maxMemberCount) → RoleId roleId
external
Creates a new custom role for the calling instance. Custom roles are intended to be used for access control of custom components and its helper contracts. Custom roles are not intended to be used as target roles for custom contracts.
setRoleActive(RoleId roleId, bool active)
external
Activates/deactivates the specified role. Only instance owner or account with role admin role can call this function.
grantRole(RoleId roleId, address account)
external
Grants the specified role to the account. Only active roles can be granted. Only instance owner or account with role admin role can call this function.
revokeRole(RoleId roleId, address account)
external
Revokes the specified role from the account. Only instance owner or account with role admin role can call this function.
createTarget(address target, string name) → RoleId contractRoleId
external
Creates a new custom target. Custom targets are intended to be used for access control helper contracts of components. Custom targets are not intended to be used for components.
authorizeFunctions(address target, RoleId roleId, struct IAccess.FunctionInfo[] functions)
external
Authorizes the specified functions for the target and provided role.
unauthorizeFunctions(address target, struct IAccess.FunctionInfo[] functions)
external
Removes any role authorization for the specified functions.
isInstanceLocked() → bool isLocked
external
returns the overall locking state of the instance (including all components)
isTargetLocked(address target) → bool isLocked
external
returns the locking state of the specified target
InstanceServiceManager
import "@etherisc/gif-next/contracts/instance/InstanceServiceManager.sol";
-
[
constructor(authority, registry, salt)
] -
[
getInstanceService()
]
-
[
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)
]
InstanceStore
import "@etherisc/gif-next/contracts/instance/InstanceStore.sol";
-
[
initialize()
] -
[
createComponent(componentNftId, componentInfo)
] -
[
updateComponent(componentNftId, componentInfo, newState)
] -
[
getComponentInfo(componentNftId)
] -
[
createPool(poolNftId, info)
] -
[
updatePool(poolNftId, info, newState)
] -
[
getPoolInfo(poolNftId)
] -
[
createDistributorType(distributorType, info)
] -
[
updateDistributorType(distributorType, info, newState)
] -
[
updateDistributorTypeState(distributorType, newState)
] -
[
getDistributorTypeInfo(distributorType)
] -
[
createDistributor(distributorNftId, info)
] -
[
updateDistributor(distributorNftId, info, newState)
] -
[
updateDistributorState(distributorNftId, newState)
] -
[
getDistributorInfo(distributorNftId)
] -
[
createReferral(referralId, referralInfo)
] -
[
updateReferral(referralId, referralInfo, newState)
] -
[
updateReferralState(referralId, newState)
] -
[
getReferralInfo(referralId)
] -
[
createBundle(bundleNftId, bundle)
] -
[
updateBundle(bundleNftId, bundle, newState)
] -
[
updateBundleState(bundleNftId, newState)
] -
[
getBundleInfo(bundleNftId)
] -
[
createRequest(request)
] -
[
updateRequest(requestId, request, newState)
] -
[
updateRequestState(requestId, newState)
] -
[
getRequestInfo(requestId)
] -
[
increaseBalance(targetNftId, amount)
] -
[
decreaseBalance(targetNftId, amount)
] -
[
increaseFees(targetNftId, amount)
] -
[
decreaseFees(targetNftId, amount)
] -
[
increaseLocked(targetNftId, amount)
] -
[
decreaseLocked(targetNftId, amount)
]
-
[
_createMetadata(key32)
] -
[
_updateState(key32, state)
] -
[
exists(key32)
] -
[
getMetadata(key32)
] -
[
getState(key32)
] -
[
toKey32(objectType, id)
]
-
[
_initializeLifecycle()
] -
[
_setupLifecycle()
]
-
[
_createNextRequestId()
]
-
[
getBalanceAmount(targetNftId)
] -
[
getLockedAmount(targetNftId)
] -
[
getFeeAmount(targetNftId)
] -
[
getAmounts(targetNftId)
] -
[
_registerBalanceTarget(targetNftId)
] -
[
_increaseFees(targetNftId, amount)
] -
[
_decreaseFees(targetNftId, amount)
] -
[
_increaseLocked(targetNftId, amount)
] -
[
_decreaseLocked(targetNftId, amount)
] -
[
_increaseBalance(targetNftId, amount)
] -
[
_decreaseBalance(targetNftId, amount)
] -
[
_setLastUpdatedIn(targetNftId)
]
-
[
__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()
]
-
[
setInitialState(ttype, state)
] -
[
setStateTransition(ttype, oldState, newState)
] -
[
hasLifecycle(objectType)
] -
[
getInitialState(objectType)
] -
[
checkTransition(stateId, objectType, expectedFromId, toId)
] -
[
isValidTransition(objectType, fromId, toId)
]
-
[
LogProductStoreComponentInfoCreated(componentNftId, state, createdby, txOrigin)
] -
[
LogProductStoreComponentInfoUpdated(componentNftId, oldState, newState, updatedBy, txOrigin, lastUpdatedIn)
] -
[
LogProductStorePoolInfoCreated(poolNftId, state, createdBy, txOrigin)
] -
[
LogProductStorePoolInfoUpdated(poolNftId, oldState, newState, updatedBy, txOrigin, lastUpdatedIn)
] -
[
LogProductStoreDistributorTypeInfoCreated(distributorType, state, createdBy, txOrigin)
] -
[
LogProductStoreDistributorTypeInfoUpdated(distributorType, oldState, newState, updatedBy, txOrigin, lastUpdatedIn)
] -
[
LogProductStoreDistributorInfoCreated(distributorNftId, state, createdBy, txOrigin)
] -
[
LogProductStoreDistributorInfoUpdated(distributorNftId, oldState, newState, updatedBy, txOrigin, lastUpdatedIn)
] -
[
LogProductStoreReferralInfoCreated(referralId, state, createdBy, txOrigin)
] -
[
LogProductStoreReferralInfoUpdated(referralId, oldState, newState, updatedBy, txOrigin, lastUpdatedIn)
] -
[
LogProductStoreBundleInfoCreated(bundleNftId, state, createdBy, txOrigin)
] -
[
LogProductStoreBundleInfoUpdated(bundleNftId, oldState, newState, updatedBy, txOrigin, lastUpdatedIn)
] -
[
LogProductStoreRequestInfoCreated(requestId, state, createdBy, txOrigin)
] -
[
LogProductStoreRequestInfoUpdated(requestId, oldState, newState, updatedBy, txOrigin, lastUpdatedIn)
]
-
[
LogBalanceStoreTargetRegistered(targetNftId)
] -
[
LogBalanceStoreFeesIncreased(targetNftId, addedAmount, newBalance, lastUpdatedIn)
] -
[
LogBalanceStoreFeesDecreased(targetNftId, addedAmount, newBalance, lastUpdatedIn)
] -
[
LogBalanceStoreLockedIncreased(targetNftId, addedAmount, newBalance, lastUpdatedIn)
] -
[
LogBalanceStoreLockedDecreased(targetNftId, addedAmount, newBalance, lastUpdatedIn)
] -
[
LogBalanceStoreBalanceIncreased(targetNftId, addedAmount, newBalance, lastUpdatedIn)
] -
[
LogBalanceStoreBalanceDecreased(targetNftId, addedAmount, newBalance, lastUpdatedIn)
]
-
[
AuthorityUpdated(authority)
]
-
[
Initialized(version)
]