-
Notifications
You must be signed in to change notification settings - Fork 92
refactor(advanced-logic): add evm-based PN #945
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,23 @@ | ||
| import { ExtensionTypes, RequestLogicTypes, TypesUtils } from '@requestnetwork/types'; | ||
| import ReferenceBasedPaymentNetwork from '../reference-based'; | ||
| import Utils from '@requestnetwork/utils'; | ||
| import EvmBasedPaymentNetwork from '../evm-based'; | ||
| const CURRENT_VERSION = '0.1.0'; | ||
|
|
||
| /** | ||
| * Implementation of the payment network to pay in ERC777, including third-party fees payment, based on a reference provided to a proxy contract. | ||
| */ | ||
| export default class Erc777StreamPaymentNetwork< | ||
| TCreationParameters extends ExtensionTypes.PnStreamReferenceBased.ICreationParameters = ExtensionTypes.PnStreamReferenceBased.ICreationParameters, | ||
| > extends ReferenceBasedPaymentNetwork<TCreationParameters> { | ||
| TCreationParameters extends ExtensionTypes.PnStreamReferenceBased.ICreationParameters = ExtensionTypes.PnStreamReferenceBased.ICreationParameters, | ||
| > | ||
| extends ReferenceBasedPaymentNetwork<TCreationParameters> | ||
| implements EvmBasedPaymentNetwork | ||
| { | ||
| public constructor( | ||
| extensionId: ExtensionTypes.ID = ExtensionTypes.ID.PAYMENT_NETWORK_ERC777_STREAM, | ||
| currentVersion: string = CURRENT_VERSION, | ||
| public supportedNetworks: string[] = [ | ||
| 'matic', | ||
| 'xdai', | ||
| 'mumbai', | ||
| 'rinkeby', | ||
| 'goerli', | ||
| 'arbitrum-rinkeby', | ||
| ], | ||
| public readonly extensionId: ExtensionTypes.ID = ExtensionTypes.ID | ||
| .PAYMENT_NETWORK_ERC777_STREAM, | ||
| public readonly currentVersion: string = CURRENT_VERSION, | ||
| public readonly supportedNetworks: string[] = EvmBasedPaymentNetwork.EVM_NETWORKS, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alexandre-abrioux ERC777 is not supported on all networks, most importantly mainnet is not supported
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @KolevDarko I took a different approach in the end as advised by Benji. I'm working on it here: #950 |
||
| public supportedCurrencyType: RequestLogicTypes.CURRENCY = RequestLogicTypes.CURRENCY.ERC777, | ||
| ) { | ||
| super(extensionId, currentVersion, supportedNetworks, supportedCurrencyType); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,27 @@ | ||
| import { ExtensionTypes, RequestLogicTypes } from '@requestnetwork/types'; | ||
| import ReferenceBasedPaymentNetwork from '../reference-based'; | ||
| import EvmBasedPaymentNetwork from '../evm-based'; | ||
|
|
||
| const CURRENT_VERSION = '0.3.0'; | ||
| const supportedNetworks = [ | ||
| 'mainnet', | ||
| 'rinkeby', | ||
| 'goerli', | ||
| 'xdai', | ||
| 'sokol', | ||
| 'fuse', | ||
| 'matic', | ||
| 'celo', | ||
| 'fantom', | ||
| 'bsctest', | ||
| 'bsc', | ||
| 'arbitrum-rinkeby', | ||
| 'arbitrum-one', | ||
| 'avalanche', | ||
| ]; | ||
|
|
||
| /** | ||
| * Implementation of the payment network to pay in native token | ||
| * FIXME: rename into EVMNativePaymentNetwork | ||
| */ | ||
| export default class EthInputPaymentNetwork extends ReferenceBasedPaymentNetwork { | ||
| export default class EthInputPaymentNetwork | ||
| extends ReferenceBasedPaymentNetwork | ||
| implements EvmBasedPaymentNetwork | ||
| { | ||
| public constructor( | ||
| extensionId: ExtensionTypes.ID = ExtensionTypes.ID.PAYMENT_NETWORK_ETH_INPUT_DATA, | ||
| currentVersion: string = CURRENT_VERSION, | ||
| public readonly extensionId: ExtensionTypes.ID = ExtensionTypes.ID | ||
| .PAYMENT_NETWORK_ETH_INPUT_DATA, | ||
| public readonly currentVersion: string = CURRENT_VERSION, | ||
| ) { | ||
| super(extensionId, currentVersion, supportedNetworks, RequestLogicTypes.CURRENCY.ETH); | ||
| super( | ||
| extensionId, | ||
| currentVersion, | ||
| EvmBasedPaymentNetwork.EVM_NETWORKS, | ||
| RequestLogicTypes.CURRENCY.ETH, | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| export default abstract class EvmBasedPaymentNetwork { | ||
| static EVM_NETWORKS = [ | ||
| 'alfajores', | ||
| 'arbitrum-one', | ||
| 'arbitrum-rinkeby', | ||
| 'avalanche', | ||
| 'bsc', | ||
| 'bsctest', | ||
| 'celo', | ||
| 'fantom', | ||
| 'fuse', | ||
| 'goerli', | ||
| 'mainnet', | ||
| 'matic', | ||
| 'mumbai', | ||
| 'private', | ||
| 'rinkeby', | ||
| 'sokol', | ||
| 'xdai', | ||
| ]; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constructors on abstract classes be protected