Registry

Contains interfaces and contracts related to the registry.

Contracts

IRegistry

import "@etherisc/gif-next/contracts/registry/IRegistry.sol";
Functions
  • [registerRegistry(nftId, chainId, chainRegistryAddress)]

  • [registerService(serviceInfo, serviceVersion, serviceDomain)]

  • [register(info)]

  • [registerWithCustomType(info)]

  • [getInitialRelease()]

  • [getNextRelease()]

  • [getLatestRelease()]

  • [getReleaseInfo(release)]

  • [chainIds()]

  • [getChainId(idx)]

  • [getRegistryNftId(chainId)]

  • [getObjectCount()]

  • [getNftIdForAddress(objectAddress)]

  • [ownerOf(nftId)]

  • [isOwnerOf(nftId, expectedOwner)]

  • [ownerOf(contractAddress)]

  • [getObjectInfo(nftId)]

  • [getParentNftId(nftId)]

  • [isObjectType(nftId, expectedObjectType)]

  • [isObjectType(contractAddress, expectedObjectType)]

  • [getObjectAddress(nftId)]

  • [getObjectInfo(object)]

  • [isRegistered(nftId)]

  • [isRegistered(contractAddress)]

  • [isRegisteredService(contractAddress)]

  • [isRegisteredComponent(object)]

  • [isActiveRelease(version)]

  • [getServiceAddress(serviceDomain, releaseVersion)]

  • [getProtocolNftId()]

  • [getNftId()]

  • [getOwner()]

  • [getChainNftAddress()]

  • [getReleaseRegistryAddress()]

  • [getStakingAddress()]

  • [getTokenRegistryAddress()]

  • [getRegistryAdminAddress()]

  • [getAuthority()]

IERC165
  • [supportsInterface(interfaceId)]

Events
  • [LogRegistryObjectRegistered(nftId, parentNftId, objectType, isInterceptor, objectAddress, initialOwner)]

  • [LogRegistryServiceRegistered(majorVersion, domain)]

  • [LogRegistryChainRegistryRegistered(nftId, chainId, chainRegistryAddress)]

registerRegistry(NftId nftId, uint256 chainId, address chainRegistryAddress) external

Registers a registry contract for a specified chain. Only one chain registry may be registered per chain

registerService(struct IRegistry.ObjectInfo serviceInfo, VersionPart serviceVersion, ObjectType serviceDomain) → NftId nftId external

Register a service with using the provided domain and version. The function returns a newly minted service NFT ID. May only be used to register services.

register(struct IRegistry.ObjectInfo info) → NftId nftId external

Register an object with a known core type. The function returns a newly minted object NFT ID. May not be used to register services.

registerWithCustomType(struct IRegistry.ObjectInfo info) → NftId nftId external

Register an object with a custom type. The function returns a newly minted object NFT ID. This function is reserved for GIF releases > 3. May not be used to register known core types.

getInitialRelease() → VersionPart external

getNextRelease() → VersionPart external

getLatestRelease() → VersionPart external

getReleaseInfo(VersionPart release) → struct IRelease.ReleaseInfo external

chainIds() → uint256 external

Returns the number of supported chains.

getChainId(uint256 idx) → uint256 external

Returns the chain id at the specified index.

getRegistryNftId(uint256 chainId) → NftId nftId external

Returns the NFT ID of the registry for the specified chain.

getObjectCount() → uint256 external

getNftIdForAddress(address objectAddress) → NftId nftId external

ownerOf(NftId nftId) → address external

isOwnerOf(NftId nftId, address expectedOwner) → bool external

ownerOf(address contractAddress) → address external

getObjectInfo(NftId nftId) → struct IRegistry.ObjectInfo info external

getParentNftId(NftId nftId) → NftId parentNftId external

isObjectType(NftId nftId, ObjectType expectedObjectType) → bool external

isObjectType(address contractAddress, ObjectType expectedObjectType) → bool external

getObjectAddress(NftId nftId) → address objectAddress external

getObjectInfo(address object) → struct IRegistry.ObjectInfo info external

Returns the object info for the specified object address.

isRegistered(NftId nftId) → bool external

isRegistered(address contractAddress) → bool external

isRegisteredService(address contractAddress) → bool external

isRegisteredComponent(address object) → bool external

isActiveRelease(VersionPart version) → bool external

getServiceAddress(ObjectType serviceDomain, VersionPart releaseVersion) → address serviceAddress external

