Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #542 #543

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/distribution/Distribution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ abstract contract Distribution is
$._distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
$._componentService = IComponentService(_getServiceAddress(COMPONENT()));

registerInterface(type(IDistributionComponent).interfaceId);
_registerInterface(type(IDistributionComponent).interfaceId);
}

/// @dev Sets the distribution fees to the provided values.
Expand Down
6 changes: 3 additions & 3 deletions contracts/distribution/DistributionService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ contract DistributionService is
bytes memory data
)
internal
initializer
virtual override
initializer()
{
address initialOwner;
address registryAddress;
(registryAddress, initialOwner) = abi.decode(data, (address, address));
// TODO while DistributionService is not deployed in DistributionServiceManager constructor
// owner is DistributionServiceManager deployer
initializeService(registryAddress, address(0), owner);
_initializeService(registryAddress, address(0), owner);

_componentService = IComponentService(_getServiceAddress(COMPONENT()));
_instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));

registerInterface(type(IDistributionService).interfaceId);
_registerInterface(type(IDistributionService).interfaceId);
}


Expand Down
4 changes: 2 additions & 2 deletions contracts/instance/Instance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contract Instance is
__AccessManaged_init(_instanceAdmin.authority());

// setup instance object info
initializeRegisterable(
_initializeRegisterable(
address(registry),
registry.getNftId(),
INSTANCE(),
Expand All @@ -84,7 +84,7 @@ contract Instance is
INSTANCE(),
getMajorVersion()));

registerInterface(type(IInstance).interfaceId);
_registerInterface(type(IInstance).interfaceId);
}

//--- Staking ----------------------------------------------------------//
Expand Down
6 changes: 3 additions & 3 deletions contracts/instance/InstanceService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -422,21 +422,21 @@ contract InstanceService is
bytes memory data
)
internal
initializer
virtual override
initializer()
{
(
address registryAddress,,
//address managerAddress
address authority
) = abi.decode(data, (address, address, address));

initializeService(registryAddress, authority, owner);
_initializeService(registryAddress, authority, owner);

_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
_stakingService = IStakingService(_getServiceAddress(STAKING()));

registerInterface(type(IInstanceService).interfaceId);
_registerInterface(type(IInstanceService).interfaceId);
}


Expand Down
2 changes: 1 addition & 1 deletion contracts/oracle/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ abstract contract Oracle is
$._oracleService = IOracleService(_getServiceAddress(ORACLE()));
$._componentService = IComponentService(_getServiceAddress(COMPONENT()));

registerInterface(type(IOracleComponent).interfaceId);
_registerInterface(type(IOracleComponent).interfaceId);
}


Expand Down
6 changes: 3 additions & 3 deletions contracts/oracle/OracleService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ contract OracleService is
bytes memory data
)
internal
initializer
virtual override
initializer()
{
address initialOwner;
address registryAddress;
(registryAddress, initialOwner) = abi.decode(data, (address, address));
initializeService(registryAddress, address(0), owner);
registerInterface(type(IOracleService).interfaceId);
_initializeService(registryAddress, address(0), owner);
_registerInterface(type(IOracleService).interfaceId);
}

function request(
Expand Down
6 changes: 3 additions & 3 deletions contracts/pool/BundleService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ contract BundleService is
bytes memory data
)
internal
initializer
virtual override
initializer()
{
address registryAddress;
address initialOwner;
(registryAddress, initialOwner) = abi.decode(data, (address, address));
// TODO while PoolService is not deployed in PoolServiceManager constructor
// owner is PoolServiceManager deployer
initializeService(registryAddress, address(0), owner);
_initializeService(registryAddress, address(0), owner);

_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
_componentService = IComponentService(_getServiceAddress(COMPONENT()));

registerInterface(type(IBundleService).interfaceId);
_registerInterface(type(IBundleService).interfaceId);
}


Expand Down
2 changes: 1 addition & 1 deletion contracts/pool/Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ abstract contract Pool is
$._bundleService = IBundleService(_getServiceAddress(BUNDLE()));
$._componentService = IComponentService(_getServiceAddress(COMPONENT()));

registerInterface(type(IPoolComponent).interfaceId);
_registerInterface(type(IPoolComponent).interfaceId);
}

