From ae83b949fe645e8462474c3f877787b6c0fdac10 Mon Sep 17 00:00:00 2001 From: "Michael D. Norman" Date: Tue, 11 Jan 2022 17:48:57 -0600 Subject: [PATCH] fix: [#41] fix for "like" interfaces --- src/contracts/activities.ts | 3 ++- src/contracts/artifacts.ts | 3 ++- src/contracts/consumables.ts | 7 +++--- src/contracts/consumables/exchange.ts | 3 ++- src/contracts/skills.ts | 3 ++- src/contracts/transfer.ts | 3 ++- src/interfaces.ts | 32 +++++++++++++++++++++++++++ 7 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 src/interfaces.ts diff --git a/src/contracts/activities.ts b/src/contracts/activities.ts index 5654529d..8b803d5b 100644 --- a/src/contracts/activities.ts +++ b/src/contracts/activities.ts @@ -18,5 +18,6 @@ */ import { IActivityHooks } from '../../types/contracts'; +import { LikeInterface } from '../interfaces'; -export type ActivityHooksLike = IActivityHooks; +export type ActivityHooksLike = LikeInterface; diff --git a/src/contracts/artifacts.ts b/src/contracts/artifacts.ts index 629d3403..61e7d3eb 100644 --- a/src/contracts/artifacts.ts +++ b/src/contracts/artifacts.ts @@ -19,6 +19,7 @@ import { ArtifactInit, ERC721Init, ERC721TokenInfoInit, IERC721Hooks } from '../../types/contracts'; import { IArtifact } from '../../types/contracts/IActivityExecutor'; +import { LikeInterface } from '../interfaces'; import ContractAddress from './ContractAddress'; import { DiamondInitFunction } from './diamonds'; import { TransferHooksLike } from './transfer'; @@ -36,7 +37,7 @@ export interface ArtifactData { transferHooks: TransferHooksLike; } -type ERC721HooksLike = IERC721Hooks; +type ERC721HooksLike = LikeInterface; export const buildArtifactInitFunction = (init: ArtifactInit, initData: ArtifactData): DiamondInitFunction => ({ initAddress: init.address, diff --git a/src/contracts/consumables.ts b/src/contracts/consumables.ts index 98d807a9..4ca55a81 100644 --- a/src/contracts/consumables.ts +++ b/src/contracts/consumables.ts @@ -19,6 +19,7 @@ import { IConsumable, IConsumableHooks, IERC20 } from '../../types/contracts'; import { IConsumable as IConsumableNamespace } from '../../types/contracts/IConsumableConsumer'; +import { LikeInterface } from '../interfaces'; import ContractAddress from './ContractAddress'; export type ConsumableAmountLike = ConsumableAmount | ConsumableAmountBN; @@ -30,7 +31,7 @@ export interface ConsumableAmount { export type ConsumableAmountBN = IConsumableNamespace.ConsumableAmountStructOutput; -export type ERC20Like = IERC20 | ConsumableLike; -export type ConsumableLike = IConsumable; +export type ERC20Like = LikeInterface | ConsumableLike; +export type ConsumableLike = LikeInterface; -export type ConsumableHooksLike = IConsumableHooks; +export type ConsumableHooksLike = LikeInterface; diff --git a/src/contracts/consumables/exchange.ts b/src/contracts/consumables/exchange.ts index 70bfa423..323e714d 100644 --- a/src/contracts/consumables/exchange.ts +++ b/src/contracts/consumables/exchange.ts @@ -19,6 +19,7 @@ import { ConsumableExchangeInit, IConsumableExchange } from '../../../types/contracts'; import { IConsumableExchange as IConsumableExchangeNamespace } from '../../../types/contracts/ConsumableExchangeFacet'; +import { LikeInterface } from '../../interfaces'; import { ConsumableHooksLike, ERC20Like } from '../consumables'; import { DiamondInitFunction } from '../diamonds'; @@ -29,7 +30,7 @@ export interface ExchangeRate { export type ExchangeRateBN = IConsumableExchangeNamespace.ExchangeRateStructOutput; -export type ConsumableExchangeLike = ERC20Like | IConsumableExchange; +export type ConsumableExchangeLike = LikeInterface | LikeInterface; export interface ConsumableExchangeInitData { exchangeConsumableHooks: ConsumableHooksLike; diff --git a/src/contracts/skills.ts b/src/contracts/skills.ts index 72af222b..a70ba76b 100644 --- a/src/contracts/skills.ts +++ b/src/contracts/skills.ts @@ -19,6 +19,7 @@ import { ISkillHooks } from '../../types/contracts'; import { ISkill } from '../../types/contracts/SkillConstrainedInit'; +import { LikeInterface } from '../interfaces'; import ContractAddress from './ContractAddress'; export interface SkillLevel { @@ -28,4 +29,4 @@ export interface SkillLevel { export type SkillLevelBN = ISkill.SkillLevelStructOutput; -export type SkillHooksLike = ISkillHooks; +export type SkillHooksLike = LikeInterface; diff --git a/src/contracts/transfer.ts b/src/contracts/transfer.ts index 028a5e55..f81d24e6 100644 --- a/src/contracts/transfer.ts +++ b/src/contracts/transfer.ts @@ -18,5 +18,6 @@ */ import { ITransferHooks } from '../../types/contracts'; +import { LikeInterface } from '../interfaces'; -export type TransferHooksLike = ITransferHooks; +export type TransferHooksLike = LikeInterface; diff --git a/src/interfaces.ts b/src/interfaces.ts new file mode 100644 index 00000000..bb9b98da --- /dev/null +++ b/src/interfaces.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 The Paypr Company, LLC + * + * This file is part of Paypr Ethereum Contracts. + * + * Paypr Ethereum Contracts is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Paypr Ethereum Contracts is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Paypr Ethereum Contracts. If not, see . + */ + +export type LikeInterface = Omit< + I, + | 'attach' + | 'connect' + | 'contractName' + | 'deployed' + | 'interface' + | 'off' + | 'on' + | 'once' + | 'removeAllListeners' + | 'removeListener' +>;