getProtocolNftId() → NftId protocolNftId external

getNftId() → NftId nftId external

getOwner() → address external

getChainNftAddress() → address external

getReleaseRegistryAddress() → address external

getStakingAddress() → address external

getTokenRegistryAddress() → address external

getRegistryAdminAddress() → address external

getAuthority() → address external

LogRegistryObjectRegistered(NftId nftId, NftId parentNftId, ObjectType objectType, bool isInterceptor, address objectAddress, address initialOwner) event

LogRegistryServiceRegistered(VersionPart majorVersion, ObjectType domain) event

LogRegistryChainRegistryRegistered(NftId nftId, uint256 chainId, address chainRegistryAddress) event

IRegistryService

import "@etherisc/gif-next/contracts/registry/IRegistryService.sol";
Functions
  • [registerStake(info)]

  • [registerInstance(instance, owner)]

  • [registerProduct(product, owner)]

  • [registerProductLinkedComponent(component, objectType, owner)]

  • [registerDistributor(info)]

  • [registerPolicy(info)]

  • [registerBundle(info)]

IService
  • [getDomain()]

  • [getRoleId()]

IVersionable
  • [initializeVersionable(activatedBy, activationData)]

  • [upgradeVersionable(upgradeData)]

  • [getVersion()]

IRegisterable
  • [isActive()]

  • [getInitialInfo()]

IRelease
  • [getRelease()]

INftOwnable
  • [linkToRegisteredNftId()]

  • [getNftId()]

  • [getOwner()]

IRegistryLinked
  • [getRegistry()]

IERC165
  • [supportsInterface(interfaceId)]

IAccessManaged
  • [authority()]

  • [setAuthority()]

  • [isConsumingScheduledOp()]

Events
INftOwnable
  • [LogNftOwnableNftLinkedToAddress(nftId, owner)]

IAccessManaged
  • [AuthorityUpdated(authority)]

registerStake(struct IRegistry.ObjectInfo info) → NftId nftId external

registerInstance(contract IRegisterable instance, address owner) → struct IRegistry.ObjectInfo info external

registerProduct(contract IComponent product, address owner) → struct IRegistry.ObjectInfo info external

registerProductLinkedComponent(contract IComponent component, ObjectType objectType, address owner) → struct IRegistry.ObjectInfo info external

registerDistributor(struct IRegistry.ObjectInfo info) → NftId nftId external

registerPolicy(struct IRegistry.ObjectInfo info) → NftId nftId external

registerBundle(struct IRegistry.ObjectInfo info) → NftId nftId external

ITransferInterceptor

import "@etherisc/gif-next/contracts/registry/ITransferInterceptor.sol";
Functions
  • [nftTransferFrom(from, to, tokenId, operator)]

nftTransferFrom(address from, address to, uint256 tokenId, address operator) external

ChainNft

import "@etherisc/gif-next/contracts/registry/ChainNft.sol";
Modifiers
Functions
  • [constructor(registry)]

  • [mint(to, tokenId)]

  • [mint(to, interceptor, uri)]

  • [transferFrom(from, to, tokenId)]

  • [burn(tokenId)]

  • [setURI(tokenId, uri)]

  • [exists(tokenId)]

  • [tokenURI(tokenId)]

  • [getInterceptor(tokenId)]

  • [getRegistryAddress()]

  • [totalMinted()]

  • [calculateTokenId(idIndex, chainId)]

  • [calculateTokenId(idIndex)]

  • [getNextTokenId()]

ERC721Enumerable
  • [supportsInterface(interfaceId)]

  • [tokenOfOwnerByIndex(owner, index)]

  • [totalSupply()]

  • [tokenByIndex(index)]

  • [_update(to, tokenId, auth)]

  • [_increaseBalance(account, amount)]

ERC721
  • [balanceOf(owner)]

  • [ownerOf(tokenId)]

  • [name()]

  • [symbol()]

  • [_baseURI()]

  • [approve(to, tokenId)]

  • [getApproved(tokenId)]

  • [setApprovalForAll(operator, approved)]

  • [isApprovedForAll(owner, operator)]

  • [safeTransferFrom(from, to, tokenId)]

  • [safeTransferFrom(from, to, tokenId, data)]

  • [_ownerOf(tokenId)]

  • [_getApproved(tokenId)]

  • [_isAuthorized(owner, spender, tokenId)]

  • [_checkAuthorized(owner, spender, tokenId)]

  • [_mint(to, tokenId)]

  • [_safeMint(to, tokenId)]

  • [_safeMint(to, tokenId, data)]

  • [_burn(tokenId)]

  • [_transfer(from, to, tokenId)]

  • [_safeTransfer(from, to, tokenId)]

  • [_safeTransfer(from, to, tokenId, data)]

  • [_approve(to, tokenId, auth)]

  • [_approve(to, tokenId, auth, emitEvent)]

  • [_setApprovalForAll(owner, operator, approved)]

  • [_requireOwned(tokenId)]