/// @dev increases the staked tokens by the specified amount
Expand Down
6 changes: 3 additions & 3 deletions contracts/pool/PoolService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ contract PoolService is
bytes memory data
)
internal
initializer
virtual override
initializer()
{
(
address registryAddress,,
//address managerAddress
address authority
) = abi.decode(data, (address, address, address));

initializeService(registryAddress, authority, owner);
_initializeService(registryAddress, authority, owner);

_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
_bundleService = IBundleService(_getServiceAddress(BUNDLE()));
Expand All @@ -62,7 +62,7 @@ contract PoolService is

_staking = IStaking(getRegistry().getStakingAddress());

registerInterface(type(IPoolService).interfaceId);
_registerInterface(type(IPoolService).interfaceId);
}

/// @inheritdoc IPoolService
Expand Down
4 changes: 2 additions & 2 deletions contracts/product/ApplicationService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ contract ApplicationService is
address authority
) = abi.decode(data, (address, address, address));

initializeService(registryAddress, address(0), owner);
_initializeService(registryAddress, address(0), owner);

_distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
_pricingService = IPricingService(_getServiceAddress(PRICE()));
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));

registerInterface(type(IApplicationService).interfaceId);
_registerInterface(type(IApplicationService).interfaceId);
}


Expand Down
4 changes: 2 additions & 2 deletions contracts/product/ClaimService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ contract ClaimService is
address authority
) = abi.decode(data, (address, address, address));

initializeService(registryAddress, authority, owner);
_initializeService(registryAddress, authority, owner);

_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));

registerInterface(type(IClaimService).interfaceId);
_registerInterface(type(IClaimService).interfaceId);
}

function submit(
Expand Down
4 changes: 2 additions & 2 deletions contracts/product/PolicyService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contract PolicyService is
address authority
) = abi.decode(data, (address, address, address));

initializeService(registryAddress, authority, owner);
_initializeService(registryAddress, authority, owner);

VersionPart majorVersion = getVersion().toMajorPart();
_applicationService = IApplicationService(getRegistry().getServiceAddress(APPLICATION(), majorVersion));
Expand All @@ -72,7 +72,7 @@ contract PolicyService is
_distributionService = IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), majorVersion));
_pricingService = IPricingService(getRegistry().getServiceAddress(PRICE(), majorVersion));

registerInterface(type(IPolicyService).interfaceId);
_registerInterface(type(IPolicyService).interfaceId);
}


Expand Down
4 changes: 2 additions & 2 deletions contracts/product/PricingService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ contract PricingService is
address authority
) = abi.decode(data, (address, address, address));

initializeService(registryAddress, authority, owner);
registerInterface(type(IPricingService).interfaceId);
_initializeService(registryAddress, authority, owner);
_registerInterface(type(IPricingService).interfaceId);

_distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/product/Product.sol
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ abstract contract Product is
$._poolNftId = getRegistry().getNftIdForAddress(pool);
$._distributionNftId = getRegistry().getNftIdForAddress(distribution);

registerInterface(type(IProductComponent).interfaceId);
_registerInterface(type(IProductComponent).interfaceId);
}


Expand Down
4 changes: 2 additions & 2 deletions contracts/product/RiskService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ contract RiskService is
address authority
) = abi.decode(data, (address, address, address));

initializeService(registryAddress, authority, owner);
_initializeService(registryAddress, authority, owner);

_instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));

registerInterface(type(IRiskService).interfaceId);
_registerInterface(type(IRiskService).interfaceId);
}


Expand Down
4 changes: 2 additions & 2 deletions contracts/registry/RegistryService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ contract RegistryService is
address initialAuthority
) = abi.decode(data, (address, address));

initializeService(registryAddress, initialAuthority, owner);
registerInterface(type(IRegistryService).interfaceId);
_initializeService(registryAddress, initialAuthority, owner);
_registerInterface(type(IRegistryService).interfaceId);
}


Expand Down
10 changes: 5 additions & 5 deletions contracts/shared/Component.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract contract Component is
}
}

