From 71e816b40104d2a0b1bccac4afbb2023f686efe1 Mon Sep 17 00:00:00 2001 From: Kirill Fedoseev Date: Fri, 10 Jul 2020 04:47:10 +0700 Subject: [PATCH] Update docs for plugin version 1.1.0 (#6) --- README.md | 12 +++++++++++- my-plugin/package.json | 2 +- test-wallet/package.json | 2 +- wallet/package.json | 2 +- yarn.lock | 8 ++++---- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8994b51..0fa44e0 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,11 @@ Exchange pairs examples: #### TokenBridge Plugin The [TokenBridge Burner Wallet 2 Plugin](https://github.com/poanetwork/tokenbridge/tree/develop/burner-wallet-plugin/tokenbridge-bw-exchange) provides some generic resources that can be used and extended: - `ERC677Asset` - A representation of an Erc677 token +- `BridgeableERC20Asset` - A representation of an Erc20 token with a possibility of bridging it through token bridges. - `NativeMediatorAsset` - Represents a native token that interacts with a Mediator extension. - `Mediator` Pair - Represents an Exchange Pair that interacts with mediators extensions. -- `TokenBridgeGateway` - A gateway to operate with ETC, POA Sokol and POA Core networks. +- `MediatorErcToNative Pair` - Represents a modified Mediator Pair that interacts with a tokenbridge erc-to-native mediators contracts. +- `TokenBridgeGateway` - A gateway to operate with ETC, POA Sokol, POA Core and qDAI networks. The asset `ERC677Asset` extends from `ERC20Asset` and overrides some methods: @@ -72,6 +74,10 @@ The asset `ERC677Asset` extends from `ERC20Asset` and overrides some methods: - `getTx`: Overrides the logic to return the stored information about a transfer transaction to avoid errors on the information displayed. +The asset `BridgeableERC20Asset` extends from `ERC20Asset` and overrides some methods: +- `_send`: If the asset detects that receiver is a bridge/mediator contract and it has on of the supported bridge modes, the tokens are sent using `approve()` + `relayTokens`, otherwise, regular ERC20 `transfer()` is used. + + The asset `NativeMediatorAsset` extends from the `NativeAsset` of the burner wallet core. It extends the functionality with the following method: - `scanMediatorEvents`: Add logic to watch transfer from mediator contracts to the wallet account to display it in the activity list. - `getTx`: Overrides the logic to return the stored information about a transfer transaction to avoid errors on the information displayed. @@ -87,10 +93,14 @@ Here are some details of the implemented methods: - `detectExchangeBToAFinished`: Wait for events emitted by the mediator contract to detect the exchange finalization. +The pair `MediatorErcToNative` extend from `Mediator` as base. It overrides `estimateAtoB` and `estimateBtoA` to use a different manner of retrieving bridging fees that are specific for erc-to-native mediator. + + The gateway `TokenBridgeGateway` extends from the `Gateway` class of the burner wallet core. It provides access from the wallet to the following networks: - ETC - POA Sokol - POA Core +- qDAI ### Project structure There are three main folders in the project: diff --git a/my-plugin/package.json b/my-plugin/package.json index 24f8f8f..cbd2b0a 100644 --- a/my-plugin/package.json +++ b/my-plugin/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@burner-wallet/exchange": "^1.1.4", - "@poanet/tokenbridge-bw-exchange": "^0.0.3" + "@poanet/tokenbridge-bw-exchange": "^1.1.0" }, "devDependencies": { "typescript": "^3.5.2" diff --git a/test-wallet/package.json b/test-wallet/package.json index 6680d32..4efe572 100644 --- a/test-wallet/package.json +++ b/test-wallet/package.json @@ -8,7 +8,7 @@ "@burner-wallet/exchange": "^1.1.4", "@burner-wallet/metamask-plugin": "^1.0.1", "@burner-wallet/modern-ui": "^1.0.7", - "@poanet/tokenbridge-bw-exchange": "^0.0.3", + "@poanet/tokenbridge-bw-exchange": "^1.1.0", "@types/node": "12.0.4", "@types/react": "16.8.19", "@types/react-dom": "16.8.4", diff --git a/wallet/package.json b/wallet/package.json index 4c97492..6d6cb11 100644 --- a/wallet/package.json +++ b/wallet/package.json @@ -8,7 +8,7 @@ "@burner-wallet/exchange": "^1.1.4", "@burner-wallet/metamask-plugin": "^1.0.1", "@burner-wallet/modern-ui": "^1.0.7", - "@poanet/tokenbridge-bw-exchange": "^0.0.3", + "@poanet/tokenbridge-bw-exchange": "^1.1.0", "@types/node": "12.0.4", "@types/react": "16.8.19", "@types/react-dom": "16.8.4", diff --git a/yarn.lock b/yarn.lock index ade8788..9d1c11e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2358,10 +2358,10 @@ dependencies: "@types/node" "^12.11.1" -"@poanet/tokenbridge-bw-exchange@^0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@poanet/tokenbridge-bw-exchange/-/tokenbridge-bw-exchange-0.0.3.tgz#0c51569461f221094bdc31307704ddf6e5d4332b" - integrity sha512-MiqABRZXGGLqjM0loWrwsDcEFwxoK08QS9UTrkrfOE7FBUpsskdTCZe0778FX5dvabvESZeY203wildCE6ppsg== +"@poanet/tokenbridge-bw-exchange@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@poanet/tokenbridge-bw-exchange/-/tokenbridge-bw-exchange-1.1.0.tgz#d6bbb547da93a1a995f43f624522b198cf260a27" + integrity sha512-cJiTzUMjnfg8xoC3iKmQ6fcbvy0sl1IV1VnjCbb4/krwlmycrxWMktAMzB0DYCJO0rzS87lhvFf9hVMsrCbWBg== dependencies: "@burner-wallet/assets" "^1.1.10" "@burner-wallet/core" "^1.1.9"