Events
  • [LogTokenInterceptorAddress(tokenId, interceptor)]

IERC721
  • [Transfer(from, to, tokenId)]

  • [Approval(owner, approved, tokenId)]

  • [ApprovalForAll(owner, operator, approved)]

onlyRegistry() modifier

constructor(address registry) public

mint(address to, uint256 tokenId) external

mints a token for a specified token id not part of the IRegistry interface only needed for initial registry setup (protocol and global registry objects)

mint(address to, address interceptor, string uri) → uint256 tokenId public

mints the next token to register new objects non-zero transferInterceptors are recorded and called during nft token transfers. the contract receiving such a notification may decides to revert or record the transfer

transferFrom(address from, address to, uint256 tokenId) public

Amend the open zeppelin transferFrom function by an interceptor call if such an interceptor is defined for the nft token id. This allows distribution, product and pool components to be notified when distributors, policies and bundles are transferred.

burn(uint256 tokenId) external

setURI(uint256 tokenId, string uri) external

exists(uint256 tokenId) → bool external

tokenURI(uint256 tokenId) → string public

See {IERC721Metadata-tokenURI}.

getInterceptor(uint256 tokenId) → address external

getRegistryAddress() → address external

totalMinted() → uint256 external

calculateTokenId(uint256 idIndex, uint256 chainId) → uint256 id public

token id calculation based on an index value that is supposed to increase with every minted token

requirement: each chain registry produces token ids that are guaranteed to not collide with any token id genereated on a different chain

format concat(counter,chainid,2 digits for len-of-chain-id) restriction chainid up to 99 digits decode: from right to left: - 2 right most digits encode length of chainid - move number of digits to left as determined above (→ chainid) - the reminder to the left is the counter

special cases 1101 → decentralized insurance protocol 2102 → global registry 2xxxxx → chain registry, where xxxxx = <chain-part>

examples 1101 ^^ ^ || - 1-digit chain id |-- chain id = 1 (mainnet) +-- 1st token id on mainnet (1 * 10 1 + 1) * 100 + 1 42987654321010 ^ ^ ^ | | +- 10-digit chain id | +-- chain id = 9876543210 (hypothetical chainid) +-- 42nd token id on this chain (42 * 10 10 + 9876543210) * 100 + 10 (index * 10 ** digits + chainid) * 100 + digits (1 < digits < 100)

calculateTokenId(uint256 idIndex) → uint256 public

getNextTokenId() → uint256 external

LogTokenInterceptorAddress(uint256 tokenId, address interceptor) event

Registry

import "@etherisc/gif-next/contracts/registry/Registry.sol";

Chain Registry contract implementing IRegistry. IRegistry for method details.

Modifiers
Functions
  • [constructor(admin, globalRegistry)]

  • [initialize(releaseRegistry, tokenRegistry, staking)]

  • [registerRegistry(nftId, chainId, registryAddress)]

  • [registerService(info, version, domain)]

  • [register(info)]

  • [registerWithCustomType(info)]

  • [getInitialRelease()]

  • [getNextRelease()]

  • [getLatestRelease()]

  • [getReleaseInfo(release)]

  • [chainIds()]

  • [getChainId(idx)]

  • [getRegistryNftId(chainId)]

  • [getObjectCount()]

  • [getNftId()]

  • [getProtocolNftId()]

  • [getNftIdForAddress(object)]

  • [ownerOf(nftId)]

  • [isOwnerOf(nftId, expectedOwner)]

  • [ownerOf(contractAddress)]

  • [getObjectInfo(nftId)]

  • [getParentNftId(nftId)]

  • [isObjectType(contractAddress, expectedObjectType)]

  • [isObjectType(nftId, expectedObjectType)]

  • [getObjectAddress(nftId)]

  • [getObjectInfo(object)]

  • [isRegistered(nftId)]

  • [isRegistered(object)]

  • [isRegisteredService(object)]

  • [isRegisteredComponent(object)]

  • [isActiveRelease(version)]

  • [getStakingAddress()]

  • [getTokenRegistryAddress()]

  • [getServiceAddress(serviceDomain, releaseVersion)]

  • [getReleaseRegistryAddress()]

  • [getChainNftAddress()]

  • [getRegistryAdminAddress()]

  • [getAuthority()]

  • [getOwner()]

  • [supportsInterface(interfaceId)]

  • [_register(info)]

  • [_getInterceptor(isInterceptor, objectType, objectAddress, parentIsInterceptor, parentObjectAddress)]

  • [_registerRegistry()]

  • [_registerForNft(info, updateAddressLookup)]

  • [_setAddressForNftId(nftId, objectAddress)]

  • [_getGlobalRegistryAddress(globalRegistry)]

