Oracle

Contains interfaces and contracts related to oracles.

Contracts

IOracleComponent

import "@etherisc/gif-next/contracts/oracle/IOracleComponent.sol";
Functions
  • [request(requestId, requesterNftId, requestData, expiryAt)]

  • [cancel(requestId)]

  • [isVerifying()]

IInstanceLinkedComponent
  • [withdrawFees(amount)]

  • [getInstance()]

IAuthorizedComponent
  • [getAuthorization()]

IComponent
  • [getName()]

  • [getToken()]

  • [getTokenHandler()]

  • [getWallet()]

  • [isNftInterceptor()]

  • [isRegistered()]

  • [getComponentInfo()]

  • [getInitialComponentInfo()]

ITransferInterceptor
  • [nftTransferFrom(from, to, tokenId, operator)]

IRegisterable
  • [isActive()]

  • [getInitialInfo()]

IRelease
  • [getRelease()]

INftOwnable
  • [linkToRegisteredNftId()]

  • [getNftId()]

  • [getOwner()]

IRegistryLinked
  • [getRegistry()]

IERC165
  • [supportsInterface(interfaceId)]

IAccessManaged
  • [authority()]

  • [setAuthority()]

  • [isConsumingScheduledOp()]

Events
IComponent
  • [LogComponentWalletAddressChanged(oldWallet, newWallet)]

  • [LogComponentWalletTokensTransferred(from, to, amount)]

  • [LogComponentTokenHandlerApproved(tokenHandler, token, limit, isMaxAmount)]

INftOwnable
  • [LogNftOwnableNftLinkedToAddress(nftId, owner)]

IAccessManaged
  • [AuthorityUpdated(authority)]

request(RequestId requestId, NftId requesterNftId, bytes requestData, Timestamp expiryAt) external

callback method for requesting some data from the oracle

cancel(RequestId requestId) external

callback method for cancelling the specified oracle request

isVerifying() → bool verifying external

returns true iff the component needs to be called when selling/renewing policis

Oracle

import "@etherisc/gif-next/contracts/oracle/Oracle.sol";
Functions
  • [request(requestId, requesterId, requestData, expiryAt)]

  • [cancel(requestId)]

  • [isVerifying()]

  • [withdrawFees(amount)]

  • [__Oracle_init(registry, productNftId, authorization, initialOwner, name)]

  • [_request(requestId, requesterId, requestData, expiryAt)]

  • [_cancel(requestId)]

  • [_respond(requestId, responseData)]

