diff --git a/README.md b/README.md index 46908d4..d2e2789 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ There are two main folders in the project: - `wallet` - is a burner wallet instance ready to test your plugin - `my-plugin` - is the folder where the plugin code is located. To change the name of the plugin it is necessary to update the folder name `my-plugin` and all mentions to `my-plugin` to the new name of your plugin. -Inside `my-plugin` you can find the files that defines the resources to be exposed by the plugin to be used by the burner wallet in order to interact with the ERC677 to ERC677 bridge extension: -- `sUSD` - extends from `ERC677Asset` defined in `tokenbridge-plugin` -- `xsUSD` - extends from `ERC677Asset` defined in `tokenbridge-plugin` -- `SUSDBridge` - extends from `Mediator` defined in `tokenbridge-plugin` +Inside `my-plugin` you can find the files that defines the resources to be exposed by the plugin to be used by the burner wallet in order to interact with the Native to ERC677 bridge extension: +- `sPOA` - uses `sPOA` defined in `tokenbridge-plugin` and adds the mediator address to the correct track of the transactions. +- `ksPOA` - extends from `ERC677Asset` defined in `tokenbridge-plugin` +- `KSPOABridge` - extends from `Mediator` defined in `tokenbridge-plugin` You can extend or replace these resources based on your use case. diff --git a/my-plugin/src/assets/ksPOA.ts b/my-plugin/src/assets/ksPOA.ts new file mode 100644 index 0000000..95bcb6d --- /dev/null +++ b/my-plugin/src/assets/ksPOA.ts @@ -0,0 +1,8 @@ +import { ERC677Asset } from '@poanet/tokenbridge-bw-exchange' + +export default new ERC677Asset({ + id: 'xspoa', + name: 'ksPOA', + network: '42', + address: '0xff94183659f549D6273349696d73686Ee1d2AC83' +}) diff --git a/my-plugin/src/assets/sPOA.ts b/my-plugin/src/assets/sPOA.ts new file mode 100644 index 0000000..d141627 --- /dev/null +++ b/my-plugin/src/assets/sPOA.ts @@ -0,0 +1,5 @@ +import { sPOA } from '@poanet/tokenbridge-bw-exchange' + +sPOA.setMediatorAddress('0x867949C3F2f66D827Ed40847FaA7B3a369370e13') + +export default sPOA diff --git a/my-plugin/src/assets/sUSD.ts b/my-plugin/src/assets/sUSD.ts deleted file mode 100644 index c79597e..0000000 --- a/my-plugin/src/assets/sUSD.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ERC20Asset } from '@burner-wallet/assets' - -export default new ERC20Asset({ - id: 'susd', - name: 'sUSD', - network: '1', - address: '0x57Ab1E02fEE23774580C119740129eAC7081e9D3' -}) diff --git a/my-plugin/src/assets/xsUSD.ts b/my-plugin/src/assets/xsUSD.ts deleted file mode 100644 index 608135f..0000000 --- a/my-plugin/src/assets/xsUSD.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ERC677Asset } from '@poanet/tokenbridge-bw-exchange' - -export default new ERC677Asset({ - id: 'xsusd', - name: 'xsUSD', - network: '100', - address: '0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e' -}) diff --git a/my-plugin/src/index.ts b/my-plugin/src/index.ts index 8586c2a..5b7914f 100644 --- a/my-plugin/src/index.ts +++ b/my-plugin/src/index.ts @@ -1,3 +1,3 @@ -export { default as xsUSD } from './assets/xsUSD' -export { default as sUSD } from './assets/sUSD' -export { default as SUSDBridge } from './pairs/SUSDBridge' +export { default as ksPOA } from './assets/ksPOA' +export { default as sPOA } from './assets/sPOA' +export { default as KSPOABridge } from './pairs/KSPOABridge' diff --git a/my-plugin/src/pairs/KSPOABridge.ts b/my-plugin/src/pairs/KSPOABridge.ts new file mode 100644 index 0000000..e107001 --- /dev/null +++ b/my-plugin/src/pairs/KSPOABridge.ts @@ -0,0 +1,13 @@ +import { Mediator } from '@poanet/tokenbridge-bw-exchange' +import { sPOA, ksPOA } from '../index' + +export default class KSPOABridge extends Mediator { + constructor() { + super({ + assetA: sPOA.id, + assetABridge: '0x867949C3F2f66D827Ed40847FaA7B3a369370e13', + assetB: ksPOA.id, + assetBBridge: '0x99FB1a25caeB9c3a5Bf132686E2fe5e27BC0e2dd' + }) + } +} diff --git a/my-plugin/src/pairs/SUSDBridge.ts b/my-plugin/src/pairs/SUSDBridge.ts deleted file mode 100644 index 1a68898..0000000 --- a/my-plugin/src/pairs/SUSDBridge.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Mediator } from '@poanet/tokenbridge-bw-exchange' -import { sUSD, xsUSD } from '../index' - -export default class SUSDBridge extends Mediator { - constructor() { - super({ - assetA: xsUSD.id, - assetABridge: '0xD9a3039cfC70aF84AC9E566A2526fD3b683B995B', - assetB: sUSD.id, - assetBBridge: '0x71F12d03E1711cb96E11E1A5c12Da7466699Db8D' - }) - } -} diff --git a/wallet/package.json b/wallet/package.json index abd0048..c62f7d2 100644 --- a/wallet/package.json +++ b/wallet/package.json @@ -8,6 +8,7 @@ "@burner-wallet/exchange": "^1.1.3", "@burner-wallet/metamask-plugin": "^1.0.1", "@burner-wallet/modern-ui": "^1.0.7", + "@poanet/tokenbridge-bw-exchange": "^0.0.2", "@types/node": "12.0.4", "@types/react": "16.8.19", "@types/react-dom": "16.8.4", diff --git a/wallet/src/index.tsx b/wallet/src/index.tsx index 3c22597..40c98a6 100644 --- a/wallet/src/index.tsx +++ b/wallet/src/index.tsx @@ -2,21 +2,22 @@ import React from 'react' import ReactDOM from 'react-dom' import BurnerCore from '@burner-wallet/core' import { InjectedSigner, LocalSigner } from '@burner-wallet/core/signers' -import { XDaiGateway, InfuraGateway, InjectedGateway } from '@burner-wallet/core/gateways' +import { InfuraGateway, InjectedGateway } from '@burner-wallet/core/gateways' import ModernUI from '@burner-wallet/modern-ui' import Exchange from '@burner-wallet/exchange' import MetamaskPlugin from '@burner-wallet/metamask-plugin' +import { TokenBridgeGateway } from '@poanet/tokenbridge-bw-exchange' // Import resources from our plugin -import { sUSD, xsUSD, SUSDBridge } from 'my-plugin' +import { sPOA, ksPOA, KSPOABridge } from 'my-plugin' const core = new BurnerCore({ signers: [new InjectedSigner(), new LocalSigner({ privateKey: process.env.REACT_APP_PK, saveKey: false })], - gateways: [new InjectedGateway(), new XDaiGateway(), new InfuraGateway(process.env.REACT_APP_INFURA_KEY)], - assets: [sUSD, xsUSD] + gateways: [new InjectedGateway(), new TokenBridgeGateway(), new InfuraGateway(process.env.REACT_APP_INFURA_KEY)], + assets: [sPOA, ksPOA] }) const exchange = new Exchange({ - pairs: [new SUSDBridge()] + pairs: [new KSPOABridge()] }) const BurnerWallet = () =>