AccessManaged
  • [authority()]

  • [setAuthority(newAuthority)]

  • [isConsumingScheduledOp()]

  • [_setAuthority(newAuthority)]

  • [_checkCanCall(caller, data)]

Initializable
  • [_checkInitializing()]

  • [_disableInitializers()]

  • [_getInitializedVersion()]

  • [_isInitializing()]

Events
IRegistry
  • [LogRegistryObjectRegistered(nftId, parentNftId, objectType, isInterceptor, objectAddress, initialOwner)]

  • [LogRegistryServiceRegistered(majorVersion, domain)]

  • [LogRegistryChainRegistryRegistered(nftId, chainId, chainRegistryAddress)]

IAccessManaged
  • [AuthorityUpdated(authority)]

Initializable
  • [Initialized(version)]

onlyDeployer() modifier

constructor(contract RegistryAdmin admin, address globalRegistry) public

Creates the registry contract and populates it with the protocol and registry objects. Internally deploys the ChainNft contract.

initialize(address releaseRegistry, address tokenRegistry, address staking) external

Wires release registry, token registry and staking contract to this registry. MUST be called by release registry.

registerRegistry(NftId nftId, uint256 chainId, address registryAddress) external

Registers a registry contract for a specified chain. Only one chain registry may be registered per chain

registerService(struct IRegistry.ObjectInfo info, VersionPart version, ObjectType domain) → NftId nftId external

Register a service with using the provided domain and version. The function returns a newly minted service NFT ID. May only be used to register services.

register(struct IRegistry.ObjectInfo info) → NftId nftId external

Register an object with a known core type. The function returns a newly minted object NFT ID. May not be used to register services.

registerWithCustomType(struct IRegistry.ObjectInfo info) → NftId nftId external

Register an object with a custom type. The function returns a newly minted object NFT ID. This function is reserved for GIF releases > 3. May not be used to register known core types.

getInitialRelease() → VersionPart external

earliest GIF major version

getNextRelease() → VersionPart external

next GIF release version to be released

getLatestRelease() → VersionPart external

latest active GIF release version

getReleaseInfo(VersionPart release) → struct IRelease.ReleaseInfo external

chainIds() → uint256 public

Returns the number of supported chains.

getChainId(uint256 idx) → uint256 public

Returns the chain id at the specified index.

getRegistryNftId(uint256 chainId) → NftId nftId public

Returns the NFT ID of the registry for the specified chain.

getObjectCount() → uint256 external

getNftId() → NftId nftId external

getProtocolNftId() → NftId nftId external

getNftIdForAddress(address object) → NftId id external

ownerOf(NftId nftId) → address public

isOwnerOf(NftId nftId, address expectedOwner) → bool public

ownerOf(address contractAddress) → address public

getObjectInfo(NftId nftId) → struct IRegistry.ObjectInfo external

getParentNftId(NftId nftId) → NftId parentNftId external

isObjectType(address contractAddress, ObjectType expectedObjectType) → bool external

isObjectType(NftId nftId, ObjectType expectedObjectType) → bool public

getObjectAddress(NftId nftId) → address external

getObjectInfo(address object) → struct IRegistry.ObjectInfo external

Returns the object info for the specified object address.

isRegistered(NftId nftId) → bool public

isRegistered(address object) → bool external

isRegisteredService(address object) → bool external

isRegisteredComponent(address object) → bool external

isActiveRelease(VersionPart version) → bool external

getStakingAddress() → address staking external

getTokenRegistryAddress() → address tokenRegistry external

getServiceAddress(ObjectType serviceDomain, VersionPart releaseVersion) → address service external