InstanceLinkedComponent
  • [getInstance()]

  • [getAuthorization()]

  • [_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
  • [__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
  • [__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
IComponent
  • [LogComponentWalletAddressChanged(oldWallet, newWallet)]

  • [LogComponentWalletTokensTransferred(from, to, amount)]

  • [LogComponentTokenHandlerApproved(tokenHandler, token, limit, isMaxAmount)]

INftOwnable
  • [LogNftOwnableNftLinkedToAddress(nftId, owner)]

IAccessManaged
  • [AuthorityUpdated(authority)]

Initializable
  • [Initialized(version)]

request(RequestId requestId, NftId requesterId, bytes requestData, Timestamp expiryAt) external

cancel(RequestId requestId) external

callback method for cancelling the specified oracle request

isVerifying() → bool verifying external

Not relevant for oracle components, always returns false.

withdrawFees(Amount amount) → Amount external

Not relevant for oracle components

__Oracle_init(address registry, NftId productNftId, contract IAuthorization authorization, address initialOwner, string name) internal

_request(RequestId requestId, NftId requesterId, bytes requestData, Timestamp expiryAt) internal

Internal function for handling requests. Empty implementation. Overwrite this function to implement use case specific handling for oracle calls.

_cancel(RequestId requestId) internal

Internal function for cancelling requests. Empty implementation. Overwrite this function to implement use case specific cancelling.

_respond(RequestId requestId, bytes responseData) internal

Internal function for handling oracle responses. Default implementation sends response back to oracle service. Use this function in use case specific external/public functions to handle use case specific response handling.

BasicOracle

import "@etherisc/gif-next/contracts/oracle/BasicOracle.sol";
Functions
  • [respond(requestId, responseData)]

  • [_initializeBasicOracle(registry, instanceNftId, authorization, initialOwner, name)]

Oracle
  • [request(requestId, requesterId, requestData, expiryAt)]

  • [cancel(requestId)]

  • [isVerifying()]

  • [withdrawFees(amount)]

  • [__Oracle_init(registry, productNftId, authorization, initialOwner, name)]

  • [_request(requestId, requesterId, requestData, expiryAt)]

  • [_cancel(requestId)]

  • [_respond(requestId, responseData)]

InstanceLinkedComponent
  • [getInstance()]

  • [getAuthorization()]

  • [_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
  • [__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
  • [__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
IComponent
  • [LogComponentWalletAddressChanged(oldWallet, newWallet)]

  • [LogComponentWalletTokensTransferred(from, to, amount)]

  • [LogComponentTokenHandlerApproved(tokenHandler, token, limit, isMaxAmount)]

INftOwnable
  • [LogNftOwnableNftLinkedToAddress(nftId, owner)]

IAccessManaged
  • [AuthorityUpdated(authority)]

Initializable
  • [Initialized(version)]

respond(RequestId requestId, bytes responseData) external

_initializeBasicOracle(address registry, NftId instanceNftId, contract IAuthorization authorization, address initialOwner, string name) internal

BasicOracleAuthorization

import "@etherisc/gif-next/contracts/oracle/BasicOracleAuthorization.sol";
Functions
  • [constructor(componentName, commitHash)]

  • [_setupServiceTargets()]

  • [_setupTargetAuthorizations()]

Authorization
  • [getTokenHandlerName()]

  • [getTokenHandlerTarget()]

  • [getTarget(targetName)]

  • [getTargets()]

  • [targetExists(target)]

  • [_setupTargets()]

  • [_setupRoles()]

  • [_setupTokenHandlerAuthorizations()]

  • [_addCustomRole(roleId, adminRoleId, maxMemberCount, name)]

  • [_addGifTarget(contractName)]

  • [_addInstanceTarget(contractName)]

  • [_addTarget(name)]

  • [_toTargetRoleId(targetDomain)]

  • [_toTargetRoleName(targetName)]

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

InitializableERC165
  • [__ERC165_init()]

  • [_initializeERC165()]

  • [_registerInterface(interfaceId)]

  • [_registerInterfaceNotInitializing(interfaceId)]

  • [supportsInterface(interfaceId)]

Initializable
  • [_checkInitializing()]

  • [_disableInitializers()]

  • [_getInitializedVersion()]

  • [_isInitializing()]

Events
Initializable
  • [Initialized(version)]

constructor(string componentName, string commitHash) public

_setupServiceTargets() internal

Sets up the relevant service targets for the component. Overwrite this function for use case specific authorizations.

_setupTargetAuthorizations() internal

Sets up the relevant target authorizations for the component. Overwrite this function for use case specific authorizations.

OracleService

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

  • [request(oracleNftId, requestData, expiryAt, callbackMethodName)]

  • [respond(requestId, responseData)]

  • [resend(requestId)]

  • [cancel(requestId)]

  • [_checkRequestParams(registry, oracleNftId, requesterInfo, expiryAt, callbackMethodName)]

  • [_checkAndGetRequestInfo(instance, requestId, callerNftId, callerIsOracle)]

  • [_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
IOracleService
  • [LogOracleServiceRequestCreated(requestId, requesterNftId, oracleNftId, expiryAt)]

  • [LogOracleServiceResponseProcessed(requestId, oracleNftId)]

  • [LogOracleServiceDeliveryFailed(requestId, requesterAddress, functionSignature)]

  • [LogOracleServiceResponseResent(requestId, requesterNftId)]

  • [LogOracleServiceRequestCancelled(requestId, requesterNftId)]

INftOwnable
  • [LogNftOwnableNftLinkedToAddress(nftId, owner)]

IAccessManaged
  • [AuthorityUpdated(authority)]

Initializable
  • [Initialized(version)]

_initialize(address owner, bytes data) internal

request(NftId oracleNftId, bytes requestData, Timestamp expiryAt, string callbackMethodName) → RequestId requestId external

send an oracle request to the specified oracle component. the function returns the id of the newly created request. permissioned: only registered components may send requests to oracles.

respond(RequestId requestId, bytes responseData) → bool success external

respond to oracle request by oracle compnent. permissioned: only the oracle component linked to the request id may call this method

resend(RequestId requestId) external

Resend a failed response to the requester. Only requests in state FAILED may be resent. The request state changes to FULFILLED when calling the callback method of the requester is successful. Permissioned: only the receiving oracle may resend a request

cancel(RequestId requestId) external

Notify the oracle component that the specified request has become invalid. Only requests in state ACTIVE may be cancelled. Permissioned: only the requester may cancel a request

_checkRequestParams(contract IRegistry registry, NftId oracleNftId, struct IRegistry.ObjectInfo requesterInfo, Timestamp expiryAt, string callbackMethodName) → NftId requesterNftId, contract IOracleComponent oracle internal

_checkAndGetRequestInfo(contract IInstance instance, RequestId requestId, NftId callerNftId, bool callerIsOracle) → struct IOracle.RequestInfo info internal

_getDomain() → ObjectType internal

OracleServiceManager

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

  • [getOracleService()]

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 service implementation and deploys instance

getOracleService() → contract OracleService oracleService external