function initializeComponent(
function _initializeComponent(
address authority,
address registry,
NftId parentNftId,
Expand All @@ -64,11 +64,11 @@ abstract contract Component is
bytes memory registryData, // writeonly data that will saved in the object info record of the registry
bytes memory componentData // other component specific data
)
public
internal
virtual
onlyInitializing()
{
initializeRegisterable(registry, parentNftId, componentType, isInterceptor, initialOwner, registryData);
_initializeRegisterable(registry, parentNftId, componentType, isInterceptor, initialOwner, registryData);
__AccessManaged_init(authority);

if (token == address(0)) {
Expand All @@ -87,8 +87,8 @@ abstract contract Component is
$._isInterceptor = isInterceptor;
$._data = componentData;

registerInterface(type(IAccessManaged).interfaceId);
registerInterface(type(IComponent).interfaceId);
_registerInterface(type(IAccessManaged).interfaceId);
_registerInterface(type(IComponent).interfaceId);
}


Expand Down
4 changes: 2 additions & 2 deletions contracts/shared/ComponentService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ contract ComponentService is
address initialOwner;
(registryAddress, initialOwner) = abi.decode(data, (address, address));

initializeService(registryAddress, address(0), owner);
_initializeService(registryAddress, address(0), owner);

_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
_instanceService = IInstanceService(_getServiceAddress(INSTANCE()));

registerInterface(type(IComponentService).interfaceId);
_registerInterface(type(IComponentService).interfaceId);
}

//-------- component ----------------------------------------------------//
Expand Down
9 changes: 0 additions & 9 deletions contracts/shared/IPolicyHolder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,10 @@ interface IPolicyHolder is
/// it is optional for products to notifiy policy holder of expired claims
function policyExpired(NftId policyNftId) external;

/// @dev request for a payout by the requesting policy
/// the contract implements its use case specific handling for such requests.
/// eg. creation of a pending payout, a corresponding claim against one of the policies held by the IPolicyHolder
function requestPayout(NftId requestingPolicyNftId, Amount requestedPayoutAmount) external;

/// @dev callback function to notify the confirmation of the specified claim
/// active policies may open claims under the activated policy
function claimConfirmed(NftId policyNftId, ClaimId claimId, Amount amount) external;

/// @dev callback function that will be called after a successful payout
function payoutExecuted(NftId policyNftId, PayoutId payoutId, address beneficiary, Amount amount) external;

/// @dev determines policy and claim specific beneficiary address
/// returned address will override GIF default where the policy nft holder is treated as beneficiary
function getBeneficiary(NftId policyNftId, PayoutId payoutId) external view returns (address beneficiary);
}
4 changes: 2 additions & 2 deletions contracts/shared/InitializableERC165.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ contract InitializableERC165 is
mapping(bytes4 => bool) private _isSupported;

// @dev initializes with support for ERC165
function initializeERC165() public onlyInitializing() {
function _initializeERC165() internal onlyInitializing() {
_isSupported[type(IERC165).interfaceId] = true;
}

// @dev register support for provided interfaceId
// includes initialization for ERC165_ID if not yet done
function registerInterface(bytes4 interfaceId) public onlyInitializing() {
function _registerInterface(bytes4 interfaceId) internal onlyInitializing() {
_isSupported[interfaceId] = true;
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/shared/InstanceLinkedComponent.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ abstract contract InstanceLinkedComponent is
revert ErrorComponentNotInstance(instanceNftId);
}

initializeComponent(
_initializeComponent(
$._instance.authority(),
registry,
instanceNftId,
Expand All @@ -120,8 +120,8 @@ abstract contract InstanceLinkedComponent is
$._initialAuthorization = authorization;
$._componentService = IComponentService(_getServiceAddress(COMPONENT()));

registerInterface(type(IAccessManaged).interfaceId);
registerInterface(type(IInstanceLinkedComponent).interfaceId);
_registerInterface(type(IAccessManaged).interfaceId);
_registerInterface(type(IInstanceLinkedComponent).interfaceId);
}

/// @dev for instance linked components the wallet address stored in the instance store.
Expand Down
8 changes: 4 additions & 4 deletions contracts/shared/NftOwnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ contract NftOwnable is

/// @dev initialization for upgradable contracts
// used in _initializeRegisterable
function initializeNftOwnable(
function _initializeNftOwnable(
address initialOwner,
address registryAddress
)
public
internal
virtual
onlyInitializing()
{
initializeRegistryLinked(registryAddress);
initializeERC165();
_initializeRegistryLinked(registryAddress);
_initializeERC165();

if(initialOwner == address(0)) {
revert ErrorNftOwnableInitialOwnerZero();
Expand Down
Loading
Loading