getReleaseRegistryAddress() → address external

getChainNftAddress() → address external

getRegistryAdminAddress() → address external

getAuthority() → address external

getOwner() → address owner public

supportsInterface(bytes4 interfaceId) → bool external

Returns true if this contract implements the interface defined by interfaceId. See the corresponding EIP section to learn more about how these ids are created.

This function call must use less than 30 000 gas.

_register(struct IRegistry.ObjectInfo info) → NftId nftId internal

registry protects only against tampering existing records, registering with invalid types pairs and 0 parent address

_getInterceptor(bool isInterceptor, ObjectType objectType, address objectAddress, bool parentIsInterceptor, address parentObjectAddress) → address interceptor internal

obtain interceptor address for this nft if applicable, address(0) otherwise special case: STAKES (parent may be any type) → no intercept call default case:

_registerRegistry() → NftId registryNftId internal

register this registry

_registerForNft(struct IRegistry.ObjectInfo info, bool updateAddressLookup) internal

Register the provided object info for the specified NFT ID.

_setAddressForNftId(NftId nftId, address objectAddress) internal

_getGlobalRegistryAddress(address globalRegistry) → address internal

RegistryAdmin

import "@etherisc/gif-next/contracts/registry/RegistryAdmin.sol";

The RegistryAdmin contract implements the central authorization for the GIF core contracts. These are the release independent registry and staking contracts and their respective helper contracts. The RegistryAdmin also manages the access from service contracts to the GIF core contracts

Functions
  • [constructor()]

  • [completeSetup(registry, authorization, release, gifAdmin, gifManager)]

  • [grantServiceRoleForAllVersions(service, domain)]

  • [getGifAdminRole()]

  • [getGifManagerRole()]

  • [_createCoreTargets(registryTargetName)]

  • [_createTargetAuthorizations(authorization)]

AccessAdmin
  • [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)]

AccessManagedUpgradeable
  • [__AccessManaged_init(initialAuthority)]

  • [__AccessManaged_init_unchained(initialAuthority)]

  • [authority()]

  • [setAuthority(newAuthority)]

  • [isConsumingScheduledOp()]

  • [_setAuthority(newAuthority)]

  • [_checkCanCall(caller, data)]

ContextUpgradeable
  • [__Context_init()]

  • [__Context_init_unchained()]

  • [_msgSender()]

  • [_msgData()]

  • [_contextSuffixLength()]

Initializable
  • [_checkInitializing()]

  • [_disableInitializers()]

  • [_getInitializedVersion()]

  • [_isInitializing()]

Events
IAccessAdmin
  • [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)]

IAccessManaged
  • [AuthorityUpdated(authority)]

Initializable
  • [Initialized(version)]

constructor() public

completeSetup(address registry, address authorization, VersionPart release, address gifAdmin, address gifManager) public

grantServiceRoleForAllVersions(contract IService service, ObjectType domain) external

getGifAdminRole() → RoleId external

getGifManagerRole() → RoleId external

_createCoreTargets(string registryTargetName) internal

_createTargetAuthorizations(contract IAuthorization authorization) internal

ReleaseRegistry

import "@etherisc/gif-next/contracts/registry/ReleaseRegistry.sol";

The ReleaseRegistry manages the lifecycle of major GIF releases and their services. The creation of a new GIF release is a multi-step process: 1. The creation of a new GIF release is initiated by the GIF admin. 2. A GIF manager then prepares the release by setting up the service authorization contract. 3. The GIF manager deploys and registers all related service contracts with the release registry. 4. The GIF admin verifies and activates the release. 3. The GIF admin may pause and resume a release.

Functions
  • [constructor(registry)]

  • [createNextRelease()]

  • [prepareNextRelease(serviceAuthorization, salt)]

  • [registerService(service)]

  • [activateNextRelease()]

  • [setActive(release, active)]

  • [predictDeterministicAddress(implementation, salt, deployer)]

  • [isActiveRelease(release)]

  • [getReleaseInfo(release)]

  • [releases()]

  • [getVersion(idx)]

  • [getNextVersion()]

  • [getLatestVersion()]

  • [getState(release)]

  • [getRemainingServicesToRegister()]

  • [getServiceAuthorization(release)]

  • [getRegistryAdmin()]

  • [getRegistry()]

  • [_verifyService(service, expectedAuthority, expectedVersion, expectedDomain)]

  • [_verifyServiceInfo(service, info, expectedOwner)]

ReleaseLifecycle
  • [_setupLifecycle()]

Lifecycle
  • [setInitialState(ttype, state)]

  • [setStateTransition(ttype, oldState, newState)]

  • [hasLifecycle(objectType)]

  • [getInitialState(objectType)]

  • [checkTransition(stateId, objectType, expectedFromId, toId)]

  • [isValidTransition(objectType, fromId, toId)]

AccessManaged
  • [authority()]

  • [setAuthority(newAuthority)]

  • [isConsumingScheduledOp()]

  • [_setAuthority(newAuthority)]

  • [_checkCanCall(caller, data)]

Events
  • [LogReleaseCreation(admin, release, salt)]

  • [LogReleaseActivation(release)]

  • [LogReleaseDisabled(release)]

  • [LogReleaseEnabled(release)]

IAccessManaged
  • [AuthorityUpdated(authority)]

constructor(contract Registry registry) public

createNextRelease() → VersionPart external

Initiates the creation of a new GIF release by the GIF admin. Sets previous release into SKIPPED state if it was created but not activated. Sets the new release into state SCHEDULED.

prepareNextRelease(contract IServiceAuthorization serviceAuthorization, bytes32 salt) → contract ReleaseAdmin releaseAdmin, VersionPart releaseVersion, bytes32 releaseSalt external

registerService(contract IService service) → NftId nftId external

activateNextRelease() external

setActive(VersionPart release, bool active) public

stop/resume operations with restricted functions

predictDeterministicAddress(address implementation, bytes32 salt, address deployer) → address predicted external

isActiveRelease(VersionPart release) → bool public

getReleaseInfo(VersionPart release) → struct IRelease.ReleaseInfo external

releases() → uint256 external

Returns the number of created releases. Releases might be in another state than ACTIVE.

getVersion(uint256 idx) → VersionPart release external

Returns the n-th release version. Valid values for idx [0 .. releases() - 1]

getNextVersion() → VersionPart public

getLatestVersion() → VersionPart external

Returns the latest activated relase version. There is no guarantee that the release is not currently paused.

getState(VersionPart release) → StateId stateId external

getRemainingServicesToRegister() → uint256 services external

getServiceAuthorization(VersionPart release) → contract IServiceAuthorization serviceAuthorization external

getRegistryAdmin() → address external

getRegistry() → contract IRegistry external

_verifyService(contract IService service, address expectedAuthority, VersionPart expectedVersion, ObjectType expectedDomain) → struct IRegistry.ObjectInfo serviceInfo, ObjectType serviceDomain, VersionPart serviceVersion internal

_verifyServiceInfo(contract IService service, struct IRegistry.ObjectInfo info, address expectedOwner) internal

LogReleaseCreation(contract IAccessAdmin admin, VersionPart release, bytes32 salt) event

LogReleaseActivation(VersionPart release) event

LogReleaseDisabled(VersionPart release) event

LogReleaseEnabled(VersionPart release) event

TokenRegistry

import "@etherisc/gif-next/contracts/registry/TokenRegistry.sol";

The TokenRegistry contract is used to whitelist/manage ERC-20 of tokens per major release. Only whitelisted tokens can be used as default tokens for products, distribution and pools components.

Functions
  • [constructor(registry, dipToken)]

  • [registerToken(tokenAddress)]

  • [registerRemoteToken(chainId, token, decimals, symbol)]

  • [setActive(chainId, token, active)]

  • [setActiveForVersion(chainId, token, release, active)]

  • [setActiveWithVersionCheck(chainId, token, release, active, enforceVersionCheck)]

  • [_setActiveWithVersionCheck(chainId, token, release, active, enforceVersionCheck)]

  • [getDipToken()]

  • [tokens()]

  • [getTokenInfo(idx)]

  • [getTokenInfo(chainId, token)]

  • [isRegistered(chainId, token)]

  • [isActive(chainId, token, release)]

  • [getDipTokenAddress()]

  • [getRegistry()]

  • [_verifyOnchainToken(tokenAddress)]

  • [_implementsErc20Functions(token)]

  • [_registerToken(chainId, token, decimals, symbol)]

AccessManaged
  • [authority()]

  • [setAuthority(newAuthority)]

  • [isConsumingScheduledOp()]

  • [_setAuthority(newAuthority)]

  • [_checkCanCall(caller, data)]

Events
  • [LogTokenRegistryTokenRegistered(chainId, token, decimals, symbol)]

  • [LogTokenRegistryTokenGlobalStateSet(chainId, token, active)]

  • [LogTokenRegistryTokenStateSet(chainId, token, release, active)]

IAccessManaged
  • [AuthorityUpdated(authority)]

onlyRegisteredToken(ChainId chainId, address token) modifier

enforces msg.sender is owner of nft (or initial owner of nft ownable)

constructor(contract IRegistry registry, contract IERC20Metadata dipToken) public

registerToken(address tokenAddress) external

register an onchain token. this function verifies that the provided token address is a contract that implements the non optional erc20 view functions.

registerRemoteToken(ChainId chainId, address token, uint8 decimals, string symbol) external

register the remote token with the provided attributes. this function may not be used for tokens when chainId == block.chainid.

setActive(ChainId chainId, address token, bool active) external

set active flag on token itself. when setting a token to active=false isActive will return false regardless of release specific active value.

setActiveForVersion(ChainId chainId, address token, VersionPart release, bool active) external

sets active state for specified token and release (major version). internally calls setActiveWithVersionCheck() with enforcing version check. token state is informative, registry have no clue about used tokens component owner is responsible for token selection and operations service MUST deny registration of component with inactive token.

setActiveWithVersionCheck(ChainId chainId, address token, VersionPart release, bool active, bool enforceVersionCheck) external

as setActiveForVersion() with the option to skip the version check. enforcing the version check checks if the provided major version with the release manager. the function reverts if the provided release is unknown to the release manager.

_setActiveWithVersionCheck(ChainId chainId, address token, VersionPart release, bool active, bool enforceVersionCheck) internal

getDipToken() → contract IERC20Metadata dipToken external

returns the dip token for this chain

tokens() → uint256 external

returns the number of registered tokens

getTokenInfo(uint256 idx) → struct TokenRegistry.TokenInfo tokenInfo external

returns the token info for the specified index position [0 .. tokens() - 1].

getTokenInfo(ChainId chainId, address token) → struct TokenRegistry.TokenInfo tokenInfo external

returns the token info for the specified token coordinates.

isRegistered(ChainId chainId, address token) → bool public

returns true iff the specified token has been registered for this TokenRegistry contract.

isActive(ChainId chainId, address token, VersionPart release) → bool external

returns true iff both the token is active for the specfied release and the global token state is active

getDipTokenAddress() → address external

getRegistry() → contract IRegistry public

returns the dip token for this chain

_verifyOnchainToken(address tokenAddress) → contract IERC20Metadata token internal

checks if provided token address refers to a smart contract that implements erc20 functionality (via its non-optional functions)

_implementsErc20Functions(contract IERC20Metadata token) → bool implementsErc20Functions internal

checks availability of non-optional view functions https://eips.ethereum.org/EIPS/eip-20#methods

_registerToken(ChainId chainId, address token, uint8 decimals, string symbol) internal

some sanity checks to prevent unintended registration: - token not yet registered - chainId not zero - token address not zero

LogTokenRegistryTokenRegistered(ChainId chainId, address token, uint256 decimals, string symbol) event

LogTokenRegistryTokenGlobalStateSet(ChainId chainId, address token, bool active) event

LogTokenRegistryTokenStateSet(ChainId chainId, address token, VersionPart release, bool active) event

RegistryService

import "@etherisc/gif-next/contracts/registry/RegistryService.sol";
Functions
  • [_initialize(owner, data)]

  • [registerStaking(staking, owner)]

  • [registerInstance(instance, owner)]

  • [registerProduct(product, initialOwner)]

  • [registerProductLinkedComponent(component, objectType, initialOwner)]

  • [registerDistributor(info)]

  • [registerPolicy(info)]

  • [registerBundle(info)]

  • [registerStake(info)]

  • [_getAndVerifyContractInfo(registerable, expectedType, expectedOwner)]

  • [_verifyObjectInfo(info, expectedType)]

  • [_getDomain()]

Service
  • [__Service_init(authority, registry, initialOwner)]

  • [getDomain()]

  • [getVersion()]

  • [getRoleId()]

  • [_getServiceAddress(domain)]

ReentrancyGuardUpgradeable
  • [__ReentrancyGuard_init()]

  • [__ReentrancyGuard_init_unchained()]

  • [_reentrancyGuardEntered()]

Versionable
  • [initializeVersionable(activatedBy, data)]

  • [upgradeVersionable(data)]

  • [_upgrade(data)]

Registerable
  • [__Registerable_init(authority, registry, parentNftId, objectType, isInterceptor, initialOwner, data)]

  • [isActive()]

  • [getRelease()]

  • [getInitialInfo()]

NftOwnable
  • [_checkNftType(nftId, expectedObjectType)]

  • [__NftOwnable_init(registry, initialOwner)]

  • [linkToRegisteredNftId()]

  • [getNftId()]

  • [getOwner()]

  • [_linkToNftOwnable(nftOwnableAddress)]

RegistryLinked
  • [__RegistryLinked_init(registry)]

  • [getRegistry()]

InitializableERC165
  • [__ERC165_init()]

  • [_initializeERC165()]

  • [_registerInterface(interfaceId)]

  • [_registerInterfaceNotInitializing(interfaceId)]

  • [supportsInterface(interfaceId)]

AccessManagedUpgradeable
  • [__AccessManaged_init(initialAuthority)]

  • [__AccessManaged_init_unchained(initialAuthority)]

  • [authority()]

  • [setAuthority(newAuthority)]

  • [isConsumingScheduledOp()]

  • [_setAuthority(newAuthority)]

  • [_checkCanCall(caller, data)]

ContextUpgradeable
  • [__Context_init()]

  • [__Context_init_unchained()]

  • [_msgSender()]

  • [_msgData()]

  • [_contextSuffixLength()]

Initializable
  • [_checkInitializing()]

  • [_disableInitializers()]

  • [_getInitializedVersion()]

  • [_isInitializing()]

Events
INftOwnable
  • [LogNftOwnableNftLinkedToAddress(nftId, owner)]

IAccessManaged
  • [AuthorityUpdated(authority)]

Initializable
  • [Initialized(version)]

_initialize(address owner, bytes data) internal

top level initializer

registerStaking(contract IRegisterable staking, address owner) → struct IRegistry.ObjectInfo info external

registerInstance(contract IRegisterable instance, address owner) → struct IRegistry.ObjectInfo info external

registerProduct(contract IComponent product, address initialOwner) → struct IRegistry.ObjectInfo info external

registerProductLinkedComponent(contract IComponent component, ObjectType objectType, address initialOwner) → struct IRegistry.ObjectInfo info external

registerDistributor(struct IRegistry.ObjectInfo info) → NftId nftId external

registerPolicy(struct IRegistry.ObjectInfo info) → NftId nftId external

registerBundle(struct IRegistry.ObjectInfo info) → NftId nftId external

registerStake(struct IRegistry.ObjectInfo info) → NftId nftId external

_getAndVerifyContractInfo(contract IRegisterable registerable, ObjectType expectedType, address expectedOwner) → struct IRegistry.ObjectInfo info internal

_verifyObjectInfo(struct IRegistry.ObjectInfo info, ObjectType expectedType) internal

_getDomain() → ObjectType serviceDomain internal

RegistryServiceManager

import "@etherisc/gif-next/contracts/registry/RegistryServiceManager.sol";
Functions
  • [constructor(authority, registry, salt)]

  • [getRegistryService()]

ProxyManager
  • [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)]

NftOwnable
  • [_checkNftType(nftId, expectedObjectType)]

  • [__NftOwnable_init(registry, initialOwner)]

  • [linkToRegisteredNftId()]

  • [getNftId()]

  • [getOwner()]

  • [_linkToNftOwnable(nftOwnableAddress)]

RegistryLinked
  • [__RegistryLinked_init(registry)]

  • [getRegistry()]

InitializableERC165
  • [__ERC165_init()]

  • [_initializeERC165()]

  • [_registerInterface(interfaceId)]

  • [_registerInterfaceNotInitializing(interfaceId)]

  • [supportsInterface(interfaceId)]

Initializable
  • [_checkInitializing()]

  • [_disableInitializers()]

  • [_getInitializedVersion()]

  • [_isInitializing()]

Events
ProxyManager
  • [LogProxyManagerVersionableDeployed(proxy, initialImplementation)]

  • [LogProxyManagerVersionableUpgraded(proxy, upgradedImplementation)]

INftOwnable
  • [LogNftOwnableNftLinkedToAddress(nftId, owner)]

Initializable
  • [Initialized(version)]

constructor(address authority, address registry, bytes32 salt) public

initializes proxy manager with registry service implementation and deploys registry

getRegistryService() → contract RegistryService registryService external