├── .travis.yml
├── src
├── .eslintrc
├── test.js
├── index.js
├── components
│ ├── Widget
│ │ ├── layout.js
│ │ ├── components
│ │ │ ├── launcher
│ │ │ │ ├── index.js
│ │ │ │ └── style.scss
│ │ │ └── modals
│ │ │ │ ├── errorMessage.js
│ │ │ │ ├── confirm.js
│ │ │ │ ├── index.js
│ │ │ │ └── etherToken.js
│ │ └── index.js
│ └── Common
│ │ └── index.js
├── utils
│ ├── account.js
│ ├── conversion.js
│ └── token.js
├── scss
│ ├── common.scss
│ └── animation.scss
├── contexts
│ ├── rate.js
│ └── modal.js
├── constants.js
├── widget.js
└── contracts
│ └── bancor
│ ├── ERC20Token.js
│ ├── EtherToken.js
│ ├── ContractRegistry.js
│ ├── BancorConverterRegistryData.js
│ ├── BancorConverterRegistry.js
│ ├── SmartToken.js
│ └── BancorNetwork.js
├── preview-1.gif
├── assets
├── loading.gif
├── tokens
│ ├── aid.png
│ ├── amn.png
│ ├── ant.png
│ ├── bat.png
│ ├── bax.png
│ ├── bnt.png
│ ├── btc.png
│ ├── c20.png
│ ├── cat.png
│ ├── dai.png
│ ├── dgd.png
│ ├── edg.png
│ ├── elf.png
│ ├── enj.png
│ ├── eth.png
│ ├── fxc.png
│ ├── gno.png
│ ├── gto.png
│ ├── ind.png
│ ├── key.png
│ ├── kin.png
│ ├── knc.png
│ ├── loc.png
│ ├── mdt.png
│ ├── met.png
│ ├── mfg.png
│ ├── mft.png
│ ├── mkr.png
│ ├── mln.png
│ ├── mtl.png
│ ├── myb.png
│ ├── nmr.png
│ ├── omg.png
│ ├── plr.png
│ ├── rcn.png
│ ├── rdn.png
│ ├── ren.png
│ ├── rep.png
│ ├── req.png
│ ├── rlc.png
│ ├── san.png
│ ├── snt.png
│ ├── snx.png
│ ├── srn.png
│ ├── tkn.png
│ ├── usd.png
│ ├── vee.png
│ ├── vib.png
│ ├── wax.png
│ ├── zrx.png
│ ├── aion.png
│ ├── boxx.png
│ ├── busd.png
│ ├── ceek.png
│ ├── data.png
│ ├── drgn.png
│ ├── link.png
│ ├── loom.png
│ ├── mana.png
│ ├── melon.png
│ ├── nexo.png
│ ├── npxs.png
│ ├── powr.png
│ ├── qdao.png
│ ├── rblx.png
│ ├── storm.png
│ ├── taas.png
│ ├── tusd.png
│ ├── usdc.png
│ ├── usdt.png
│ ├── wings.png
│ ├── xdce.png
│ ├── zipt.png
│ ├── instar.png
│ ├── token4xb.png
│ └── chainlink.png
├── loading-large.gif
├── FEA_open_source_sm.png
├── chat-demonstration.gif
├── ethereum.svg
├── search.svg
├── bnt.svg
├── send_button.svg
├── clear-button.svg
├── close.svg
└── launcher_button.svg
├── example
├── src
│ ├── assets
│ │ ├── bnt.png
│ │ ├── bancor.png
│ │ └── bnt.svg
│ ├── fonts
│ │ └── Pacifico.ttf
│ ├── connector.js
│ ├── index.css
│ ├── index.js
│ ├── layouts
│ │ └── main.js
│ ├── views
│ │ ├── liquidityPool.js
│ │ ├── navbar.js
│ │ └── main.js
│ └── App.js
├── public
│ ├── manifest.json
│ └── index.html
└── package.json
├── .editorconfig
├── .babelrc
├── .gitignore
├── .eslintrc
├── rollup.config.js
├── package.json
└── README.md
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 9
4 | - 8
5 |
--------------------------------------------------------------------------------
/src/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "jest": true
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/preview-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/preview-1.gif
--------------------------------------------------------------------------------
/assets/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/loading.gif
--------------------------------------------------------------------------------
/assets/tokens/aid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/aid.png
--------------------------------------------------------------------------------
/assets/tokens/amn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/amn.png
--------------------------------------------------------------------------------
/assets/tokens/ant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/ant.png
--------------------------------------------------------------------------------
/assets/tokens/bat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/bat.png
--------------------------------------------------------------------------------
/assets/tokens/bax.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/bax.png
--------------------------------------------------------------------------------
/assets/tokens/bnt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/bnt.png
--------------------------------------------------------------------------------
/assets/tokens/btc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/btc.png
--------------------------------------------------------------------------------
/assets/tokens/c20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/c20.png
--------------------------------------------------------------------------------
/assets/tokens/cat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/cat.png
--------------------------------------------------------------------------------
/assets/tokens/dai.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/dai.png
--------------------------------------------------------------------------------
/assets/tokens/dgd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/dgd.png
--------------------------------------------------------------------------------
/assets/tokens/edg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/edg.png
--------------------------------------------------------------------------------
/assets/tokens/elf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/elf.png
--------------------------------------------------------------------------------
/assets/tokens/enj.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/enj.png
--------------------------------------------------------------------------------
/assets/tokens/eth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/eth.png
--------------------------------------------------------------------------------
/assets/tokens/fxc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/fxc.png
--------------------------------------------------------------------------------
/assets/tokens/gno.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/gno.png
--------------------------------------------------------------------------------
/assets/tokens/gto.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/gto.png
--------------------------------------------------------------------------------
/assets/tokens/ind.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/ind.png
--------------------------------------------------------------------------------
/assets/tokens/key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/key.png
--------------------------------------------------------------------------------
/assets/tokens/kin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/kin.png
--------------------------------------------------------------------------------
/assets/tokens/knc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/knc.png
--------------------------------------------------------------------------------
/assets/tokens/loc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/loc.png
--------------------------------------------------------------------------------
/assets/tokens/mdt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/mdt.png
--------------------------------------------------------------------------------
/assets/tokens/met.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/met.png
--------------------------------------------------------------------------------
/assets/tokens/mfg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/mfg.png
--------------------------------------------------------------------------------
/assets/tokens/mft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/mft.png
--------------------------------------------------------------------------------
/assets/tokens/mkr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/mkr.png
--------------------------------------------------------------------------------
/assets/tokens/mln.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/mln.png
--------------------------------------------------------------------------------
/assets/tokens/mtl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/mtl.png
--------------------------------------------------------------------------------
/assets/tokens/myb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/myb.png
--------------------------------------------------------------------------------
/assets/tokens/nmr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/nmr.png
--------------------------------------------------------------------------------
/assets/tokens/omg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/omg.png
--------------------------------------------------------------------------------
/assets/tokens/plr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/plr.png
--------------------------------------------------------------------------------
/assets/tokens/rcn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/rcn.png
--------------------------------------------------------------------------------
/assets/tokens/rdn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/rdn.png
--------------------------------------------------------------------------------
/assets/tokens/ren.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/ren.png
--------------------------------------------------------------------------------
/assets/tokens/rep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/rep.png
--------------------------------------------------------------------------------
/assets/tokens/req.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/req.png
--------------------------------------------------------------------------------
/assets/tokens/rlc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/rlc.png
--------------------------------------------------------------------------------
/assets/tokens/san.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/san.png
--------------------------------------------------------------------------------
/assets/tokens/snt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/snt.png
--------------------------------------------------------------------------------
/assets/tokens/snx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/snx.png
--------------------------------------------------------------------------------
/assets/tokens/srn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/srn.png
--------------------------------------------------------------------------------
/assets/tokens/tkn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/tkn.png
--------------------------------------------------------------------------------
/assets/tokens/usd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/usd.png
--------------------------------------------------------------------------------
/assets/tokens/vee.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/vee.png
--------------------------------------------------------------------------------
/assets/tokens/vib.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/vib.png
--------------------------------------------------------------------------------
/assets/tokens/wax.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/wax.png
--------------------------------------------------------------------------------
/assets/tokens/zrx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/zrx.png
--------------------------------------------------------------------------------
/assets/tokens/aion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/aion.png
--------------------------------------------------------------------------------
/assets/tokens/boxx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/boxx.png
--------------------------------------------------------------------------------
/assets/tokens/busd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/busd.png
--------------------------------------------------------------------------------
/assets/tokens/ceek.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/ceek.png
--------------------------------------------------------------------------------
/assets/tokens/data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/data.png
--------------------------------------------------------------------------------
/assets/tokens/drgn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/drgn.png
--------------------------------------------------------------------------------
/assets/tokens/link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/link.png
--------------------------------------------------------------------------------
/assets/tokens/loom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/loom.png
--------------------------------------------------------------------------------
/assets/tokens/mana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/mana.png
--------------------------------------------------------------------------------
/assets/tokens/melon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/melon.png
--------------------------------------------------------------------------------
/assets/tokens/nexo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/nexo.png
--------------------------------------------------------------------------------
/assets/tokens/npxs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/npxs.png
--------------------------------------------------------------------------------
/assets/tokens/powr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/powr.png
--------------------------------------------------------------------------------
/assets/tokens/qdao.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/qdao.png
--------------------------------------------------------------------------------
/assets/tokens/rblx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/rblx.png
--------------------------------------------------------------------------------
/assets/tokens/storm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/storm.png
--------------------------------------------------------------------------------
/assets/tokens/taas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/taas.png
--------------------------------------------------------------------------------
/assets/tokens/tusd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/tusd.png
--------------------------------------------------------------------------------
/assets/tokens/usdc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/usdc.png
--------------------------------------------------------------------------------
/assets/tokens/usdt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/usdt.png
--------------------------------------------------------------------------------
/assets/tokens/wings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/wings.png
--------------------------------------------------------------------------------
/assets/tokens/xdce.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/xdce.png
--------------------------------------------------------------------------------
/assets/tokens/zipt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/zipt.png
--------------------------------------------------------------------------------
/assets/loading-large.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/loading-large.gif
--------------------------------------------------------------------------------
/assets/tokens/instar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/instar.png
--------------------------------------------------------------------------------
/assets/tokens/token4xb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/token4xb.png
--------------------------------------------------------------------------------
/example/src/assets/bnt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/example/src/assets/bnt.png
--------------------------------------------------------------------------------
/assets/tokens/chainlink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/tokens/chainlink.png
--------------------------------------------------------------------------------
/assets/FEA_open_source_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/FEA_open_source_sm.png
--------------------------------------------------------------------------------
/assets/chat-demonstration.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/assets/chat-demonstration.gif
--------------------------------------------------------------------------------
/example/src/assets/bancor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/example/src/assets/bancor.png
--------------------------------------------------------------------------------
/example/src/fonts/Pacifico.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pisuthd/react-defi-widget/HEAD/example/src/fonts/Pacifico.ttf
--------------------------------------------------------------------------------
/src/test.js:
--------------------------------------------------------------------------------
1 | import ExampleComponent from './'
2 |
3 | describe('ExampleComponent', () => {
4 | it('is truthy', () => {
5 | expect(ExampleComponent).toBeTruthy()
6 | })
7 | })
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import ConnectedWidget, { TokenConversionWidget, LiquidityPoolsWidget } from "./widget";
2 |
3 | export {
4 | ConnectedWidget as Widget,
5 | TokenConversionWidget,
6 | LiquidityPoolsWidget
7 | };
--------------------------------------------------------------------------------
/example/src/connector.js:
--------------------------------------------------------------------------------
1 | import { Connectors } from 'web3-react'
2 | const { InjectedConnector } = Connectors
3 |
4 | const MetaMask = new InjectedConnector({ supportedNetworks: [1,2,3, 4, 42] })
5 |
6 | export const connectors = { MetaMask }
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false
5 | }],
6 | "stage-0",
7 | "react"
8 | ],
9 | "plugins": [
10 | "transform-runtime",
11 | "transform-async-to-generator"
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/assets/ethereum.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/example/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "react-defi-widget",
3 | "name": "react-defi-widget",
4 | "start_url": "./index.html",
5 | "display": "standalone",
6 | "theme_color": "#000000",
7 | "background_color": "#ffffff"
8 | }
9 |
--------------------------------------------------------------------------------
/example/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: sans-serif;
5 | }
6 |
7 | @font-face {
8 | font-family: 'pacifico';
9 | src: local('pacifico'), url(./fonts/Pacifico.ttf) format('truetype');
10 | }
11 |
--------------------------------------------------------------------------------
/assets/search.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # See https://help.github.com/ignore-files/ for more about ignoring files.
3 |
4 | # dependencies
5 | node_modules
6 |
7 | # builds
8 | build
9 | dist
10 | .rpt2_cache
11 |
12 | # misc
13 | .DS_Store
14 | .env
15 | .env.local
16 | .env.development.local
17 | .env.test.local
18 | .env.production.local
19 |
20 | npm-debug.log*
21 | yarn-debug.log*
22 | yarn-error.log*
23 |
--------------------------------------------------------------------------------
/assets/bnt.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/Widget/layout.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Container, Card } from "../Common";
3 |
4 | const WidgetLayout = (props) => {
5 |
6 | const { children } = props;
7 |
8 | return (
9 |
11 |
12 | {children}
13 |
14 |
15 | )
16 | }
17 |
18 |
19 |
20 | export default WidgetLayout
--------------------------------------------------------------------------------
/example/src/assets/bnt.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/example/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import Web3Provider from 'web3-react'
4 | import { connectors } from "./connector";
5 |
6 | import './index.css'
7 | import App from './App'
8 |
9 | import 'bootstrap/dist/css/bootstrap.min.css';
10 |
11 |
12 | ReactDOM.render(, document.getElementById('root'))
13 |
--------------------------------------------------------------------------------
/example/src/layouts/main.js:
--------------------------------------------------------------------------------
1 | import React, { Component ,Fragment } from 'react'
2 | import { Container } from 'reactstrap';
3 | import NavBar from "../views/navbar";
4 |
5 | const MainLayout = ({children}) => {
6 | return (
7 |
8 |
9 |
10 | {children}
11 |
12 |
13 | )
14 | }
15 |
16 | export default MainLayout;
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "babel-eslint",
3 | "extends": [
4 | "standard",
5 | "standard-react"
6 | ],
7 | "env": {
8 | "es6": true
9 | },
10 | "plugins": [
11 | "react"
12 | ],
13 | "parserOptions": {
14 | "sourceType": "module"
15 | },
16 | "rules": {
17 | // don't force es6 functions to include space before paren
18 | "space-before-function-paren": 0,
19 |
20 | // allow specifying true explicitly for boolean props
21 | "react/jsx-boolean-value": 0
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | React DeFi Widget Example
11 |
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/utils/account.js:
--------------------------------------------------------------------------------
1 | import { ethers } from "ethers";
2 |
3 | export const getAddress = (address) => {
4 | try {
5 | const result = ethers.utils.getAddress(address);
6 |
7 | return result;
8 | } catch (error) {
9 | return "0x0000000000000000000000000000000000000000";
10 | }
11 |
12 | }
13 |
14 | export const parseFee = (fee) => {
15 |
16 | if (typeof (fee) === "number") {
17 | let result = Number(fee) * 10000;
18 |
19 | if (0 > result) {
20 | return "0";
21 | }
22 |
23 | if (result > 30000) {
24 | return "30000";
25 | } else {
26 | return `${result}`;
27 | }
28 |
29 |
30 | } else {
31 | return "0";
32 | }
33 | }
--------------------------------------------------------------------------------
/src/components/Widget/components/launcher/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import defiLauncher from "../../../../../assets/ethereum.svg";
4 | import closeLauncher from "../../../../../assets/close.svg";
5 |
6 | import { LauncherButton, LauncherIcon } from "../../../Common";
7 |
8 | const Launcher = ({ toggle, isOpened }) => {
9 |
10 | return (
11 |
12 | {isOpened ?
13 | :
14 |
15 | }
16 |
17 | )
18 | }
19 |
20 | export default Launcher;
--------------------------------------------------------------------------------
/assets/send_button.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
41 |
--------------------------------------------------------------------------------
/src/components/Widget/components/modals/errorMessage.js:
--------------------------------------------------------------------------------
1 | import React, { Component, useCallback, useState, useEffect } from 'react';
2 | import styled from "styled-components"
3 |
4 | import { Wrapper, Content, Footer, Body, Row, ButtonGroup, Button } from "./index";
5 |
6 | const ErrorMessageModal = (props) => {
7 |
8 | const { width, color, title, message, closeErrorModal } = props;
9 |
10 | return (
11 |
12 |
15 |
16 | {title}
17 | {message}
18 |
19 |
24 |
25 |
26 | )
27 | }
28 |
29 | export default ErrorMessageModal;
--------------------------------------------------------------------------------
/assets/clear-button.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
41 |
--------------------------------------------------------------------------------
/src/utils/conversion.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | export const getNetworkNameFromId = (id) => {
4 | if (id === 1) {
5 | return "Mainnet"
6 | } else if (id === 3) {
7 | return "Ropsten"
8 | } else {
9 | return "Unsupported"
10 | }
11 | }
12 |
13 | export const truncateString = (str, num) => {
14 | // If the length of str is less than or equal to num
15 | // just return str--don't truncate it.
16 | if (str.length <= num) {
17 | return str
18 | }
19 | // Return str truncated with '...' concatenated to the end of str.
20 | return str.slice(0, num+2) + '...' + str.slice(Math.abs(num) * -1)
21 | }
22 |
23 | export const toFixed = (num, fixed) => {
24 |
25 | if ((1/fixed) >= Number(num)) {
26 | return Number(num).toFixed(fixed);
27 | }
28 | var re = new RegExp('^-?\\d+(?:\.\\d{0,' + (fixed || -1) + '})?');
29 | return num.toString().match(re)[0];
30 | }
31 |
32 | export const parseString = (str) => {
33 | return str.replace(/[^a-z0-9+]+/gi, '');
34 | }
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import babel from 'rollup-plugin-babel'
2 | import commonjs from 'rollup-plugin-commonjs'
3 | import external from 'rollup-plugin-peer-deps-external'
4 | import postcss from 'rollup-plugin-postcss'
5 | import resolve from 'rollup-plugin-node-resolve'
6 | import url from 'rollup-plugin-url'
7 | import svgr from '@svgr/rollup'
8 |
9 | import pkg from './package.json'
10 |
11 | export default {
12 | input: 'src/index.js',
13 | output: [
14 | {
15 | file: pkg.main,
16 | format: 'cjs',
17 | sourcemap: true
18 | },
19 | {
20 | file: pkg.module,
21 | format: 'es',
22 | sourcemap: true
23 | }
24 | ],
25 | external: [ 'styled-components', 'react-container-dimensions','ethers'],
26 | plugins: [
27 | external(),
28 | postcss({
29 | modules: true
30 | }),
31 | url(),
32 | svgr(),
33 | babel({
34 | runtimeHelpers: true,
35 | exclude: 'node_modules/**',
36 | plugins: [ 'external-helpers' ]
37 | }),
38 | resolve(),
39 | commonjs()
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/src/scss/common.scss:
--------------------------------------------------------------------------------
1 | @mixin message-bubble($color) {
2 | background-color: $color;
3 | border-radius: 10px;
4 | padding: 15px;
5 | max-width: 215px;
6 | text-align: left;
7 | }
8 |
9 | @mixin widget-container-fs {
10 | margin: 0;
11 | max-width: none;
12 | width: 100%;
13 | }
14 |
15 | @mixin header-fs {
16 | border-radius: 0;
17 | flex-shrink: 0;
18 | position: relative;
19 | }
20 |
21 | @mixin title-fs {
22 | padding: 0 0 15px 0;
23 | }
24 |
25 | @mixin close-button-fs {
26 | background-color: $turqois-1;
27 | border: 0;
28 | display: block;
29 | position: absolute;
30 | right: 10px;
31 | top: 20px;
32 | width: 40px;
33 | }
34 |
35 | @mixin close-fs {
36 | width: 20px;
37 | height: 20px;
38 | }
39 |
40 | @mixin messages-container-fs {
41 | height: 100%;
42 | max-height: none;
43 | }
44 |
45 | @mixin conversation-container-fs {
46 | display: flex;
47 | flex-direction: column;
48 | height: 100%;
49 | }
50 |
51 | @mixin launcher-fs {
52 | bottom: 0;
53 | margin: 20px;
54 | position: fixed;
55 | right: 0;
56 | }
57 |
--------------------------------------------------------------------------------
/src/components/Widget/components/modals/confirm.js:
--------------------------------------------------------------------------------
1 | import React, { Component, useCallback, useState, useEffect } from 'react';
2 | import styled from "styled-components"
3 |
4 | import { Wrapper, Content, Footer, Body, Row, ButtonGroup, Button } from "./index";
5 |
6 |
7 | const ConfirmModal = (props) => {
8 | const { width, color, title, message, closeConfirmModal } = props;
9 |
10 | return (
11 |
12 |
15 |
16 | {title}
17 | {message}
18 |
19 |
20 |
26 |
27 |
28 | )
29 | }
30 |
31 | export default ConfirmModal;
--------------------------------------------------------------------------------
/src/components/Widget/components/launcher/style.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../scss/common.scss';
2 | @import '../../../../scss/variables.scss';
3 | @import '../../../../scss/animation.scss';
4 |
5 |
6 | .defi-launcher {
7 | @include animation(0, 0.5s, slide-in);
8 | align-self: flex-end;
9 | background-color: $primary;
10 | border: 0;
11 | border-radius: 50%;
12 | box-shadow: 0px 2px 10px 1px $grey-3;
13 | height: 60px;
14 | margin-top: 10px;
15 | width: 60px;
16 | cursor: pointer;
17 |
18 | &:focus {
19 | outline: none;
20 | }
21 | }
22 |
23 | img {
24 | // filter: invert(100%) sepia(0%) saturate(7489%) hue-rotate(243deg) brightness(104%) contrast(103%);
25 | filter: invert(91%) sepia(2%) saturate(1410%) hue-rotate(197deg) brightness(105%) contrast(93%);
26 | }
27 |
28 | .defi-open-launcher {
29 | @include animation(0, 0.5s, rotation-rl);
30 | }
31 |
32 | .defi-close-launcher {
33 | width: 20px;
34 | @include animation(0, 0.5s, rotation-lr);
35 | }
36 |
37 | @media screen and (max-width: 800px){
38 | .defi-launcher {
39 | @include launcher-fs;
40 | }
41 |
42 | .defi-hide-sm {
43 | display: none;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-defi-widget-example",
3 | "version": "0.0.0",
4 | "license": "MIT",
5 | "private": true,
6 | "dependencies": {
7 | "bootstrap": "^4.4.1",
8 | "ethers": "^4.0.45",
9 | "prop-types": "^15.6.2",
10 | "react": "file:../node_modules/react",
11 | "react-defi-widget": "file:..",
12 | "react-dom": "file:../node_modules/react-dom",
13 | "react-scripts": "3.4.0",
14 | "reactstrap": "^8.4.1",
15 | "eslint": "^6.6.0",
16 | "eslint-config-standard": "^11.0.0",
17 | "eslint-config-standard-react": "^6.0.0",
18 | "eslint-plugin-import": "^2.13.0",
19 | "eslint-plugin-node": "^7.0.1",
20 | "eslint-plugin-promise": "^4.0.0",
21 | "eslint-plugin-react": "^7.10.0",
22 | "eslint-plugin-standard": "^3.1.0",
23 | "styled-components": "^5.0.1",
24 | "web3-react": "^5.0.5"
25 | },
26 | "scripts": {
27 | "start": "react-scripts start",
28 | "build": "react-scripts build",
29 | "test": "react-scripts test --env=jsdom",
30 | "eject": "react-scripts eject"
31 | },
32 | "browserslist": {
33 | "production": [
34 | ">0.2%",
35 | "not dead",
36 | "not op_mini all"
37 | ],
38 | "development": [
39 | "last 1 chrome version",
40 | "last 1 firefox version",
41 | "last 1 safari version"
42 | ]
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/assets/close.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
47 |
--------------------------------------------------------------------------------
/src/contexts/rate.js:
--------------------------------------------------------------------------------
1 |
2 | import React, { useCallback } from "react";
3 |
4 | // const BancorSDK = require('bancor-sdk').SDK;
5 |
6 | import { BANCOR_CONTRACTS, NETWORKS, TOKEN_CONTRACTS, CACHE_URL, TRANSACTION_TYPE } from "../constants";
7 |
8 | import { fetchData } from "./bancor";
9 |
10 | export const useRate = () => {
11 |
12 | const getUsdRate = useCallback(async (tokenSymbol) => {
13 | try {
14 | const { price } = await fetchData(`${CACHE_URL}/tokens/${tokenSymbol}`);
15 | return price;
16 | } catch (error) {
17 | return;
18 | }
19 | }, [])
20 | /*
21 | const getPathFromSDK = useCallback(async (baseTokenAddress, pairTokenAddress, inputAmount) => {
22 | const settings = {
23 | ethereumNodeEndpoint: "https://mainnet.infura.io/v3/3aa2960d9ce549d6a539421c0a94fe52",
24 | };
25 |
26 | const sourceToken = {
27 | blockchainType: 'ethereum',
28 | blockchainId: baseTokenAddress
29 | };
30 | const targetToken = {
31 | blockchainType: 'ethereum',
32 | blockchainId: pairTokenAddress
33 | };
34 |
35 | let bancorSDK = await BancorSDK.create(settings);
36 | const result = await bancorSDK.pricing.getPathAndRate(sourceToken, targetToken, inputAmount);
37 | await BancorSDK.destroy(bancorSDK);
38 | return result;
39 | }, [])
40 | */
41 |
42 | return {
43 | getUsdRate,
44 | // getPathFromSDK
45 | }
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/src/components/Common/index.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 | import { COLORS } from "../../constants";
3 | import "../../scss/animation.scss";
4 | import "../../scss/common.scss";
5 |
6 |
7 | export const Container = styled.div`
8 | min-height: 400px;
9 | color: rgba(0, 0, 0, 0.7);
10 |
11 | `;
12 |
13 | export const Card = styled.div`
14 | background: #fff;
15 | border-radius: 5px;
16 | display: flex;
17 | min-height: 400px;
18 | position: relative;
19 | padding: 10px;
20 | color: rgba(0, 0, 0, 0.7);
21 |
22 | `
23 |
24 | // box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
25 |
26 | export const LauncherButton = styled.button`
27 | @include animation(0, 0.5s, slide-in);
28 |
29 |
30 |
31 | align-self: flex-end;
32 | background-color: ${COLORS.primary};
33 | border: 0;
34 | border-radius: 50%;
35 | box-shadow: 0px 2px 10px 1px $grey-3;
36 | height: 60px;
37 | margin-top: 10px;
38 | width: 60px;
39 | cursor: pointer;
40 |
41 | &:focus {
42 | outline: none;
43 | }
44 |
45 | ${ props => props.isOpened
46 | ?`
47 | width: 20px;
48 | @include animation(0, 0.5s, rotation-lr);
49 | `
50 | :`
51 |
52 | @include animation(0, 0.5s, rotation-rl);
53 | `
54 | }
55 |
56 | `;
57 |
58 | export const LauncherIcon = styled.img`
59 | filter: invert(91%) sepia(2%) saturate(1410%) hue-rotate(197deg) brightness(105%) contrast(93%);
60 | `;
61 |
62 | export const Header = styled.div`
63 | font-size: 20px;
64 | font-weight: 500;
65 | span {
66 | cursor: pointer;
67 | }
68 | `;
--------------------------------------------------------------------------------
/src/scss/animation.scss:
--------------------------------------------------------------------------------
1 | @mixin animation ($delay, $duration, $animation) {
2 | -webkit-animation-delay: $delay;
3 | -webkit-animation-duration: $duration;
4 | -webkit-animation-name: $animation;
5 | -webkit-animation-fill-mode: forwards; /* this prevents the animation from restarting! */
6 |
7 | -moz-animation-delay: $delay;
8 | -moz-animation-duration: $duration;
9 | -moz-animation-name: $animation;
10 | -moz-animation-fill-mode: forwards; /* this prevents the animation from restarting! */
11 |
12 | animation-delay: $delay;
13 | animation-duration: $duration;
14 | animation-name: $animation;
15 | animation-fill-mode: forwards; /* this prevents the animation from restarting! */
16 | }
17 |
18 | @mixin keyframes ($animation-name) {
19 | @-webkit-keyframes #{$animation-name} {
20 | @content;
21 | }
22 |
23 | @-moz-keyframes #{$animation-name} {
24 | @content;
25 | }
26 |
27 | @keyframes #{$animation-name} {
28 | @content;
29 | }
30 | }
31 |
32 | @include keyframes(rotation-lr) {
33 | from {
34 | transform: rotate(-90deg);
35 | }
36 | to {
37 | transform: rotate(0);
38 | }
39 | }
40 |
41 | @include keyframes(rotation-rl) {
42 | from {
43 | transform: rotate(90deg);
44 | }
45 | to {
46 | transform: rotate(0);
47 | }
48 | }
49 |
50 | @include keyframes(slide-in) {
51 | from {
52 | opacity: 0;
53 | transform: translateY(10px);
54 | }
55 | to {
56 | opacity: 1;
57 | transform: translateY(0);
58 | }
59 | }
60 |
61 | @include keyframes(slide-out) {
62 | from {
63 | opacity: 1;
64 | transform: translateY(0);
65 | }
66 | to {
67 | opacity: 0;
68 | transform: translateY(10px);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/example/src/views/liquidityPool.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, Fragment, useState } from 'react'
2 | import { LiquidityPoolsWidget } from 'react-defi-widget'
3 | import {
4 | Row,
5 | Col,
6 | Jumbotron,
7 | Button,
8 | Card,
9 | CardImg,
10 | Media,
11 | CardText,
12 | CardFooter,
13 | Badge,
14 | CardHeader,
15 | CardBody,
16 | CardTitle,
17 | CardSubtitle
18 | } from "reactstrap";
19 | import styled from "styled-components"
20 |
21 |
22 | const LiquidityPool = (props) => {
23 |
24 | const { web3context } = props;
25 |
26 | const color = "orange";
27 |
28 | // Provides whitelisted pools
29 | // const defaultPool = "ENJBNT";
30 | // const whitelisted = ["ETHBNT", "ENJBNT", "DAIBNT"];
31 |
32 | return (
33 |
34 |
35 |
36 |
37 |
44 |
45 |
46 |
47 |
48 | )
49 | }
50 |
51 | export default LiquidityPool;
52 |
53 | /*
54 | const GreyGradientJumbotron = styled(Jumbotron)`
55 | background-image: linear-gradient(to bottom, #bdc3c7, #2c3e50);
56 | border-radius: 10px;
57 | color: white;
58 | height: 600px;
59 | `;
60 | */
61 |
62 | const OrangeGradientJumbotron = styled(Jumbotron)`
63 | background-image: linear-gradient(to bottom, #f5af19, #f12711);
64 | border-radius: 10px;
65 | color: white;
66 | height: 600px;
67 |
68 | padding: 40px 20px 40px 20px;
69 | `;
70 |
71 |
--------------------------------------------------------------------------------
/example/src/views/navbar.js:
--------------------------------------------------------------------------------
1 | import React, { Component, useEffect, useState } from 'react'
2 | import {
3 | Navbar,
4 | NavbarToggler,
5 | NavbarBrand,
6 | Nav,
7 | NavItem,
8 | NavbarText,
9 | NavLink,
10 | DropdownToggle,
11 | Container,
12 | DropdownItem,
13 | DropdownMenu,
14 | UncontrolledDropdown,
15 | Collapse
16 |
17 | } from "reactstrap"
18 | import styled from "styled-components"
19 |
20 | const NavBar = (props) => {
21 |
22 | const [isOpen, setIsOpen] = useState(false);
23 |
24 | const toggle = () => setIsOpen(!isOpen);
25 |
26 | return (
27 |
28 |
29 |
30 |
31 |
32 |
33 | React Defi Widget
34 |
35 |
36 |
37 |
38 |
39 |
40 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | )
64 | }
65 |
66 | const BrandHeader = styled.span`
67 | font-family: Pacifico;
68 | font-size: 20px;
69 |
70 | `;
71 |
72 | const StyledNavbar = styled(Navbar)`
73 | -webkit-box-shadow: 0 4px 6px -6px #222;
74 | -moz-box-shadow: 0 4px 6px -6px #222;
75 | box-shadow: 0 4px 6px -6px #222;
76 | `;
77 |
78 | //background-image: linear-gradient(#0275d8 70%, white 175px);
79 |
80 | export default NavBar;
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-defi-widget",
3 | "version": "0.4.0",
4 | "description": "Ethereum Defi widget for React apps",
5 | "author": "Pisuth D. ",
6 | "license": "MIT",
7 | "repository": "pisuthd/react-defi-widget",
8 | "main": "dist/index.js",
9 | "module": "dist/index.es.js",
10 | "jsnext:main": "dist/index.es.js",
11 | "engines": {
12 | "node": ">=8",
13 | "npm": ">=5"
14 | },
15 | "keywords": [
16 | "react",
17 | "ethereum",
18 | "bancor",
19 | "defi",
20 | "widget",
21 | "javascript"
22 | ],
23 | "scripts": {
24 | "test": "cross-env CI=1 react-scripts test --env=jsdom",
25 | "test:watch": "react-scripts test --env=jsdom",
26 | "build": "rollup -c",
27 | "start": "rollup -c -w",
28 | "prepare": "npm run build",
29 | "predeploy": "cd example && npm install && npm run build"
30 | },
31 | "peerDependencies": {
32 | "prop-types": "^15.6.2",
33 | "react": "^16.12.0",
34 | "react-dom": "^16.12.0"
35 | },
36 | "devDependencies": {
37 | "@svgr/rollup": "^2.4.1",
38 | "babel-core": "^6.26.3",
39 | "babel-eslint": "10.0.3",
40 | "babel-plugin-external-helpers": "^6.22.0",
41 | "babel-plugin-transform-async-to-generator": "^6.24.1",
42 | "babel-plugin-transform-runtime": "^6.23.0",
43 | "babel-preset-env": "^1.7.0",
44 | "babel-preset-react": "^6.24.1",
45 | "babel-preset-stage-0": "^6.24.1",
46 | "cross-env": "^5.1.4",
47 | "eslint": "^6.6.0",
48 | "eslint-config-standard": "^11.0.0",
49 | "eslint-config-standard-react": "^6.0.0",
50 | "eslint-plugin-import": "^2.13.0",
51 | "eslint-plugin-node": "^7.0.1",
52 | "eslint-plugin-promise": "^4.0.0",
53 | "eslint-plugin-react": "^7.10.0",
54 | "eslint-plugin-standard": "^3.1.0",
55 | "gh-pages": "^1.2.0",
56 | "node-sass": "^4.13.1",
57 | "react": "^16.12.0",
58 | "react-dom": "^16.12.0",
59 | "react-scripts": "3.4.0",
60 | "rollup": "^0.64.1",
61 | "rollup-plugin-babel": "^3.0.7",
62 | "rollup-plugin-commonjs": "^9.1.3",
63 | "rollup-plugin-node-resolve": "^3.3.0",
64 | "rollup-plugin-peer-deps-external": "^2.2.0",
65 | "rollup-plugin-postcss": "^1.6.2",
66 | "rollup-plugin-url": "^1.4.0"
67 | },
68 | "files": [
69 | "dist"
70 | ],
71 | "dependencies": {
72 | "ethers": "^4.0.45",
73 | "react-container-dimensions": "^1.4.1",
74 | "react-minimal-pie-chart": "^7.1.0",
75 | "remove": "^0.1.5",
76 | "styled-components": "^5.0.1"
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/constants.js:
--------------------------------------------------------------------------------
1 |
2 | export const COLORS = {
3 | default: "#0275d8",
4 | green1: "#35e65d",
5 | grey0: "#808080",
6 | grey1: "#cdd8ec",
7 | grey2: "#f4f7f9",
8 | grey3: "#b5b5b5",
9 | dark: "#000",
10 | turqois1: "#35cce6",
11 | turqois2: "#a3eaf7",
12 | primary: "#090446",
13 | success: "#4CAF50",
14 | secondary: "#E8EAF6",
15 | white: "#fff",
16 | red: "#ff0000"
17 | }
18 |
19 | export const PAGES = {
20 | DEFAULT: "SWAP",
21 | SWAP: "SWAP",
22 | POOLS: "POOLS"
23 | }
24 |
25 | export const TRANSACTION_TYPE = {
26 | SWAP : "SWAP",
27 | ADD_LIQUIDITY: "ADD_LIQUIDITY"
28 | }
29 |
30 | export const BANCOR_CONTRACTS = {
31 | ROPSTEN : {
32 | ContractRegistry : "0xFD95E724962fCfC269010A0c6700Aa09D5de3074"
33 | },
34 | MAINNET : {
35 | ContractRegistry : "0x52Ae12ABe5D8BD778BD5397F99cA900624CfADD4"
36 | }
37 |
38 | }
39 |
40 | export const TOKEN_CONTRACTS = {
41 | ROPSTEN : {
42 | BANCOR_ETHER : "0xD368b98d03855835E2923Dc000b3f9c2EBF1b27b",
43 | BNT: "0x62bd9D98d4E188e281D7B78e29334969bbE1053c",
44 | BUSD: "0xeedc02321e60fc310b3973877729193fc288297f"
45 | },
46 | MAINNET : {
47 | BANCOR_ETHER : "0xc0829421C1d260BD3cB3E0F06cfE2D52db2cE315",
48 | BNT: "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C",
49 | BUSD : "0x309627af60f0926daa6041b8279484312f2bf060"
50 | }
51 | }
52 |
53 | export const NETWORKS = {
54 | MAINNET : 1,
55 | ROPSTEN : 3
56 | }
57 |
58 | export const HEADLINES = {
59 | HEADER : {
60 | SWAP : "Simple & Easy Token Swap",
61 | POOLS: "Pool Creation/Stake Liquidity"
62 | },
63 | TEXT : {
64 | SWAP : "Allow your site's visitor convert Ethereum's ERC-20 tokens for other & earn commission on each transaction",
65 | POOLS: "Easily staking liquidity and earn fees on Bancor as well as make your own pool"
66 | },
67 | DISCLAIMER : {
68 | SWAP : "DISCLAIMER : This feature give access to third-party liquidity pools. We make no warranties of any kind of financial loss including but not limited to accuracy, security and updatedness. Please consult your financial advisor before taking any financial decision.",
69 | POOLS : "DISCLAIMER : This feature give access to third-party liquidity pools. We make no warranties of any kind of financial loss including but not limited to accuracy, security and updatedness. Please consult your financial advisor before taking any financial decision."
70 | },
71 | ACTIONS : {
72 | SWAP : "Swap",
73 | POOLS : "Ok"
74 | }
75 | }
76 |
77 | export const CACHE_URL = "https://db-staging.stakingdojo.com";
78 |
79 |
--------------------------------------------------------------------------------
/example/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component, useEffect, useState } from 'react'
2 |
3 | import { useWeb3Context } from 'web3-react';
4 | import classnames from 'classnames';
5 | import {
6 | Row,
7 | Col,
8 | Nav,
9 | NavItem,
10 | NavLink,
11 | TabContent,
12 | TabPane
13 | } from "reactstrap";
14 |
15 | import MainLayout from "./layouts/main";
16 | import MainPage from "./views/main";
17 | import LiquidityPage from "./views/liquidityPool";
18 | import styled from 'styled-components';
19 |
20 |
21 | const App = () => {
22 |
23 | const web3context = useWeb3Context();
24 |
25 | useEffect(() => {
26 | web3context.setFirstValidConnector(['MetaMask'])
27 | }, [])
28 |
29 | const [activeTab, setActiveTab] = useState('1');
30 |
31 | const toggle = tab => {
32 | if (activeTab !== tab) setActiveTab(tab);
33 | }
34 |
35 | return (
36 |
37 |
38 |
39 |
40 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | )
82 |
83 | }
84 |
85 | const Menu = styled.div`
86 | height: 60px;
87 | justify-content: center;
88 | `
89 |
90 | const StyledNavLink = styled.a`
91 | color: inherit;
92 | ${ props => props.active && `
93 | font-weight: 700;
94 | `}
95 |
96 | :hover {
97 | text-decoration: underline;
98 | color: inherit;
99 | }
100 | `
101 |
102 | export default App;
--------------------------------------------------------------------------------
/example/src/views/main.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, Fragment, useState } from 'react'
2 | import {
3 | Row,
4 | Col,
5 | Jumbotron,
6 | Button,
7 | Card,
8 | CardImg,
9 | Media,
10 | CardText,
11 | CardFooter,
12 | Badge,
13 | CardHeader,
14 | CardBody,
15 | CardTitle,
16 | CardSubtitle
17 | } from "reactstrap";
18 |
19 | import { TokenConversionWidget } from 'react-defi-widget'
20 | import styled from "styled-components"
21 | import BancorImg from "../assets/bancor.png"
22 |
23 | const MainPage = (props) => {
24 |
25 | // Looks at https://github.com/NoahZinsmeister/web3-react
26 | const { web3context } = props;
27 |
28 |
29 | // Custom header, headline and description of the widget
30 | const widgetTitle = "Simple & Easy Token Swap";
31 | const widgetSubtitle = "You can swap your Ethereum ERC-20 tokens for other tokens within this widget";
32 | const widgetDescription = "DISCLAIMER : This feature give access to third-party liquidity pools. We make no warranties of any kind of financial loss including but not limited to accuracy, security and updatedness. Please consult your financial advisor before taking any financial decision."
33 |
34 | // Widget's button color
35 | const widgetColor = "#0275d8";
36 |
37 | // Widget's default base and pair token
38 | const widgetBaseCurrency = "ETH";
39 | const widgetPairCurrency = "BNT";
40 |
41 |
42 | // Receives commission in BNT from each token conversion
43 | // const affiliateAccount = "0x8fD00f170FDf3772C5ebdCD90bF257316c69BA45";
44 | // const affiliateFee = 1.5; // 2.5% Maximum is 3%
45 |
46 | // Provides whitelisted tokens to be traded in the widget
47 | // const whitelisted = ["ETH", "BNT", "KNC", "ENJ"]
48 |
49 | return (
50 |
51 |
52 |
53 |
54 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | )
76 | }
77 | /*
78 | const StyledJumbotron = styled(Jumbotron)`
79 | background-image: linear-gradient(to bottom, #5bc0de, #0275d8);
80 | border-radius: 10px;
81 | color: white;
82 | height: 550px;
83 | `;
84 | */
85 |
86 | const StyledJumbotron = styled(Jumbotron)`
87 | background-image: linear-gradient(to bottom, #5bc0de, #0275d8);
88 | border-radius: 10px;
89 | color: white;
90 | height: 600px;
91 |
92 | padding: 40px 20px 40px 20px;
93 | `;
94 |
95 |
96 | export default MainPage;
--------------------------------------------------------------------------------
/src/widget.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import Widget from "./components/Widget";
5 |
6 | import { PAGES } from "./constants";
7 |
8 | import BancorContextProvider from "./contexts/bancor";
9 | import ModalContextProvider from "./contexts/modal";
10 |
11 | const ContextProviders = ({ children }) => {
12 | return (
13 |
14 |
15 | {children}
16 |
17 |
18 | )
19 | }
20 |
21 | const ConnectedWidget = (props) => {
22 |
23 | const {
24 | web3ReactContext,
25 | currentPage,
26 | title,
27 | subtitle,
28 | description,
29 | color,
30 | baseCurrency,
31 | pairCurrency,
32 | affiliateAccount,
33 | affiliateFee,
34 | whitelisted,
35 | defaultPool,
36 | disablePoolCreation
37 | } = props;
38 |
39 | return (
40 |
41 |
56 |
57 | )
58 | }
59 |
60 | ConnectedWidget.propTypes = {
61 | web3ReactContext: PropTypes.object.isRequired,
62 | currentPage: PropTypes.string,
63 | title: PropTypes.string,
64 | subtitle: PropTypes.string,
65 | description: PropTypes.string,
66 | color: PropTypes.string,
67 | baseCurrency: PropTypes.string,
68 | pairCurrency: PropTypes.string,
69 | affiliateAccount: PropTypes.string,
70 | affiliateFee: PropTypes.number,
71 | whitelisted: PropTypes.array,
72 | defaultPool: PropTypes.string,
73 | disablePoolCreation: PropTypes.bool
74 | };
75 |
76 |
77 | export const TokenConversionWidget = (props) => {
78 |
79 | const {
80 | web3ReactContext,
81 | title,
82 | subtitle,
83 | description,
84 | color,
85 | baseCurrency,
86 | pairCurrency,
87 | affiliateAccount,
88 | affiliateFee,
89 | whitelisted
90 | } = props;
91 |
92 | return
105 | }
106 |
107 | TokenConversionWidget.propTypes = {
108 | web3ReactContext: PropTypes.object.isRequired,
109 | currentPage: PropTypes.string,
110 | title: PropTypes.string,
111 | subtitle: PropTypes.string,
112 | description: PropTypes.string,
113 | color: PropTypes.string,
114 | baseCurrency: PropTypes.string,
115 | pairCurrency: PropTypes.string,
116 | affiliateAccount: PropTypes.string,
117 | affiliateFee: PropTypes.number,
118 | whitelisted: PropTypes.array
119 |
120 | };
121 |
122 |
123 | export const LiquidityPoolsWidget = (props) => {
124 |
125 | const {
126 | web3ReactContext,
127 | color,
128 | whitelisted,
129 | defaultPool,
130 | disablePoolCreation
131 | } = props;
132 |
133 | return
141 | }
142 |
143 |
144 | LiquidityPoolsWidget.propTypes = {
145 | web3ReactContext: PropTypes.object.isRequired,
146 | color: PropTypes.string,
147 | whitelisted: PropTypes.array,
148 | defaultPool: PropTypes.string,
149 | disablePoolCreation: PropTypes.bool
150 | };
151 |
152 |
153 | export default ConnectedWidget;
--------------------------------------------------------------------------------
/assets/launcher_button.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/components/Widget/components/modals/index.js:
--------------------------------------------------------------------------------
1 | import React, { Component, useCallback, useState, useEffect } from 'react';
2 |
3 | import styled from "styled-components"
4 |
5 | import { MODAL_TYPES, useModal } from "../../../../contexts/modal";
6 | import loadingIcon from "../../../../../assets/loading-large.gif";
7 | import { toFixed } from "../../../../utils/conversion";
8 |
9 | import EtherTokenModal from "./etherToken";
10 | import ErrorMessageModal from "./errorMessage";
11 | import ConfirmModal from "./confirm";
12 |
13 | const Modal = (props) => {
14 |
15 | const { width, height, color, web3ReactContext } = props;
16 |
17 | const {
18 | title,
19 | message,
20 | type,
21 | closeEtherTokenModal,
22 | getNativeETHBalance,
23 | getETHTokenBalance,
24 | depositETHToken,
25 | withdrawETHToken,
26 | closeErrorModal,
27 | closeConfirmModal,
28 | showConfirmModal
29 | } = useModal();
30 | const [showLoadingIcon, setShowLoadingIcon] = useState(false);
31 | const [errorMessage, setErrorMessage] = useState();
32 |
33 | useEffect(() => {
34 | if (type === MODAL_TYPES.PROCESSING) {
35 | setShowLoadingIcon(true);
36 | } else {
37 | setShowLoadingIcon(false);
38 | }
39 | }, [type])
40 |
41 | switch (type) {
42 | case MODAL_TYPES.ETHERTOKEN:
43 | return (
44 |
59 | )
60 | case MODAL_TYPES.ERROR:
61 | return
68 | case MODAL_TYPES.CONFIRM:
69 | return
76 | default:
77 | return (
78 |
79 |
82 | {showLoadingIcon && (
83 |
84 |
85 |
86 | )}
87 |
88 | {title}
89 | {message !== "" &&
90 | (
91 |
92 | {message}
93 |
94 | )}
95 |
96 |
97 |
98 | )
99 | }
100 | }
101 |
102 |
103 | export const Row = styled.div`
104 | display: flex;
105 | text-align: left;
106 | font-size: 14px;
107 |
108 | input, select {
109 | padding: 4px 8px 4px 8px;
110 | border: 1px solid #A9A9A9;
111 | border-radius: 4px;
112 | width: 100%;
113 | height: 100%;
114 | background-color: transparent;
115 | }
116 |
117 | select {
118 | cursor: pointer;
119 | }
120 |
121 | `;
122 |
123 | const Select = styled.a`
124 | font-weight: ${props => props.active ? "600" : "400"};
125 | cursor: pointer;
126 | ${props => props.active && `
127 | text-decoration: underline;
128 | `}
129 | `;
130 |
131 | export const Wrapper = styled.div`
132 | margin: 0;
133 | color: black;
134 | position: absolute;
135 | top: 50%;
136 | left: 50%;
137 | transform: translate(-50%, -50%);
138 | `;
139 |
140 | export const Content = styled.div`
141 | background: #fff;
142 | border-radius: 5px;
143 | padding: 20px;
144 | text-align: center;
145 | font-size: 14px;
146 | word-wrap: break-word;
147 | border: 0.3px solid rgba(0, 0, 0, 0.6);
148 | width: ${props => (props.width && props.width > 600) ? `${(props.width) / 2}px` : `${props.width * 0.8}px`};
149 | `;
150 |
151 | const Header = styled.div`
152 | .close {
153 | color: #aaa;
154 | float: right;
155 | font-size: 28px;
156 | font-weight: bold;
157 | }
158 | `;
159 |
160 | export const Footer = styled.div`
161 | height: 40px;
162 | position: relative;
163 | `;
164 |
165 | export const Body = styled.div`
166 | font-size: 12px;
167 | `;
168 |
169 | const Description = styled.div`
170 | font-size: 10px;
171 | margin-top: 10px;
172 | font-weight: 600;
173 | `;
174 |
175 | const LoadingContainer = styled.div`
176 | padding-bottom: 20px;
177 | `;
178 |
179 | export const ButtonGroup = styled.div`
180 | position: absolute;
181 | left: 50%;
182 | top: 50%;
183 | -ms-transform: translate(-50%, -50%);
184 | transform: translate(-50%, -50%);
185 | `;
186 |
187 | export const Button = styled.button`
188 | background-color: ${props => props.color && `${props.color}`};
189 | border: none;
190 | color: white;
191 | text-align: center;
192 | text-decoration: none;
193 | padding: 4px 8px 4px 8px;
194 | font-size: 14px;
195 | margin-right: 4px;
196 | border-radius: 4px;
197 | ${props => props.disabled && 'opacity: 0.6;'}
198 | `;
199 |
200 |
201 | export default Modal;
--------------------------------------------------------------------------------
/src/contracts/bancor/ERC20Token.js:
--------------------------------------------------------------------------------
1 | export const ERC20TokenAbi = [
2 | {
3 | "constant": true,
4 | "inputs": [],
5 | "name": "name",
6 | "outputs": [
7 | {
8 | "name": "",
9 | "type": "string"
10 | }
11 | ],
12 | "payable": false,
13 | "stateMutability": "view",
14 | "type": "function"
15 | },
16 | {
17 | "constant": false,
18 | "inputs": [
19 | {
20 | "name": "_spender",
21 | "type": "address"
22 | },
23 | {
24 | "name": "_value",
25 | "type": "uint256"
26 | }
27 | ],
28 | "name": "approve",
29 | "outputs": [
30 | {
31 | "name": "success",
32 | "type": "bool"
33 | }
34 | ],
35 | "payable": false,
36 | "stateMutability": "nonpayable",
37 | "type": "function"
38 | },
39 | {
40 | "constant": true,
41 | "inputs": [],
42 | "name": "totalSupply",
43 | "outputs": [
44 | {
45 | "name": "",
46 | "type": "uint256"
47 | }
48 | ],
49 | "payable": false,
50 | "stateMutability": "view",
51 | "type": "function"
52 | },
53 | {
54 | "constant": false,
55 | "inputs": [
56 | {
57 | "name": "_from",
58 | "type": "address"
59 | },
60 | {
61 | "name": "_to",
62 | "type": "address"
63 | },
64 | {
65 | "name": "_value",
66 | "type": "uint256"
67 | }
68 | ],
69 | "name": "transferFrom",
70 | "outputs": [
71 | {
72 | "name": "success",
73 | "type": "bool"
74 | }
75 | ],
76 | "payable": false,
77 | "stateMutability": "nonpayable",
78 | "type": "function"
79 | },
80 | {
81 | "constant": true,
82 | "inputs": [],
83 | "name": "decimals",
84 | "outputs": [
85 | {
86 | "name": "",
87 | "type": "uint8"
88 | }
89 | ],
90 | "payable": false,
91 | "stateMutability": "view",
92 | "type": "function"
93 | },
94 | {
95 | "constant": true,
96 | "inputs": [
97 | {
98 | "name": "",
99 | "type": "address"
100 | }
101 | ],
102 | "name": "balanceOf",
103 | "outputs": [
104 | {
105 | "name": "",
106 | "type": "uint256"
107 | }
108 | ],
109 | "payable": false,
110 | "stateMutability": "view",
111 | "type": "function"
112 | },
113 | {
114 | "constant": true,
115 | "inputs": [],
116 | "name": "symbol",
117 | "outputs": [
118 | {
119 | "name": "",
120 | "type": "string"
121 | }
122 | ],
123 | "payable": false,
124 | "stateMutability": "view",
125 | "type": "function"
126 | },
127 | {
128 | "constant": false,
129 | "inputs": [
130 | {
131 | "name": "_to",
132 | "type": "address"
133 | },
134 | {
135 | "name": "_value",
136 | "type": "uint256"
137 | }
138 | ],
139 | "name": "transfer",
140 | "outputs": [
141 | {
142 | "name": "success",
143 | "type": "bool"
144 | }
145 | ],
146 | "payable": false,
147 | "stateMutability": "nonpayable",
148 | "type": "function"
149 | },
150 | {
151 | "constant": true,
152 | "inputs": [
153 | {
154 | "name": "",
155 | "type": "address"
156 | },
157 | {
158 | "name": "",
159 | "type": "address"
160 | }
161 | ],
162 | "name": "allowance",
163 | "outputs": [
164 | {
165 | "name": "",
166 | "type": "uint256"
167 | }
168 | ],
169 | "payable": false,
170 | "stateMutability": "view",
171 | "type": "function"
172 | },
173 | {
174 | "inputs": [
175 | {
176 | "name": "_name",
177 | "type": "string"
178 | },
179 | {
180 | "name": "_symbol",
181 | "type": "string"
182 | },
183 | {
184 | "name": "_decimals",
185 | "type": "uint8"
186 | },
187 | {
188 | "name": "_totalSupply",
189 | "type": "uint256"
190 | }
191 | ],
192 | "payable": false,
193 | "stateMutability": "nonpayable",
194 | "type": "constructor"
195 | },
196 | {
197 | "anonymous": false,
198 | "inputs": [
199 | {
200 | "indexed": true,
201 | "name": "_from",
202 | "type": "address"
203 | },
204 | {
205 | "indexed": true,
206 | "name": "_to",
207 | "type": "address"
208 | },
209 | {
210 | "indexed": false,
211 | "name": "_value",
212 | "type": "uint256"
213 | }
214 | ],
215 | "name": "Transfer",
216 | "type": "event"
217 | },
218 | {
219 | "anonymous": false,
220 | "inputs": [
221 | {
222 | "indexed": true,
223 | "name": "_owner",
224 | "type": "address"
225 | },
226 | {
227 | "indexed": true,
228 | "name": "_spender",
229 | "type": "address"
230 | },
231 | {
232 | "indexed": false,
233 | "name": "_value",
234 | "type": "uint256"
235 | }
236 | ],
237 | "name": "Approval",
238 | "type": "event"
239 | }
240 | ]
241 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # This repo is unmaintained!
2 |
3 | # React DeFi Widget
4 |
5 | > Ethereum Defi widget for React apps
6 |
7 | [](https://www.npmjs.com/package/react-defi-widget) [](https://standardjs.com)
8 |
9 |
10 | ## Introduction
11 |
12 | `react-defi-widget` is a React widget that allows your website visitors to quickly and easily access automated liquidity pools (Bancor, ...) in Ethereum blockchain where they can convert tokens to another seamlessly and completely permissionless as well as stake liquidity to the pool. You can embed the widget and set a fee that allows take commissions up to 3% from each transaction all you need is `web3-react` been imported on your app and passing its context through props to the widget component.
13 |
14 | ## Preview
15 |
16 | 
17 |
18 | ### Live example
19 |
20 | [https://modest-bardeen-fe9d2c.netlify.com/](https://modest-bardeen-fe9d2c.netlify.com/)
21 |
22 | ## Features
23 |
24 | * Enabling on-chain token swap on any React-based applications through Bancor
25 | * Earn commission in BNT token up to 3%
26 | * Customizable widget attributes
27 | * Support of Mainnet and Ropsten
28 | * Adding liquidity to a pool within Bancor and earning fee (normally ~0.1-0.3% on each trade)
29 | * Creating a new liquidity pool within Bancor (aka. List your token on decentralized exchanges for free)
30 |
31 | ## Install
32 |
33 | ```bash
34 | npm install --save react-defi-widget
35 | ```
36 |
37 | ## Usage
38 |
39 | ### Token Conversion Widget
40 |
41 | Basic Usage :
42 |
43 | ```jsx
44 | import React, { Component, Fragment } from 'react'
45 | import { useWeb3Context } from 'web3-react';
46 | import { TokenConversionWidget } from 'react-defi-widget'
47 |
48 | const MainPage = (props) => {
49 |
50 | const context = useWeb3Context();
51 |
52 | useEffect(() => {
53 | context.setFirstValidConnector(['MetaMask']) // Or on your choice
54 | }, [])
55 |
56 | return (
57 |
58 |
61 |
62 | )
63 | }
64 | ```
65 |
66 | Advance Usage :
67 |
68 | ```jsx
69 | import React, { Component, Fragment } from 'react'
70 | import { useWeb3Context } from 'web3-react';
71 | import { TokenConversionWidget } from 'react-defi-widget'
72 |
73 | const MainPage = (props) => {
74 |
75 | const context = useWeb3Context();
76 |
77 | useEffect(() => {
78 | context.setFirstValidConnector(['MetaMask']) // Or on your choice
79 | }, [])
80 |
81 | return (
82 |
83 |
95 |
96 | )
97 | }
98 | ```
99 |
100 | ### Liquidity Pool Explorer / Pool Creation Widget
101 |
102 | The widget offers a vast opportunity for your website visitors to stake liquidity and create the new pool in the permissionless manner.
103 |
104 | Shows all available liquidity pools :
105 |
106 | ```jsx
107 | import React, { Component, Fragment } from 'react'
108 | import { useWeb3Context } from 'web3-react';
109 | import { LiquidityPoolsWidget } from 'react-defi-widget'
110 |
111 | const MainPage = (props) => {
112 |
113 | const context = useWeb3Context();
114 |
115 | useEffect(() => {
116 | context.setFirstValidConnector(['MetaMask']) // Or on your choice
117 | }, [])
118 |
119 | return (
120 |
121 |
125 |
126 | )
127 | }
128 | ```
129 |
130 | Filter specific pools :
131 |
132 | ```jsx
133 | import React, { Component, Fragment } from 'react'
134 | import { useWeb3Context } from 'web3-react';
135 | import { LiquidityPoolsWidget } from 'react-defi-widget'
136 |
137 | const MainPage = (props) => {
138 |
139 | const context = useWeb3Context();
140 |
141 | useEffect(() => {
142 | context.setFirstValidConnector(['MetaMask']) // Or on your choice
143 | }, [])
144 |
145 | return (
146 |
147 |
154 |
155 | )
156 | }
157 | ```
158 |
159 |
160 | ## Local Development
161 |
162 | To run the examples locally, run the library first
163 |
164 | ```
165 | npm install
166 | npm start
167 | ```
168 |
169 | Then open another window and run the webapp
170 |
171 | ```
172 | cd example/
173 | npm install
174 | npm start
175 | ```
176 |
177 | ## Properties
178 |
179 | ### Token Conversion Widget
180 |
181 | | |type|required|default value|description|
182 | |---|--- |--- |--- |--- |
183 | |**web3ReactContext**|PropTypes.object|YES| |The web3-react context object that the widget will goes to connect|
184 | |**title**|PropTypes.string|NO||Title of the widget|
185 | |**subtitle**|PropTypes.string|NO||Subtitle of the widget|
186 | |**description**|PropTypes.string|NO||Long description at the bottom of the widget|
187 | |**color**|PropTypes.string|NO|#0275d8|Color of the widget|
188 | |**baseCurrency**|PropTypes.string|NO|ETH|Default base currency in a symbol format|
189 | |**pairCurrency**|PropTypes.string|NO|BNT|Default pair currency in a symbol format|
190 | |**affiliateAccount**|PropTypes.string|NO|None|The recipient account that collects the fee from the transaction|
191 | |**affiliateFee**|PropTypes.number|NO|0|The fee rate, for example 2.5 if the fee is set to 2.5%|
192 | |**whitelisted**|PropTypes.array|NO||Provides whitelisted tokens to be traded |
193 |
194 | ### Liquidity Pool Widget
195 |
196 | | |type|required|default value|description|
197 | |---|--- |--- |--- |--- |
198 | |**web3ReactContext**|PropTypes.object|YES| |The web3-react context object that the widget will goes to connect|
199 | |**title**|PropTypes.string|NO||Title of the widget|
200 | |**subtitle**|PropTypes.string|NO||Subtitle of the widget|
201 | |**description**|PropTypes.string|NO||Long description at the bottom of the widget|
202 | |**color**|PropTypes.string|NO|#0275d8|Color of the widget|
203 | |**whitelisted**|PropTypes.array|NO||Provides whitelisted liquidity pools|
204 | |**defaultPool**|PropTypes.string|NO||Default pool |
205 | |**disablePoolCreation**|PropTypes.bool|NO|false|Remove pool creation menu from the widget |
206 |
207 | ## License
208 |
209 | MIT © [pisuthd](https://github.com/pisuthd)
210 |
--------------------------------------------------------------------------------
/src/components/Widget/components/modals/etherToken.js:
--------------------------------------------------------------------------------
1 | import React, { Component, useCallback, useState, useEffect } from 'react';
2 | import styled from "styled-components"
3 |
4 | import { Wrapper, Content, Footer, Body, Row, ButtonGroup, Button } from "./index";
5 | import { toFixed } from "../../../../utils/conversion";
6 |
7 | const EtherTokenModal = (props) => {
8 |
9 | const {
10 | width,
11 | errorMessage,
12 | setErrorMessage,
13 | web3ReactContext,
14 | closeEtherTokenModal,
15 | getNativeETHBalance,
16 | getETHTokenBalance,
17 | depositETHToken,
18 | withdrawETHToken,
19 | showLoadingIcon,
20 | setShowLoadingIcon,
21 | color,
22 | closeErrorModal
23 | } = props;
24 |
25 | const [isWrapPanel, setWrapPanel] = useState(true);
26 | const [ nativeEthAmount, setNativeEthAmount ] = useState(0);
27 | const [ wethAmount, setWethAmount] = useState(0);
28 | const [ balance, setBalance ] = useState(0);
29 |
30 | const select = (isWrap) => {
31 | setWrapPanel(isWrap === "wrap" ? true : false);
32 | }
33 |
34 | const handleChange = useCallback(async (e) => {
35 | const regexp = /^[0-9]*(\.[0-9]{0,6})?$/;
36 | if (e.target.id === "availableNativeETH") {
37 | const value = regexp.test(e.target.value) ? (e.target.value) : nativeEthAmount;
38 | setNativeEthAmount(value);
39 | } else {
40 | const value = regexp.test(e.target.value) ? (e.target.value) : wethAmount;
41 | setWethAmount(value);
42 | }
43 | }, [nativeEthAmount, wethAmount])
44 |
45 | useEffect(() => {
46 | if (isWrapPanel) {
47 | getNativeETHBalance(web3ReactContext).then(
48 | balance => {
49 | setBalance(Number(balance));
50 | }
51 | ).catch(error => {
52 | console.log("getNativeETHBalance error : ", error);
53 | })
54 | } else {
55 | getETHTokenBalance(web3ReactContext).then(
56 | balance => {
57 | console.log("ethtoken : ", balance);
58 | setBalance(Number(balance));
59 | }
60 | ).catch(error => {
61 | console.log("getETHTokenBalance error : ", error);
62 | })
63 | }
64 | }, [isWrapPanel, web3ReactContext])
65 |
66 | const onProceed = useCallback(async (e) => {
67 | setErrorMessage();
68 | if (showLoadingIcon) {
69 | return;
70 | }
71 | try {
72 | if (isWrapPanel) {
73 | console.log("nativeEthAmount / balance : ", nativeEthAmount, balance)
74 | if (Number(nativeEthAmount) > Number(balance)) {
75 | throw new Error("Insufficient amount.");
76 | }
77 | const tx = await depositETHToken(web3ReactContext, nativeEthAmount);
78 | setShowLoadingIcon(true);
79 | await tx.wait();
80 | setShowLoadingIcon(false);
81 | const balance = await getNativeETHBalance(web3ReactContext);
82 | setBalance(Number(balance));
83 |
84 | } else {
85 | if (Number(wethAmount) > Number(balance)) {
86 | throw new Error("Insufficient amount.");
87 | }
88 | const tx = await withdrawETHToken(web3ReactContext, wethAmount);
89 | setShowLoadingIcon(true);
90 | await tx.wait();
91 | setShowLoadingIcon(false);
92 | const balance = await getETHTokenBalance(web3ReactContext);
93 | setBalance(Number(balance));
94 | }
95 | } catch (error) {
96 | setErrorMessage(error.message);
97 | }
98 | }, [isWrapPanel, web3ReactContext, nativeEthAmount, wethAmount, balance, showLoadingIcon])
99 |
100 | return (
101 |
102 |
105 |
106 |
107 | ETH must be converted into a wrapped form prior to funding the ETH's liquidity pool.
108 |
109 |
110 |
113 |
117 |
118 |
121 | {isWrapPanel
122 | ?
123 |
133 | :
134 |
144 | }
145 |
146 |
147 |
148 | {` `}
149 | Available : {toFixed(balance, 6)}{` `}{`${isWrapPanel ? "ETH" : "Ether Token"}`}
150 |
151 | {errorMessage && (
152 |
153 | {errorMessage}
154 |
155 | )}
156 | {showLoadingIcon && (
157 |
158 | Please wait while your transaction is being processed...
159 |
160 | )}
161 |
162 |
168 |
169 |
170 | )
171 | }
172 |
173 | const MessageBar = styled.div`
174 | color: ${props => props.color};
175 | height: 24px;
176 | display: block;
177 | font-size: 12px;
178 | text-align: center;
179 | font-weight: 600;
180 | `;
181 |
182 | export default EtherTokenModal;
--------------------------------------------------------------------------------
/src/contracts/bancor/EtherToken.js:
--------------------------------------------------------------------------------
1 | export const EtherTokenAbi = [
2 | {
3 | "constant": true,
4 | "inputs": [
5 |
6 | ],
7 | "name": "name",
8 | "outputs": [
9 | {
10 | "name": "",
11 | "type": "string"
12 | }
13 | ],
14 | "payable": false,
15 | "stateMutability": "view",
16 | "type": "function"
17 | },
18 | {
19 | "constant": false,
20 | "inputs": [
21 | {
22 | "name": "_spender",
23 | "type": "address"
24 | },
25 | {
26 | "name": "_value",
27 | "type": "uint256"
28 | }
29 | ],
30 | "name": "approve",
31 | "outputs": [
32 | {
33 | "name": "success",
34 | "type": "bool"
35 | }
36 | ],
37 | "payable": false,
38 | "stateMutability": "nonpayable",
39 | "type": "function"
40 | },
41 | {
42 | "constant": true,
43 | "inputs": [
44 |
45 | ],
46 | "name": "totalSupply",
47 | "outputs": [
48 | {
49 | "name": "",
50 | "type": "uint256"
51 | }
52 | ],
53 | "payable": false,
54 | "stateMutability": "view",
55 | "type": "function"
56 | },
57 | {
58 | "constant": false,
59 | "inputs": [
60 | {
61 | "name": "_to",
62 | "type": "address"
63 | },
64 | {
65 | "name": "_amount",
66 | "type": "uint256"
67 | }
68 | ],
69 | "name": "withdrawTo",
70 | "outputs": [
71 |
72 | ],
73 | "payable": false,
74 | "stateMutability": "nonpayable",
75 | "type": "function"
76 | },
77 | {
78 | "constant": false,
79 | "inputs": [
80 | {
81 | "name": "_from",
82 | "type": "address"
83 | },
84 | {
85 | "name": "_to",
86 | "type": "address"
87 | },
88 | {
89 | "name": "_value",
90 | "type": "uint256"
91 | }
92 | ],
93 | "name": "transferFrom",
94 | "outputs": [
95 | {
96 | "name": "success",
97 | "type": "bool"
98 | }
99 | ],
100 | "payable": false,
101 | "stateMutability": "nonpayable",
102 | "type": "function"
103 | },
104 | {
105 | "constant": false,
106 | "inputs": [
107 | {
108 | "name": "_amount",
109 | "type": "uint256"
110 | }
111 | ],
112 | "name": "withdraw",
113 | "outputs": [
114 |
115 | ],
116 | "payable": false,
117 | "stateMutability": "nonpayable",
118 | "type": "function"
119 | },
120 | {
121 | "constant": true,
122 | "inputs": [
123 |
124 | ],
125 | "name": "decimals",
126 | "outputs": [
127 | {
128 | "name": "",
129 | "type": "uint8"
130 | }
131 | ],
132 | "payable": false,
133 | "stateMutability": "view",
134 | "type": "function"
135 | },
136 | {
137 | "constant": true,
138 | "inputs": [
139 | {
140 | "name": "",
141 | "type": "address"
142 | }
143 | ],
144 | "name": "balanceOf",
145 | "outputs": [
146 | {
147 | "name": "",
148 | "type": "uint256"
149 | }
150 | ],
151 | "payable": false,
152 | "stateMutability": "view",
153 | "type": "function"
154 | },
155 | {
156 | "constant": true,
157 | "inputs": [
158 |
159 | ],
160 | "name": "symbol",
161 | "outputs": [
162 | {
163 | "name": "",
164 | "type": "string"
165 | }
166 | ],
167 | "payable": false,
168 | "stateMutability": "view",
169 | "type": "function"
170 | },
171 | {
172 | "constant": false,
173 | "inputs": [
174 | {
175 | "name": "_to",
176 | "type": "address"
177 | },
178 | {
179 | "name": "_value",
180 | "type": "uint256"
181 | }
182 | ],
183 | "name": "transfer",
184 | "outputs": [
185 | {
186 | "name": "success",
187 | "type": "bool"
188 | }
189 | ],
190 | "payable": false,
191 | "stateMutability": "nonpayable",
192 | "type": "function"
193 | },
194 | {
195 | "constant": false,
196 | "inputs": [
197 | {
198 | "name": "_to",
199 | "type": "address"
200 | }
201 | ],
202 | "name": "depositTo",
203 | "outputs": [
204 |
205 | ],
206 | "payable": true,
207 | "stateMutability": "payable",
208 | "type": "function"
209 | },
210 | {
211 | "constant": false,
212 | "inputs": [
213 |
214 | ],
215 | "name": "deposit",
216 | "outputs": [
217 |
218 | ],
219 | "payable": true,
220 | "stateMutability": "payable",
221 | "type": "function"
222 | },
223 | {
224 | "constant": true,
225 | "inputs": [
226 | {
227 | "name": "",
228 | "type": "address"
229 | },
230 | {
231 | "name": "",
232 | "type": "address"
233 | }
234 | ],
235 | "name": "allowance",
236 | "outputs": [
237 | {
238 | "name": "",
239 | "type": "uint256"
240 | }
241 | ],
242 | "payable": false,
243 | "stateMutability": "view",
244 | "type": "function"
245 | },
246 | {
247 | "inputs": [
248 | {
249 | "name": "_name",
250 | "type": "string"
251 | },
252 | {
253 | "name": "_symbol",
254 | "type": "string"
255 | }
256 | ],
257 | "payable": false,
258 | "stateMutability": "nonpayable",
259 | "type": "constructor"
260 | },
261 | {
262 | "payable": true,
263 | "stateMutability": "payable",
264 | "type": "fallback"
265 | },
266 | {
267 | "anonymous": false,
268 | "inputs": [
269 | {
270 | "indexed": false,
271 | "name": "_amount",
272 | "type": "uint256"
273 | }
274 | ],
275 | "name": "Issuance",
276 | "type": "event"
277 | },
278 | {
279 | "anonymous": false,
280 | "inputs": [
281 | {
282 | "indexed": false,
283 | "name": "_amount",
284 | "type": "uint256"
285 | }
286 | ],
287 | "name": "Destruction",
288 | "type": "event"
289 | },
290 | {
291 | "anonymous": false,
292 | "inputs": [
293 | {
294 | "indexed": true,
295 | "name": "_from",
296 | "type": "address"
297 | },
298 | {
299 | "indexed": true,
300 | "name": "_to",
301 | "type": "address"
302 | },
303 | {
304 | "indexed": false,
305 | "name": "_value",
306 | "type": "uint256"
307 | }
308 | ],
309 | "name": "Transfer",
310 | "type": "event"
311 | },
312 | {
313 | "anonymous": false,
314 | "inputs": [
315 | {
316 | "indexed": true,
317 | "name": "_owner",
318 | "type": "address"
319 | },
320 | {
321 | "indexed": true,
322 | "name": "_spender",
323 | "type": "address"
324 | },
325 | {
326 | "indexed": false,
327 | "name": "_value",
328 | "type": "uint256"
329 | }
330 | ],
331 | "name": "Approval",
332 | "type": "event"
333 | }
334 | ]
--------------------------------------------------------------------------------
/src/contexts/modal.js:
--------------------------------------------------------------------------------
1 | import React, { createContext, useContext, useReducer, useState, useMemo, useCallback, useEffect } from "react";
2 | import { ethers } from "ethers";
3 | import { BANCOR_CONTRACTS, TOKEN_CONTRACTS } from "../constants";
4 | import { EtherTokenAbi } from "../contracts/bancor/EtherToken";
5 | import { getContract } from "./bancor";
6 |
7 | const ModalContext = createContext();
8 |
9 | const useModalContext = () => {
10 | return useContext(ModalContext)
11 | }
12 |
13 | const ACTIONS = {
14 | UPDATE_MESSAGE: "UPDATE_MESSAGE",
15 | SHOW_MODAL: "SHOW_MODAL",
16 | TICK: "TICK"
17 | }
18 |
19 | export const MODAL_TYPES = {
20 | PROCESSING: "PROCESSING",
21 | CONFIRM : "CONFIRM",
22 | WARNING: "WARNING",
23 | ERROR: "ERROR",
24 | NONE: "NONE",
25 | ETHERTOKEN : "ETHERTOKEN"
26 | }
27 |
28 | const reducer = (state, { type, payload }) => {
29 | switch (type) {
30 | case ACTIONS.UPDATE_MESSAGE: {
31 | const { type, title , message } = payload;
32 | return {
33 | ...state,
34 | message: message,
35 | title: title,
36 | type : type
37 | }
38 | }
39 |
40 | case ACTIONS.SHOW_MODAL: {
41 | const { status } = payload;
42 | let type = MODAL_TYPES.NONE;
43 | if (status !== false) {
44 | type = state.type;
45 | }
46 | return {
47 | ...state,
48 | showModal: status,
49 | type: type
50 | }
51 | }
52 | case ACTIONS.TICK : {
53 | const { newTick } = payload;
54 | return {
55 | ...state,
56 | tick : newTick
57 | }
58 | }
59 |
60 | default: {
61 | throw Error(`Unexpected action type in ModalContext reducer: '${type}'.`)
62 | }
63 |
64 | }
65 | }
66 |
67 | const provider = ({ children }) => {
68 |
69 | const [state, dispatch] = useReducer(reducer, {
70 | message: "",
71 | title: "",
72 | type : MODAL_TYPES.NONE,
73 | showModal: false,
74 | tick: 0
75 | })
76 |
77 | const updateMessage = useCallback((type, title, message) => {
78 | dispatch({ type: ACTIONS.UPDATE_MESSAGE, payload: { type, title, message } })
79 | }, [])
80 |
81 |
82 | const updateShowModal = useCallback((status) => {
83 | dispatch({ type: ACTIONS.SHOW_MODAL, payload: { status } })
84 | }, [])
85 |
86 | const updateTick = useCallback((newTick) => {
87 | dispatch({ type: ACTIONS.TICK, payload: { newTick } })
88 | }, []);
89 |
90 | return (
91 | [state, {
93 | updateMessage,
94 | updateShowModal,
95 | updateTick
96 | }], [
97 | state,
98 | updateMessage,
99 | updateShowModal,
100 | updateTick
101 | ])}
102 | >
103 | {children}
104 |
105 | )
106 | }
107 |
108 | export const useModal = () => {
109 |
110 | const [{ message, title, showModal, type, tick }, { updateMessage, updateShowModal, updateTick }] = useModalContext();
111 |
112 | const [ confirmation, setConfirmation ] = useState();
113 |
114 | const onClose = () => {
115 | updateShowModal(false);
116 | // setType(MODAL_TYPES.NONE);
117 | }
118 |
119 | const showProcessingModal = useCallback((title, message) => {
120 | updateShowModal(true);
121 | // setType(MODAL_TYPES.PROCESSING);
122 | updateMessage( MODAL_TYPES.PROCESSING ,title, message);
123 | return onClose;
124 | },[])
125 |
126 | const showErrorMessageModal = useCallback((title, message) => {
127 | updateShowModal(true);
128 | updateMessage( MODAL_TYPES.ERROR ,title, message);
129 | },[])
130 |
131 | const showConfirmModal = useCallback((title, message) => {
132 | updateShowModal(true);
133 | updateMessage( MODAL_TYPES.CONFIRM ,title, message);
134 | },[showModal])
135 |
136 | const showEtherTokenModal = useCallback((title, message) => {
137 | updateShowModal(true);
138 | updateMessage(MODAL_TYPES.ETHERTOKEN, title, message);
139 | }, []);
140 |
141 | const closeEtherTokenModal = useCallback(() => {
142 | onClose();
143 | updateTick(tick+1);
144 | }, [tick]);
145 |
146 | const closeErrorModal = useCallback(() => {
147 | onClose();
148 | },[]);
149 |
150 | const closeConfirmModal = useCallback((next) => {
151 | onClose();
152 | if (next) {
153 | updateTick(tick+1);
154 | }
155 | }, [confirmation])
156 |
157 | const getNativeETHBalance = useCallback(async (web3context) => {
158 | const signer = web3context.library.getSigner();
159 | const balance = await signer.provider.getBalance(web3context.account);
160 | return ethers.utils.formatEther(balance);
161 | },[])
162 |
163 | const getETHTokenBalance= useCallback(async (web3context) => {
164 | const signer = web3context.library.getSigner();
165 | const { networkId, account } = web3context;
166 |
167 | let contractAddress;
168 |
169 | if (networkId === 1 ) {
170 | contractAddress= TOKEN_CONTRACTS.MAINNET.BANCOR_ETHER;
171 | } else if (networkId === 3) {
172 | contractAddress= TOKEN_CONTRACTS.ROPSTEN.BANCOR_ETHER;
173 | } else {
174 | return 0;
175 | };
176 |
177 | if (!contractAddress) {
178 | return;
179 | }
180 |
181 | const tokenContract = getContract(contractAddress,EtherTokenAbi, signer );
182 | const balance = await tokenContract.balanceOf(account);
183 | return ethers.utils.formatEther(balance);
184 | },[]);
185 |
186 | const getTxOptions = useCallback(async (web3context) => {
187 | const signer = web3context.library.getSigner();
188 | const estimatedGasPrice = await signer.provider.getGasPrice()
189 | const minimumGasPrice = ethers.utils.parseEther("0.000000003"); // 3 Gwei
190 | const finalGasPrice = estimatedGasPrice.lt(minimumGasPrice) ? minimumGasPrice : estimatedGasPrice
191 | const estimatedGasLimit = (Number(ethers.utils.formatUnits(`${finalGasPrice}`, "gwei" ))*100000);
192 | let options = {
193 | gasLimit: Math.floor(estimatedGasLimit * 0.2),
194 | gasPrice: finalGasPrice, // Minimum 3 Gwei
195 | };
196 | return options;
197 | }, [])
198 |
199 | const depositETHToken = useCallback(async (web3context, depositAmount ) => {
200 | const signer = web3context.library.getSigner();
201 | let options = await getTxOptions(web3context);
202 | const { networkId, account } = web3context;
203 | let contractAddress;
204 |
205 | if (networkId === 1 ) {
206 | contractAddress= TOKEN_CONTRACTS.MAINNET.BANCOR_ETHER;
207 | } else if (networkId === 3) {
208 | contractAddress= TOKEN_CONTRACTS.ROPSTEN.BANCOR_ETHER;
209 | } else {
210 | throw new Error("Network is not supported.")
211 | };
212 | const tokenContract = getContract(contractAddress,EtherTokenAbi, signer );
213 |
214 | options = {
215 | ...options,
216 | value : ethers.utils.parseEther(`${depositAmount}`)
217 | }
218 | const tx = await tokenContract.deposit( options);
219 |
220 | return tx;
221 |
222 | }, []);
223 |
224 | const withdrawETHToken = useCallback(async (web3context, withdrawAmount ) => {
225 | const signer = web3context.library.getSigner();
226 | const options = await getTxOptions(web3context);
227 | const { networkId, account } = web3context;
228 | let contractAddress;
229 |
230 | if (networkId === 1 ) {
231 | contractAddress= TOKEN_CONTRACTS.MAINNET.BANCOR_ETHER;
232 | } else if (networkId === 3) {
233 | contractAddress= TOKEN_CONTRACTS.ROPSTEN.BANCOR_ETHER;
234 | } else {
235 | throw new Error("Network is not supported.")
236 | };
237 | const tokenContract = getContract(contractAddress,EtherTokenAbi, signer );
238 | const tx = await tokenContract.withdraw(ethers.utils.parseEther(`${withdrawAmount}`), options);
239 | return tx;
240 | }, []);
241 |
242 | return {
243 | showModal,
244 | message,
245 | title,
246 | type,
247 | tick,
248 | showProcessingModal,
249 | showEtherTokenModal,
250 | showErrorMessageModal,
251 | closeEtherTokenModal,
252 | getNativeETHBalance,
253 | getETHTokenBalance,
254 | depositETHToken,
255 | closeErrorModal,
256 | withdrawETHToken,
257 | showConfirmModal,
258 | closeConfirmModal
259 | }
260 |
261 |
262 | }
263 |
264 | export default provider;
265 |
266 |
267 |
--------------------------------------------------------------------------------
/src/contracts/bancor/ContractRegistry.js:
--------------------------------------------------------------------------------
1 | export const ContractRegistryAbi = [
2 | {
3 | "constant": true,
4 | "inputs": [
5 |
6 | ],
7 | "name": "BANCOR_CONVERTER_UPGRADER",
8 | "outputs": [
9 | {
10 | "name": "",
11 | "type": "bytes32"
12 | }
13 | ],
14 | "payable": false,
15 | "stateMutability": "view",
16 | "type": "function"
17 | },
18 | {
19 | "constant": true,
20 | "inputs": [
21 |
22 | ],
23 | "name": "BNT_TOKEN",
24 | "outputs": [
25 | {
26 | "name": "",
27 | "type": "bytes32"
28 | }
29 | ],
30 | "payable": false,
31 | "stateMutability": "view",
32 | "type": "function"
33 | },
34 | {
35 | "constant": true,
36 | "inputs": [
37 | {
38 | "name": "_contractName",
39 | "type": "bytes32"
40 | }
41 | ],
42 | "name": "getAddress",
43 | "outputs": [
44 | {
45 | "name": "",
46 | "type": "address"
47 | }
48 | ],
49 | "payable": false,
50 | "stateMutability": "view",
51 | "type": "function"
52 | },
53 | {
54 | "constant": true,
55 | "inputs": [
56 |
57 | ],
58 | "name": "CONTRACT_REGISTRY",
59 | "outputs": [
60 | {
61 | "name": "",
62 | "type": "bytes32"
63 | }
64 | ],
65 | "payable": false,
66 | "stateMutability": "view",
67 | "type": "function"
68 | },
69 | {
70 | "constant": false,
71 | "inputs": [
72 | {
73 | "name": "_contractName",
74 | "type": "bytes32"
75 | }
76 | ],
77 | "name": "unregisterAddress",
78 | "outputs": [
79 |
80 | ],
81 | "payable": false,
82 | "stateMutability": "nonpayable",
83 | "type": "function"
84 | },
85 | {
86 | "constant": true,
87 | "inputs": [
88 | {
89 | "name": "",
90 | "type": "uint256"
91 | }
92 | ],
93 | "name": "contractNames",
94 | "outputs": [
95 | {
96 | "name": "",
97 | "type": "string"
98 | }
99 | ],
100 | "payable": false,
101 | "stateMutability": "view",
102 | "type": "function"
103 | },
104 | {
105 | "constant": true,
106 | "inputs": [
107 |
108 | ],
109 | "name": "BANCOR_CONVERTER_FACTORY",
110 | "outputs": [
111 | {
112 | "name": "",
113 | "type": "bytes32"
114 | }
115 | ],
116 | "payable": false,
117 | "stateMutability": "view",
118 | "type": "function"
119 | },
120 | {
121 | "constant": true,
122 | "inputs": [
123 |
124 | ],
125 | "name": "BNT_CONVERTER",
126 | "outputs": [
127 | {
128 | "name": "",
129 | "type": "bytes32"
130 | }
131 | ],
132 | "payable": false,
133 | "stateMutability": "view",
134 | "type": "function"
135 | },
136 | {
137 | "constant": false,
138 | "inputs": [
139 | {
140 | "name": "_contractName",
141 | "type": "bytes32"
142 | },
143 | {
144 | "name": "_contractAddress",
145 | "type": "address"
146 | }
147 | ],
148 | "name": "registerAddress",
149 | "outputs": [
150 |
151 | ],
152 | "payable": false,
153 | "stateMutability": "nonpayable",
154 | "type": "function"
155 | },
156 | {
157 | "constant": true,
158 | "inputs": [
159 |
160 | ],
161 | "name": "itemCount",
162 | "outputs": [
163 | {
164 | "name": "",
165 | "type": "uint256"
166 | }
167 | ],
168 | "payable": false,
169 | "stateMutability": "view",
170 | "type": "function"
171 | },
172 | {
173 | "constant": true,
174 | "inputs": [
175 |
176 | ],
177 | "name": "BANCOR_FORMULA",
178 | "outputs": [
179 | {
180 | "name": "",
181 | "type": "bytes32"
182 | }
183 | ],
184 | "payable": false,
185 | "stateMutability": "view",
186 | "type": "function"
187 | },
188 | {
189 | "constant": false,
190 | "inputs": [
191 |
192 | ],
193 | "name": "acceptOwnership",
194 | "outputs": [
195 |
196 | ],
197 | "payable": false,
198 | "stateMutability": "nonpayable",
199 | "type": "function"
200 | },
201 | {
202 | "constant": true,
203 | "inputs": [
204 |
205 | ],
206 | "name": "CONTRACT_FEATURES",
207 | "outputs": [
208 | {
209 | "name": "",
210 | "type": "bytes32"
211 | }
212 | ],
213 | "payable": false,
214 | "stateMutability": "view",
215 | "type": "function"
216 | },
217 | {
218 | "constant": true,
219 | "inputs": [
220 |
221 | ],
222 | "name": "owner",
223 | "outputs": [
224 | {
225 | "name": "",
226 | "type": "address"
227 | }
228 | ],
229 | "payable": false,
230 | "stateMutability": "view",
231 | "type": "function"
232 | },
233 | {
234 | "constant": true,
235 | "inputs": [
236 |
237 | ],
238 | "name": "BANCOR_NETWORK",
239 | "outputs": [
240 | {
241 | "name": "",
242 | "type": "bytes32"
243 | }
244 | ],
245 | "payable": false,
246 | "stateMutability": "view",
247 | "type": "function"
248 | },
249 | {
250 | "constant": true,
251 | "inputs": [
252 |
253 | ],
254 | "name": "BANCOR_GAS_PRICE_LIMIT",
255 | "outputs": [
256 | {
257 | "name": "",
258 | "type": "bytes32"
259 | }
260 | ],
261 | "payable": false,
262 | "stateMutability": "view",
263 | "type": "function"
264 | },
265 | {
266 | "constant": true,
267 | "inputs": [
268 | {
269 | "name": "_contractName",
270 | "type": "bytes32"
271 | }
272 | ],
273 | "name": "addressOf",
274 | "outputs": [
275 | {
276 | "name": "",
277 | "type": "address"
278 | }
279 | ],
280 | "payable": false,
281 | "stateMutability": "view",
282 | "type": "function"
283 | },
284 | {
285 | "constant": true,
286 | "inputs": [
287 |
288 | ],
289 | "name": "BANCOR_X",
290 | "outputs": [
291 | {
292 | "name": "",
293 | "type": "bytes32"
294 | }
295 | ],
296 | "payable": false,
297 | "stateMutability": "view",
298 | "type": "function"
299 | },
300 | {
301 | "constant": true,
302 | "inputs": [
303 |
304 | ],
305 | "name": "BANCOR_X_UPGRADER",
306 | "outputs": [
307 | {
308 | "name": "",
309 | "type": "bytes32"
310 | }
311 | ],
312 | "payable": false,
313 | "stateMutability": "view",
314 | "type": "function"
315 | },
316 | {
317 | "constant": true,
318 | "inputs": [
319 |
320 | ],
321 | "name": "newOwner",
322 | "outputs": [
323 | {
324 | "name": "",
325 | "type": "address"
326 | }
327 | ],
328 | "payable": false,
329 | "stateMutability": "view",
330 | "type": "function"
331 | },
332 | {
333 | "constant": false,
334 | "inputs": [
335 | {
336 | "name": "_newOwner",
337 | "type": "address"
338 | }
339 | ],
340 | "name": "transferOwnership",
341 | "outputs": [
342 |
343 | ],
344 | "payable": false,
345 | "stateMutability": "nonpayable",
346 | "type": "function"
347 | },
348 | {
349 | "constant": true,
350 | "inputs": [
351 |
352 | ],
353 | "name": "NON_STANDARD_TOKEN_REGISTRY",
354 | "outputs": [
355 | {
356 | "name": "",
357 | "type": "bytes32"
358 | }
359 | ],
360 | "payable": false,
361 | "stateMutability": "view",
362 | "type": "function"
363 | },
364 | {
365 | "inputs": [
366 |
367 | ],
368 | "payable": false,
369 | "stateMutability": "nonpayable",
370 | "type": "constructor"
371 | },
372 | {
373 | "anonymous": false,
374 | "inputs": [
375 | {
376 | "indexed": true,
377 | "name": "_contractName",
378 | "type": "bytes32"
379 | },
380 | {
381 | "indexed": false,
382 | "name": "_contractAddress",
383 | "type": "address"
384 | }
385 | ],
386 | "name": "AddressUpdate",
387 | "type": "event"
388 | },
389 | {
390 | "anonymous": false,
391 | "inputs": [
392 | {
393 | "indexed": true,
394 | "name": "_prevOwner",
395 | "type": "address"
396 | },
397 | {
398 | "indexed": true,
399 | "name": "_newOwner",
400 | "type": "address"
401 | }
402 | ],
403 | "name": "OwnerUpdate",
404 | "type": "event"
405 | }
406 | ]
--------------------------------------------------------------------------------
/src/components/Widget/index.js:
--------------------------------------------------------------------------------
1 | import React, { Component, useCallback, Fragment, useState, useEffect } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import WidgetLayout from "./layout";
5 |
6 | import { PAGES, HEADLINES, COLORS } from "../../constants";
7 |
8 | import SwapPanel from "./components/panels/swap";
9 | import LiquidityPoolPanel, { ACTION_PANELS } from "./components/panels/liquidityPool";
10 |
11 | import Modal from "./components/modals";
12 |
13 | import styled from "styled-components"
14 | import ContainerDimensions from 'react-container-dimensions'
15 | import { useBancor } from "../../contexts/bancor";
16 | import { useModal } from "../../contexts/modal";
17 |
18 |
19 | const Widget = (props) => {
20 |
21 | const {
22 | web3ReactContext,
23 | currentPage,
24 | title,
25 | subtitle,
26 | description,
27 | color,
28 | baseCurrency,
29 | pairCurrency,
30 | affiliateAccount,
31 | affiliateFee,
32 | whitelisted,
33 | defaultPool,
34 | disablePoolCreation
35 | } = props;
36 |
37 | const { showModal, showErrorMessageModal } = useModal();
38 |
39 | const widgetTitle = title || HEADLINES.HEADER[currentPage];
40 | const widgetSubtitle = subtitle || HEADLINES.TEXT[currentPage];
41 | const widgetDescription = description || HEADLINES.DISCLAIMER[currentPage];
42 | const widgetColor = color || COLORS.default;
43 |
44 | const [errorMessage, setErrorMessage] = useState();
45 |
46 | const { loading, loadingErrorMessage } = useBancor(web3ReactContext);
47 |
48 | const [clickCount, setClickCount] = useState(0);
49 | const [disclaimer, setDisclaimer] = useState(widgetDescription);
50 | const [actionText, setActionText] = useState("");
51 |
52 | const [networkId, setNetworkId] = useState();
53 |
54 | useEffect(() => {
55 | if (loadingErrorMessage) {
56 | setErrorMessage(loadingErrorMessage);
57 | }
58 | }, [loadingErrorMessage])
59 |
60 | useEffect(() => {
61 |
62 | if (loading) {
63 | setErrorMessage();
64 | // setDisclaimer(HEADLINES.DISCLAIMER[currentPage]);
65 | return;
66 | }
67 |
68 | if (!web3ReactContext.active) {
69 |
70 | if (!web3ReactContext.error) {
71 | setErrorMessage();
72 | // setDisclaimer("Connecting to MetaMask...");
73 | } else {
74 | setErrorMessage(`${web3ReactContext.error.message}` || "Error : An unknown error occurred.");
75 | }
76 | } else {
77 | setErrorMessage();
78 | // setDisclaimer(HEADLINES.DISCLAIMER[currentPage]);
79 | }
80 |
81 | }, [web3ReactContext.error, web3ReactContext.active, loading])
82 |
83 | const updateActionText = (text) => {
84 | setActionText(text);
85 | }
86 |
87 | const handleClick = useCallback((e) => {
88 | e.preventDefault();
89 | setClickCount(clickCount + 1)
90 |
91 | }, [clickCount])
92 |
93 | const disabled = errorMessage || !web3ReactContext.active || loading;
94 |
95 | useEffect(() => {
96 |
97 |
98 | if ((networkId !== undefined) && (web3ReactContext.networkId !== undefined)) {
99 | if (networkId !== web3ReactContext.networkId) {
100 | // TODO : Only Reload the widget
101 | try {
102 | console.log("refresh page...")
103 | window.location.reload();
104 | } catch (error) {
105 |
106 | }
107 | }
108 | }
109 |
110 | if (web3ReactContext.networkId) {
111 | if ([ 1, 3].indexOf(web3ReactContext.networkId) === -1 ) {
112 | showErrorMessageModal("Unsupported Network","Please switch to Mainnet or Ropsten network");
113 | return;
114 | }
115 | setNetworkId(web3ReactContext.networkId);
116 | };
117 |
118 | }, [web3ReactContext.networkId, networkId]);
119 |
120 | const WRAP_WIDTH = currentPage === PAGES.SWAP ? 600 : 800;
121 |
122 | const isHide = ([ 1, 3].indexOf(web3ReactContext.networkId) === -1 );
123 |
124 | return (
125 |
126 | {({ width, height }) =>
127 |
128 |
131 | {((width > WRAP_WIDTH) || (currentPage === PAGES.SWAP)) &&
132 |
144 | }
145 |
146 | WRAP_WIDTH}
149 | height={height}
150 | >
151 | {!isHide && currentPage === PAGES.SWAP &&
152 | (
153 |
164 | )}
165 |
166 | {!isHide && currentPage === PAGES.POOLS &&
167 | (
168 |
179 | )}
180 |
181 |
182 |
183 |
201 |
202 | {showModal && (
203 |
209 | )}
210 |
211 | }
212 |
213 | )
214 | }
215 |
216 |
217 | const ActionButton = styled.button`
218 | background-color: ${props => props.color && `${props.color}`};
219 | border: none;
220 | color: white;
221 | padding: 15px 32px;
222 | text-align: center;
223 | text-decoration: none;
224 | display: inline-block;
225 | font-size: 16px;
226 | ${props => props.disabled && 'opacity: 0.6;'}
227 | `;
228 |
229 | const StatusPanel = styled.div`
230 | font-size: 10px;
231 | text-align: center;
232 | padding-top: 10px;
233 |
234 | ${ props => (props.isMobile) && `
235 | font-size: 12px;
236 | `}
237 | `;
238 |
239 | const ErrorMessage = styled.span`
240 | color: red;
241 | font-weight: 600;
242 |
243 | `;
244 |
245 | const Container = styled.div`
246 | background: #fff;
247 | border-radius: 5px;
248 | padding: 20px;
249 | color: rgba(0, 0, 0, 0.7);
250 | height: 100%;
251 | overflow: hidden;
252 |
253 | ${props => props.inactive && `
254 | opacity: 0.6;
255 | `}
256 |
257 | `;
258 |
259 | const Header = styled.div`
260 | text-align: center;
261 |
262 | h3 {
263 | font-size: 16px;
264 | font-weight: 600;
265 | }
266 |
267 | p {
268 | font-size: 12px;
269 | }
270 |
271 | ${ props => props.width > 600 && `
272 | h3 {
273 | font-size: 24px;
274 | }
275 |
276 | p {
277 | font-size: 14px;
278 | }
279 | `}
280 |
281 | `;
282 |
283 | const Footer = styled.div`
284 | text-align: center;
285 | padding: 20px;
286 | `;
287 |
288 | const Body = styled.div`
289 |
290 | display: grid;
291 | grid-gap: 1rem;
292 |
293 | ${ props => (props.isMobile) && `
294 | grid-template-columns: repeat(2, 1fr);
295 | `}
296 |
297 | `
298 |
299 |
300 | Widget.propTypes = {
301 | web3ReactContext: PropTypes.object.isRequired,
302 | currentPage: PropTypes.string
303 | };
304 |
305 | export default Widget;
--------------------------------------------------------------------------------
/src/utils/token.js:
--------------------------------------------------------------------------------
1 | import bancorLogo from "../../assets/tokens/bnt.png";
2 | import ethLogo from "../../assets/tokens/eth.png";
3 | import batLogo from "../../assets/tokens/bat.png";
4 | import enjLogo from "../../assets/tokens/enj.png";
5 | import kncLogo from "../../assets/tokens/knc.png";
6 | import omgLogo from "../../assets/tokens/omg.png";
7 | import daiLogo from "../../assets/tokens/dai.png";
8 | import manaLogo from "../../assets/tokens/mana.png";
9 | import powrLogo from "../../assets/tokens/powr.png";
10 | import mkrLogo from "../../assets/tokens/mkr.png";
11 | import antLogo from "../../assets/tokens/ant.png";
12 | import gnoLogo from "../../assets/tokens/gno.png";
13 | import dgdLogo from "../../assets/tokens/dgd.png";
14 | import sntLogo from "../../assets/tokens/snt.png";
15 | import rdnLogo from "../../assets/tokens/rdn.png";
16 | import sanLogo from "../../assets/tokens/san.png";
17 | import usdLogo from "../../assets/tokens/usd.png";
18 | import drgnLogo from "../../assets/tokens/drgn.png";
19 | import busdLogo from "../../assets/tokens/busd.png";
20 | import edgLogo from "../../assets/tokens/edg.png";
21 | import elfLogo from "../../assets/tokens/elf.png";
22 | import gtoLogo from "../../assets/tokens/gto.png";
23 | import reqLogo from "../../assets/tokens/req.png";
24 | import rlcLogo from "../../assets/tokens/rlc.png";
25 | import srnLogo from "../../assets/tokens/srn.png";
26 | import stormLogo from "../../assets/tokens/storm.png";
27 | import taasLogo from "../../assets/tokens/taas.png";
28 | import usdcLogo from "../../assets/tokens/usdc.png";
29 | import tknLogo from "../../assets/tokens/tkn.png";
30 | import aionLogo from "../../assets/tokens/aion.png";
31 | import npxsLogo from "../../assets/tokens/npxs.png";
32 | import plrLogo from "../../assets/tokens/plr.png";
33 | import rcnLogo from "../../assets/tokens/rcn.png"
34 | import kinLogo from "../../assets/tokens/kin.png";
35 | import vibLogo from "../../assets/tokens/vib.png";
36 | import dataLogo from "../../assets/tokens/data.png";
37 | import waxLogo from "../../assets/tokens/wax.png";
38 | import mtlLogo from "../../assets/tokens/mtl.png";
39 | import mftLogo from "../../assets/tokens/mft.png";
40 | import btcLogo from "../../assets/tokens/btc.png";
41 | import usdtLogo from "../../assets/tokens/usdt.png";
42 | import zrxLogo from "../../assets/tokens/zrx.png";
43 | import repLogo from "../../assets/tokens/rep.png";
44 | import tusdLogo from "../../assets/tokens/tusd.png";
45 | import chainlinkLogo from "../../assets/tokens/chainlink.png";
46 | import nexoLogo from "../../assets/tokens/nexo.png";
47 | import renLogo from "../../assets/tokens/ren.png";
48 | import loomLogo from "../../assets/tokens/loom.png";
49 | import snxLogo from "../../assets/tokens/snx.png";
50 | import indLogo from "../../assets/tokens/ind.png";
51 | import aidLogo from "../../assets/tokens/aid.png";
52 | import catLogo from "../../assets/tokens/cat.png";
53 | import veeLogo from "../../assets/tokens/vee.png";
54 | import wingsLogo from "../../assets/tokens/wings.png";
55 | import amnLogo from "../../assets/tokens/amn.png";
56 | import instarLogo from "../../assets/tokens/instar.png";
57 | import mdtLogo from "../../assets/tokens/mdt.png";
58 | import mfgLogo from "../../assets/tokens/mfg.png";
59 | import baxLogo from "../../assets/tokens/bax.png";
60 | import xdceLogo from "../../assets/tokens/xdce.png";
61 | import boxxLogo from "../../assets/tokens/boxx.png";
62 | import ceekLogo from "../../assets/tokens/ceek.png";
63 | import mybLogo from "../../assets/tokens/myb.png";
64 | import rblxLogo from "../../assets/tokens/rblx.png";
65 | import ziptLogo from "../../assets/tokens/zipt.png";
66 | import locLogo from "../../assets/tokens/loc.png";
67 | import fxcLogo from "../../assets/tokens/fxc.png";
68 | import qdaoLogo from "../../assets/tokens/qdao.png";
69 | import c20Logo from "../../assets/tokens/c20.png";
70 | import nmrLogo from "../../assets/tokens/nmr.png";
71 | import metLogo from "../../assets/tokens/met.png";
72 | import mlnLogo from "../../assets/tokens/mln.png";
73 | import keyLogo from "../../assets/tokens/key.png";
74 |
75 |
76 | export const getIcon = (symbol) => {
77 | switch (symbol) {
78 | case 'ETH':
79 | return ethLogo;
80 | case 'DAI':
81 | return daiLogo;
82 | case 'BNT':
83 | return bancorLogo;
84 | case 'BAT':
85 | return batLogo;
86 | case 'ENJ':
87 | return enjLogo;
88 | case 'KNC':
89 | return kncLogo;
90 | case 'OMG':
91 | return omgLogo;
92 | case 'MANA':
93 | return manaLogo;
94 | case 'POWR':
95 | return powrLogo;
96 | case 'MKR':
97 | return mkrLogo;
98 | case 'ANT':
99 | return antLogo;
100 | case 'GNO':
101 | return gnoLogo;
102 | case 'DGD':
103 | return dgdLogo;
104 | case 'DGD':
105 | return dgdLogo;
106 | case 'SNT':
107 | return sntLogo;
108 | case 'RDN':
109 | return rdnLogo;
110 | case 'SDN':
111 | return sdnLogo;
112 | case 'SAN':
113 | return sanLogo;
114 | case 'USDB':
115 | return bancorLogo;
116 | case 'BUSD':
117 | return busdLogo;
118 | case 'DRGN':
119 | return drgnLogo;
120 | case 'EDG':
121 | return edgLogo;
122 | case 'ELF':
123 | return elfLogo;
124 | case 'GTO':
125 | return gtoLogo;
126 | case 'REQ':
127 | return reqLogo;
128 | case 'RLC':
129 | return rlcLogo;
130 | case 'SRN':
131 | return srnLogo;
132 | case 'STORM':
133 | return stormLogo;
134 | case 'TAAS':
135 | return taasLogo;
136 | case 'USDC':
137 | return usdcLogo;
138 | case 'TKN':
139 | return tknLogo;
140 | case 'AION':
141 | return aionLogo;
142 | case 'NPXS':
143 | return npxsLogo;
144 | case 'PLR':
145 | return plrLogo;
146 | case 'RCN':
147 | return rcnLogo;
148 | case 'KIN':
149 | return kinLogo;
150 | case 'VIB':
151 | return vibLogo;
152 | case 'DATA':
153 | return dataLogo;
154 | case 'WAX':
155 | return waxLogo;
156 | case 'MTL':
157 | return mtlLogo;
158 | case 'MFT':
159 | return mftLogo;
160 | case 'WBTC':
161 | return btcLogo;
162 | case 'USDT':
163 | return usdtLogo;
164 | case 'ZRX':
165 | return zrxLogo;
166 | case 'REP':
167 | return repLogo;
168 | case 'TUSD':
169 | return tusdLogo;
170 | case 'LINK':
171 | return chainlinkLogo;
172 | case 'NEXO':
173 | return nexoLogo;
174 | case 'REN':
175 | return renLogo;
176 | case 'LOOM':
177 | return loomLogo;
178 | case 'SNX':
179 | return snxLogo;
180 | case 'IND':
181 | return indLogo;
182 | case 'AID':
183 | return aidLogo;
184 | case 'CAT':
185 | return catLogo;
186 | case 'VEE':
187 | return veeLogo;
188 | case 'WINGS':
189 | return wingsLogo;
190 | case 'AMN':
191 | return amnLogo;
192 | case 'INSTAR':
193 | return instarLogo;
194 | case 'MDT':
195 | return mdtLogo;
196 | case 'MFG':
197 | return mfgLogo;
198 | case 'BAX':
199 | return baxLogo;
200 | case 'XDCE':
201 | return xdceLogo;
202 | case 'BOXX':
203 | return boxxLogo;
204 | case 'CEEK':
205 | return ceekLogo;
206 | case 'MYB':
207 | return mybLogo;
208 | case 'RBLX':
209 | return rblxLogo;
210 | case 'ZIPT':
211 | return ziptLogo;
212 | case 'LOC':
213 | return locLogo;
214 | case 'FXC':
215 | return fxcLogo;
216 | case 'QDAO':
217 | return qdaoLogo;
218 | case 'USDQ':
219 | return qdaoLogo;
220 | case 'C20':
221 | return c20Logo;
222 | case 'NMR':
223 | return nmrLogo;
224 | case 'MET':
225 | return metLogo;
226 | case 'MLN':
227 | return mlnLogo;
228 | case 'KEY':
229 | return keyLogo;
230 | default:
231 | return ethLogo;
232 | }
233 | }
234 |
235 | export const getDefaultTokenAddress = (symbol) => {
236 | switch (symbol) {
237 | case 'BNT':
238 | return "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C";
239 | case 'ETH':
240 | return "0xc0829421C1d260BD3cB3E0F06cfE2D52db2cE315";
241 | case 'DAI':
242 | return "0x6B175474E89094C44Da98b954EedeAC495271d0F";
243 | case 'ENJ':
244 | return "0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c";
245 | case 'BAT':
246 | return "0x0D8775F648430679A709E98d2b0Cb6250d2887EF";
247 | case 'KNC':
248 | return "0xdd974D5C2e2928deA5F71b9825b8b646686BD200";
249 | case 'MANA':
250 | return "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942";
251 | case 'POWR':
252 | return "0x595832F8FC6BF59c85C527fEC3740A1b7a361269";
253 | case 'MKR':
254 | return "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2";
255 | case 'ANT':
256 | return "0x960b236A07cf122663c4303350609A66A7B288C0";
257 | case 'GNO':
258 | return "0x6810e776880C02933D47DB1b9fc05908e5386b96";
259 | case 'OMG':
260 | return "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07";
261 | case 'SNT':
262 | return "0x744d70FDBE2Ba4CF95131626614a1763DF805B9E";
263 | case 'RDN':
264 | return "0x255Aa6DF07540Cb5d3d297f0D0D4D84cb52bc8e6";
265 | case 'SAN':
266 | return "0x7C5A0CE9267ED19B22F8cae653F198e3E8daf098";
267 | case 'USDB':
268 | return "0x309627af60F0926daa6041B8279484312f2bf060";
269 | case 'USDC':
270 | return "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
271 | default:
272 | return "";
273 | }
274 | }
275 |
276 |
277 | export const getRopstenTokenAddress = (symbol) => {
278 | switch (symbol) {
279 | case 'BNT':
280 | return "0x62bd9D98d4E188e281D7B78e29334969bbE1053c";
281 | case 'ETH':
282 | return "0xD368b98d03855835E2923Dc000b3f9c2EBF1b27b";
283 | case 'XXX':
284 | return "0x8aD24A87B819343679BB2611C093b0F598f7fb3e";
285 | case 'YYY':
286 | return "0x8beB0728c77bd9258aAC36f8b2d94085f48Aa686";
287 | default:
288 | return "";
289 | }
290 | }
291 |
--------------------------------------------------------------------------------
/src/contracts/bancor/BancorConverterRegistryData.js:
--------------------------------------------------------------------------------
1 | export const BancorConverterRegistryDataAbi = [
2 | {
3 | "constant": false,
4 | "inputs": [
5 | {
6 | "name": "_adminOnly",
7 | "type": "bool"
8 | }
9 | ],
10 | "name": "restrictRegistryUpdate",
11 | "outputs": [
12 |
13 | ],
14 | "payable": false,
15 | "stateMutability": "nonpayable",
16 | "type": "function"
17 | },
18 | {
19 | "constant": true,
20 | "inputs": [
21 |
22 | ],
23 | "name": "getSmartTokens",
24 | "outputs": [
25 | {
26 | "name": "",
27 | "type": "address[]"
28 | }
29 | ],
30 | "payable": false,
31 | "stateMutability": "view",
32 | "type": "function"
33 | },
34 | {
35 | "constant": false,
36 | "inputs": [
37 | {
38 | "name": "_convertibleToken",
39 | "type": "address"
40 | },
41 | {
42 | "name": "_smartToken",
43 | "type": "address"
44 | }
45 | ],
46 | "name": "addConvertibleToken",
47 | "outputs": [
48 |
49 | ],
50 | "payable": false,
51 | "stateMutability": "nonpayable",
52 | "type": "function"
53 | },
54 | {
55 | "constant": true,
56 | "inputs": [
57 | {
58 | "name": "_value",
59 | "type": "address"
60 | }
61 | ],
62 | "name": "isConvertibleToken",
63 | "outputs": [
64 | {
65 | "name": "",
66 | "type": "bool"
67 | }
68 | ],
69 | "payable": false,
70 | "stateMutability": "view",
71 | "type": "function"
72 | },
73 | {
74 | "constant": true,
75 | "inputs": [
76 | {
77 | "name": "_value",
78 | "type": "address"
79 | }
80 | ],
81 | "name": "isSmartToken",
82 | "outputs": [
83 | {
84 | "name": "",
85 | "type": "bool"
86 | }
87 | ],
88 | "payable": false,
89 | "stateMutability": "view",
90 | "type": "function"
91 | },
92 | {
93 | "constant": false,
94 | "inputs": [
95 |
96 | ],
97 | "name": "updateRegistry",
98 | "outputs": [
99 |
100 | ],
101 | "payable": false,
102 | "stateMutability": "nonpayable",
103 | "type": "function"
104 | },
105 | {
106 | "constant": true,
107 | "inputs": [
108 |
109 | ],
110 | "name": "getConvertibleTokens",
111 | "outputs": [
112 | {
113 | "name": "",
114 | "type": "address[]"
115 | }
116 | ],
117 | "payable": false,
118 | "stateMutability": "view",
119 | "type": "function"
120 | },
121 | {
122 | "constant": true,
123 | "inputs": [
124 |
125 | ],
126 | "name": "prevRegistry",
127 | "outputs": [
128 | {
129 | "name": "",
130 | "type": "address"
131 | }
132 | ],
133 | "payable": false,
134 | "stateMutability": "view",
135 | "type": "function"
136 | },
137 | {
138 | "constant": true,
139 | "inputs": [
140 |
141 | ],
142 | "name": "getConvertibleTokenCount",
143 | "outputs": [
144 | {
145 | "name": "",
146 | "type": "uint256"
147 | }
148 | ],
149 | "payable": false,
150 | "stateMutability": "view",
151 | "type": "function"
152 | },
153 | {
154 | "constant": true,
155 | "inputs": [
156 | {
157 | "name": "_convertibleToken",
158 | "type": "address"
159 | },
160 | {
161 | "name": "_value",
162 | "type": "address"
163 | }
164 | ],
165 | "name": "isConvertibleTokenSmartToken",
166 | "outputs": [
167 | {
168 | "name": "",
169 | "type": "bool"
170 | }
171 | ],
172 | "payable": false,
173 | "stateMutability": "view",
174 | "type": "function"
175 | },
176 | {
177 | "constant": false,
178 | "inputs": [
179 |
180 | ],
181 | "name": "acceptOwnership",
182 | "outputs": [
183 |
184 | ],
185 | "payable": false,
186 | "stateMutability": "nonpayable",
187 | "type": "function"
188 | },
189 | {
190 | "constant": true,
191 | "inputs": [
192 |
193 | ],
194 | "name": "getLiquidityPoolCount",
195 | "outputs": [
196 | {
197 | "name": "",
198 | "type": "uint256"
199 | }
200 | ],
201 | "payable": false,
202 | "stateMutability": "view",
203 | "type": "function"
204 | },
205 | {
206 | "constant": true,
207 | "inputs": [
208 |
209 | ],
210 | "name": "registry",
211 | "outputs": [
212 | {
213 | "name": "",
214 | "type": "address"
215 | }
216 | ],
217 | "payable": false,
218 | "stateMutability": "view",
219 | "type": "function"
220 | },
221 | {
222 | "constant": true,
223 | "inputs": [
224 |
225 | ],
226 | "name": "getLiquidityPools",
227 | "outputs": [
228 | {
229 | "name": "",
230 | "type": "address[]"
231 | }
232 | ],
233 | "payable": false,
234 | "stateMutability": "view",
235 | "type": "function"
236 | },
237 | {
238 | "constant": true,
239 | "inputs": [
240 | {
241 | "name": "_index",
242 | "type": "uint256"
243 | }
244 | ],
245 | "name": "getConvertibleToken",
246 | "outputs": [
247 | {
248 | "name": "",
249 | "type": "address"
250 | }
251 | ],
252 | "payable": false,
253 | "stateMutability": "view",
254 | "type": "function"
255 | },
256 | {
257 | "constant": true,
258 | "inputs": [
259 |
260 | ],
261 | "name": "owner",
262 | "outputs": [
263 | {
264 | "name": "",
265 | "type": "address"
266 | }
267 | ],
268 | "payable": false,
269 | "stateMutability": "view",
270 | "type": "function"
271 | },
272 | {
273 | "constant": false,
274 | "inputs": [
275 | {
276 | "name": "_smartToken",
277 | "type": "address"
278 | }
279 | ],
280 | "name": "addSmartToken",
281 | "outputs": [
282 |
283 | ],
284 | "payable": false,
285 | "stateMutability": "nonpayable",
286 | "type": "function"
287 | },
288 | {
289 | "constant": true,
290 | "inputs": [
291 | {
292 | "name": "_index",
293 | "type": "uint256"
294 | }
295 | ],
296 | "name": "getSmartToken",
297 | "outputs": [
298 | {
299 | "name": "",
300 | "type": "address"
301 | }
302 | ],
303 | "payable": false,
304 | "stateMutability": "view",
305 | "type": "function"
306 | },
307 | {
308 | "constant": true,
309 | "inputs": [
310 | {
311 | "name": "_convertibleToken",
312 | "type": "address"
313 | }
314 | ],
315 | "name": "getConvertibleTokenSmartTokenCount",
316 | "outputs": [
317 | {
318 | "name": "",
319 | "type": "uint256"
320 | }
321 | ],
322 | "payable": false,
323 | "stateMutability": "view",
324 | "type": "function"
325 | },
326 | {
327 | "constant": true,
328 | "inputs": [
329 | {
330 | "name": "_index",
331 | "type": "uint256"
332 | }
333 | ],
334 | "name": "getLiquidityPool",
335 | "outputs": [
336 | {
337 | "name": "",
338 | "type": "address"
339 | }
340 | ],
341 | "payable": false,
342 | "stateMutability": "view",
343 | "type": "function"
344 | },
345 | {
346 | "constant": false,
347 | "inputs": [
348 | {
349 | "name": "_liquidityPool",
350 | "type": "address"
351 | }
352 | ],
353 | "name": "removeLiquidityPool",
354 | "outputs": [
355 |
356 | ],
357 | "payable": false,
358 | "stateMutability": "nonpayable",
359 | "type": "function"
360 | },
361 | {
362 | "constant": false,
363 | "inputs": [
364 |
365 | ],
366 | "name": "restoreRegistry",
367 | "outputs": [
368 |
369 | ],
370 | "payable": false,
371 | "stateMutability": "nonpayable",
372 | "type": "function"
373 | },
374 | {
375 | "constant": true,
376 | "inputs": [
377 |
378 | ],
379 | "name": "adminOnly",
380 | "outputs": [
381 | {
382 | "name": "",
383 | "type": "bool"
384 | }
385 | ],
386 | "payable": false,
387 | "stateMutability": "view",
388 | "type": "function"
389 | },
390 | {
391 | "constant": false,
392 | "inputs": [
393 | {
394 | "name": "_smartToken",
395 | "type": "address"
396 | }
397 | ],
398 | "name": "removeSmartToken",
399 | "outputs": [
400 |
401 | ],
402 | "payable": false,
403 | "stateMutability": "nonpayable",
404 | "type": "function"
405 | },
406 | {
407 | "constant": true,
408 | "inputs": [
409 |
410 | ],
411 | "name": "newOwner",
412 | "outputs": [
413 | {
414 | "name": "",
415 | "type": "address"
416 | }
417 | ],
418 | "payable": false,
419 | "stateMutability": "view",
420 | "type": "function"
421 | },
422 | {
423 | "constant": true,
424 | "inputs": [
425 | {
426 | "name": "_convertibleToken",
427 | "type": "address"
428 | },
429 | {
430 | "name": "_index",
431 | "type": "uint256"
432 | }
433 | ],
434 | "name": "getConvertibleTokenSmartToken",
435 | "outputs": [
436 | {
437 | "name": "",
438 | "type": "address"
439 | }
440 | ],
441 | "payable": false,
442 | "stateMutability": "view",
443 | "type": "function"
444 | },
445 | {
446 | "constant": true,
447 | "inputs": [
448 |
449 | ],
450 | "name": "getSmartTokenCount",
451 | "outputs": [
452 | {
453 | "name": "",
454 | "type": "uint256"
455 | }
456 | ],
457 | "payable": false,
458 | "stateMutability": "view",
459 | "type": "function"
460 | },
461 | {
462 | "constant": true,
463 | "inputs": [
464 | {
465 | "name": "_value",
466 | "type": "address"
467 | }
468 | ],
469 | "name": "isLiquidityPool",
470 | "outputs": [
471 | {
472 | "name": "",
473 | "type": "bool"
474 | }
475 | ],
476 | "payable": false,
477 | "stateMutability": "view",
478 | "type": "function"
479 | },
480 | {
481 | "constant": false,
482 | "inputs": [
483 | {
484 | "name": "_liquidityPool",
485 | "type": "address"
486 | }
487 | ],
488 | "name": "addLiquidityPool",
489 | "outputs": [
490 |
491 | ],
492 | "payable": false,
493 | "stateMutability": "nonpayable",
494 | "type": "function"
495 | },
496 | {
497 | "constant": false,
498 | "inputs": [
499 | {
500 | "name": "_newOwner",
501 | "type": "address"
502 | }
503 | ],
504 | "name": "transferOwnership",
505 | "outputs": [
506 |
507 | ],
508 | "payable": false,
509 | "stateMutability": "nonpayable",
510 | "type": "function"
511 | },
512 | {
513 | "constant": true,
514 | "inputs": [
515 | {
516 | "name": "_convertibleToken",
517 | "type": "address"
518 | }
519 | ],
520 | "name": "getConvertibleTokenSmartTokens",
521 | "outputs": [
522 | {
523 | "name": "",
524 | "type": "address[]"
525 | }
526 | ],
527 | "payable": false,
528 | "stateMutability": "view",
529 | "type": "function"
530 | },
531 | {
532 | "constant": false,
533 | "inputs": [
534 | {
535 | "name": "_convertibleToken",
536 | "type": "address"
537 | },
538 | {
539 | "name": "_smartToken",
540 | "type": "address"
541 | }
542 | ],
543 | "name": "removeConvertibleToken",
544 | "outputs": [
545 |
546 | ],
547 | "payable": false,
548 | "stateMutability": "nonpayable",
549 | "type": "function"
550 | },
551 | {
552 | "inputs": [
553 | {
554 | "name": "_registry",
555 | "type": "address"
556 | }
557 | ],
558 | "payable": false,
559 | "stateMutability": "nonpayable",
560 | "type": "constructor"
561 | },
562 | {
563 | "anonymous": false,
564 | "inputs": [
565 | {
566 | "indexed": true,
567 | "name": "_prevOwner",
568 | "type": "address"
569 | },
570 | {
571 | "indexed": true,
572 | "name": "_newOwner",
573 | "type": "address"
574 | }
575 | ],
576 | "name": "OwnerUpdate",
577 | "type": "event"
578 | }
579 | ]
--------------------------------------------------------------------------------
/src/contracts/bancor/BancorConverterRegistry.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | export const BancorConverterRegistryAbi = [
4 | {
5 | "constant": false,
6 | "inputs": [
7 | {
8 | "name": "_adminOnly",
9 | "type": "bool"
10 | }
11 | ],
12 | "name": "restrictRegistryUpdate",
13 | "outputs": [
14 |
15 | ],
16 | "payable": false,
17 | "stateMutability": "nonpayable",
18 | "type": "function"
19 | },
20 | {
21 | "constant": true,
22 | "inputs": [
23 |
24 | ],
25 | "name": "getSmartTokens",
26 | "outputs": [
27 | {
28 | "name": "",
29 | "type": "address[]"
30 | }
31 | ],
32 | "payable": false,
33 | "stateMutability": "view",
34 | "type": "function"
35 | },
36 | {
37 | "constant": true,
38 | "inputs": [
39 | {
40 | "name": "_smartTokens",
41 | "type": "address[]"
42 | }
43 | ],
44 | "name": "getConvertersBySmartTokens",
45 | "outputs": [
46 | {
47 | "name": "",
48 | "type": "address[]"
49 | }
50 | ],
51 | "payable": false,
52 | "stateMutability": "view",
53 | "type": "function"
54 | },
55 | {
56 | "constant": true,
57 | "inputs": [
58 | {
59 | "name": "_value",
60 | "type": "address"
61 | }
62 | ],
63 | "name": "isConvertibleToken",
64 | "outputs": [
65 | {
66 | "name": "",
67 | "type": "bool"
68 | }
69 | ],
70 | "payable": false,
71 | "stateMutability": "view",
72 | "type": "function"
73 | },
74 | {
75 | "constant": true,
76 | "inputs": [
77 | {
78 | "name": "_value",
79 | "type": "address"
80 | }
81 | ],
82 | "name": "isSmartToken",
83 | "outputs": [
84 | {
85 | "name": "",
86 | "type": "bool"
87 | }
88 | ],
89 | "payable": false,
90 | "stateMutability": "view",
91 | "type": "function"
92 | },
93 | {
94 | "constant": false,
95 | "inputs": [
96 |
97 | ],
98 | "name": "updateRegistry",
99 | "outputs": [
100 |
101 | ],
102 | "payable": false,
103 | "stateMutability": "nonpayable",
104 | "type": "function"
105 | },
106 | {
107 | "constant": true,
108 | "inputs": [
109 |
110 | ],
111 | "name": "getConvertibleTokens",
112 | "outputs": [
113 | {
114 | "name": "",
115 | "type": "address[]"
116 | }
117 | ],
118 | "payable": false,
119 | "stateMutability": "view",
120 | "type": "function"
121 | },
122 | {
123 | "constant": true,
124 | "inputs": [
125 |
126 | ],
127 | "name": "prevRegistry",
128 | "outputs": [
129 | {
130 | "name": "",
131 | "type": "address"
132 | }
133 | ],
134 | "payable": false,
135 | "stateMutability": "view",
136 | "type": "function"
137 | },
138 | {
139 | "constant": true,
140 | "inputs": [
141 |
142 | ],
143 | "name": "getConvertibleTokenCount",
144 | "outputs": [
145 | {
146 | "name": "",
147 | "type": "uint256"
148 | }
149 | ],
150 | "payable": false,
151 | "stateMutability": "view",
152 | "type": "function"
153 | },
154 | {
155 | "constant": false,
156 | "inputs": [
157 | {
158 | "name": "_converter",
159 | "type": "address"
160 | }
161 | ],
162 | "name": "addConverter",
163 | "outputs": [
164 |
165 | ],
166 | "payable": false,
167 | "stateMutability": "nonpayable",
168 | "type": "function"
169 | },
170 | {
171 | "constant": true,
172 | "inputs": [
173 | {
174 | "name": "_convertibleToken",
175 | "type": "address"
176 | },
177 | {
178 | "name": "_value",
179 | "type": "address"
180 | }
181 | ],
182 | "name": "isConvertibleTokenSmartToken",
183 | "outputs": [
184 | {
185 | "name": "",
186 | "type": "bool"
187 | }
188 | ],
189 | "payable": false,
190 | "stateMutability": "view",
191 | "type": "function"
192 | },
193 | {
194 | "constant": false,
195 | "inputs": [
196 |
197 | ],
198 | "name": "acceptOwnership",
199 | "outputs": [
200 |
201 | ],
202 | "payable": false,
203 | "stateMutability": "nonpayable",
204 | "type": "function"
205 | },
206 | {
207 | "constant": true,
208 | "inputs": [
209 |
210 | ],
211 | "name": "getLiquidityPoolCount",
212 | "outputs": [
213 | {
214 | "name": "",
215 | "type": "uint256"
216 | }
217 | ],
218 | "payable": false,
219 | "stateMutability": "view",
220 | "type": "function"
221 | },
222 | {
223 | "constant": true,
224 | "inputs": [
225 |
226 | ],
227 | "name": "registry",
228 | "outputs": [
229 | {
230 | "name": "",
231 | "type": "address"
232 | }
233 | ],
234 | "payable": false,
235 | "stateMutability": "view",
236 | "type": "function"
237 | },
238 | {
239 | "constant": true,
240 | "inputs": [
241 |
242 | ],
243 | "name": "getLiquidityPools",
244 | "outputs": [
245 | {
246 | "name": "",
247 | "type": "address[]"
248 | }
249 | ],
250 | "payable": false,
251 | "stateMutability": "view",
252 | "type": "function"
253 | },
254 | {
255 | "constant": true,
256 | "inputs": [
257 | {
258 | "name": "_reserveTokens",
259 | "type": "address[]"
260 | },
261 | {
262 | "name": "_reserveRatios",
263 | "type": "uint256[]"
264 | }
265 | ],
266 | "name": "getLiquidityPoolByReserveConfig",
267 | "outputs": [
268 | {
269 | "name": "",
270 | "type": "address"
271 | }
272 | ],
273 | "payable": false,
274 | "stateMutability": "view",
275 | "type": "function"
276 | },
277 | {
278 | "constant": true,
279 | "inputs": [
280 | {
281 | "name": "_index",
282 | "type": "uint256"
283 | }
284 | ],
285 | "name": "getConvertibleToken",
286 | "outputs": [
287 | {
288 | "name": "",
289 | "type": "address"
290 | }
291 | ],
292 | "payable": false,
293 | "stateMutability": "view",
294 | "type": "function"
295 | },
296 | {
297 | "constant": true,
298 | "inputs": [
299 |
300 | ],
301 | "name": "owner",
302 | "outputs": [
303 | {
304 | "name": "",
305 | "type": "address"
306 | }
307 | ],
308 | "payable": false,
309 | "stateMutability": "view",
310 | "type": "function"
311 | },
312 | {
313 | "constant": true,
314 | "inputs": [
315 | {
316 | "name": "_converter",
317 | "type": "address"
318 | }
319 | ],
320 | "name": "isConverterValid",
321 | "outputs": [
322 | {
323 | "name": "",
324 | "type": "bool"
325 | }
326 | ],
327 | "payable": false,
328 | "stateMutability": "view",
329 | "type": "function"
330 | },
331 | {
332 | "constant": false,
333 | "inputs": [
334 | {
335 | "name": "_converter",
336 | "type": "address"
337 | }
338 | ],
339 | "name": "removeConverter",
340 | "outputs": [
341 |
342 | ],
343 | "payable": false,
344 | "stateMutability": "nonpayable",
345 | "type": "function"
346 | },
347 | {
348 | "constant": true,
349 | "inputs": [
350 | {
351 | "name": "_index",
352 | "type": "uint256"
353 | }
354 | ],
355 | "name": "getSmartToken",
356 | "outputs": [
357 | {
358 | "name": "",
359 | "type": "address"
360 | }
361 | ],
362 | "payable": false,
363 | "stateMutability": "view",
364 | "type": "function"
365 | },
366 | {
367 | "constant": true,
368 | "inputs": [
369 | {
370 | "name": "_convertibleToken",
371 | "type": "address"
372 | }
373 | ],
374 | "name": "getConvertibleTokenSmartTokenCount",
375 | "outputs": [
376 | {
377 | "name": "",
378 | "type": "uint256"
379 | }
380 | ],
381 | "payable": false,
382 | "stateMutability": "view",
383 | "type": "function"
384 | },
385 | {
386 | "constant": true,
387 | "inputs": [
388 | {
389 | "name": "_index",
390 | "type": "uint256"
391 | }
392 | ],
393 | "name": "getLiquidityPool",
394 | "outputs": [
395 | {
396 | "name": "",
397 | "type": "address"
398 | }
399 | ],
400 | "payable": false,
401 | "stateMutability": "view",
402 | "type": "function"
403 | },
404 | {
405 | "constant": false,
406 | "inputs": [
407 |
408 | ],
409 | "name": "restoreRegistry",
410 | "outputs": [
411 |
412 | ],
413 | "payable": false,
414 | "stateMutability": "nonpayable",
415 | "type": "function"
416 | },
417 | {
418 | "constant": true,
419 | "inputs": [
420 |
421 | ],
422 | "name": "adminOnly",
423 | "outputs": [
424 | {
425 | "name": "",
426 | "type": "bool"
427 | }
428 | ],
429 | "payable": false,
430 | "stateMutability": "view",
431 | "type": "function"
432 | },
433 | {
434 | "constant": true,
435 | "inputs": [
436 |
437 | ],
438 | "name": "newOwner",
439 | "outputs": [
440 | {
441 | "name": "",
442 | "type": "address"
443 | }
444 | ],
445 | "payable": false,
446 | "stateMutability": "view",
447 | "type": "function"
448 | },
449 | {
450 | "constant": true,
451 | "inputs": [
452 | {
453 | "name": "_convertibleToken",
454 | "type": "address"
455 | },
456 | {
457 | "name": "_index",
458 | "type": "uint256"
459 | }
460 | ],
461 | "name": "getConvertibleTokenSmartToken",
462 | "outputs": [
463 | {
464 | "name": "",
465 | "type": "address"
466 | }
467 | ],
468 | "payable": false,
469 | "stateMutability": "view",
470 | "type": "function"
471 | },
472 | {
473 | "constant": true,
474 | "inputs": [
475 |
476 | ],
477 | "name": "getSmartTokenCount",
478 | "outputs": [
479 | {
480 | "name": "",
481 | "type": "uint256"
482 | }
483 | ],
484 | "payable": false,
485 | "stateMutability": "view",
486 | "type": "function"
487 | },
488 | {
489 | "constant": true,
490 | "inputs": [
491 | {
492 | "name": "_value",
493 | "type": "address"
494 | }
495 | ],
496 | "name": "isLiquidityPool",
497 | "outputs": [
498 | {
499 | "name": "",
500 | "type": "bool"
501 | }
502 | ],
503 | "payable": false,
504 | "stateMutability": "view",
505 | "type": "function"
506 | },
507 | {
508 | "constant": false,
509 | "inputs": [
510 | {
511 | "name": "_newOwner",
512 | "type": "address"
513 | }
514 | ],
515 | "name": "transferOwnership",
516 | "outputs": [
517 |
518 | ],
519 | "payable": false,
520 | "stateMutability": "nonpayable",
521 | "type": "function"
522 | },
523 | {
524 | "constant": true,
525 | "inputs": [
526 | {
527 | "name": "_convertibleToken",
528 | "type": "address"
529 | }
530 | ],
531 | "name": "getConvertibleTokenSmartTokens",
532 | "outputs": [
533 | {
534 | "name": "",
535 | "type": "address[]"
536 | }
537 | ],
538 | "payable": false,
539 | "stateMutability": "view",
540 | "type": "function"
541 | },
542 | {
543 | "inputs": [
544 | {
545 | "name": "_registry",
546 | "type": "address"
547 | }
548 | ],
549 | "payable": false,
550 | "stateMutability": "nonpayable",
551 | "type": "constructor"
552 | },
553 | {
554 | "anonymous": false,
555 | "inputs": [
556 | {
557 | "indexed": true,
558 | "name": "_smartToken",
559 | "type": "address"
560 | }
561 | ],
562 | "name": "SmartTokenAdded",
563 | "type": "event"
564 | },
565 | {
566 | "anonymous": false,
567 | "inputs": [
568 | {
569 | "indexed": true,
570 | "name": "_smartToken",
571 | "type": "address"
572 | }
573 | ],
574 | "name": "SmartTokenRemoved",
575 | "type": "event"
576 | },
577 | {
578 | "anonymous": false,
579 | "inputs": [
580 | {
581 | "indexed": true,
582 | "name": "_liquidityPool",
583 | "type": "address"
584 | }
585 | ],
586 | "name": "LiquidityPoolAdded",
587 | "type": "event"
588 | },
589 | {
590 | "anonymous": false,
591 | "inputs": [
592 | {
593 | "indexed": true,
594 | "name": "_liquidityPool",
595 | "type": "address"
596 | }
597 | ],
598 | "name": "LiquidityPoolRemoved",
599 | "type": "event"
600 | },
601 | {
602 | "anonymous": false,
603 | "inputs": [
604 | {
605 | "indexed": true,
606 | "name": "_convertibleToken",
607 | "type": "address"
608 | },
609 | {
610 | "indexed": true,
611 | "name": "_smartToken",
612 | "type": "address"
613 | }
614 | ],
615 | "name": "ConvertibleTokenAdded",
616 | "type": "event"
617 | },
618 | {
619 | "anonymous": false,
620 | "inputs": [
621 | {
622 | "indexed": true,
623 | "name": "_convertibleToken",
624 | "type": "address"
625 | },
626 | {
627 | "indexed": true,
628 | "name": "_smartToken",
629 | "type": "address"
630 | }
631 | ],
632 | "name": "ConvertibleTokenRemoved",
633 | "type": "event"
634 | },
635 | {
636 | "anonymous": false,
637 | "inputs": [
638 | {
639 | "indexed": true,
640 | "name": "_prevOwner",
641 | "type": "address"
642 | },
643 | {
644 | "indexed": true,
645 | "name": "_newOwner",
646 | "type": "address"
647 | }
648 | ],
649 | "name": "OwnerUpdate",
650 | "type": "event"
651 | }
652 | ]
--------------------------------------------------------------------------------
/src/contracts/bancor/SmartToken.js:
--------------------------------------------------------------------------------
1 | export const SmartTokenAbi = [
2 | {
3 | "constant": true,
4 | "inputs": [
5 |
6 | ],
7 | "name": "name",
8 | "outputs": [
9 | {
10 | "name": "",
11 | "type": "string"
12 | }
13 | ],
14 | "payable": false,
15 | "stateMutability": "view",
16 | "type": "function"
17 | },
18 | {
19 | "constant": false,
20 | "inputs": [
21 | {
22 | "name": "_spender",
23 | "type": "address"
24 | },
25 | {
26 | "name": "_value",
27 | "type": "uint256"
28 | }
29 | ],
30 | "name": "approve",
31 | "outputs": [
32 | {
33 | "name": "success",
34 | "type": "bool"
35 | }
36 | ],
37 | "payable": false,
38 | "stateMutability": "nonpayable",
39 | "type": "function"
40 | },
41 | {
42 | "constant": false,
43 | "inputs": [
44 | {
45 | "name": "_disable",
46 | "type": "bool"
47 | }
48 | ],
49 | "name": "disableTransfers",
50 | "outputs": [
51 |
52 | ],
53 | "payable": false,
54 | "stateMutability": "nonpayable",
55 | "type": "function"
56 | },
57 | {
58 | "constant": true,
59 | "inputs": [
60 |
61 | ],
62 | "name": "totalSupply",
63 | "outputs": [
64 | {
65 | "name": "",
66 | "type": "uint256"
67 | }
68 | ],
69 | "payable": false,
70 | "stateMutability": "view",
71 | "type": "function"
72 | },
73 | {
74 | "constant": false,
75 | "inputs": [
76 | {
77 | "name": "_from",
78 | "type": "address"
79 | },
80 | {
81 | "name": "_to",
82 | "type": "address"
83 | },
84 | {
85 | "name": "_value",
86 | "type": "uint256"
87 | }
88 | ],
89 | "name": "transferFrom",
90 | "outputs": [
91 | {
92 | "name": "success",
93 | "type": "bool"
94 | }
95 | ],
96 | "payable": false,
97 | "stateMutability": "nonpayable",
98 | "type": "function"
99 | },
100 | {
101 | "constant": true,
102 | "inputs": [
103 |
104 | ],
105 | "name": "decimals",
106 | "outputs": [
107 | {
108 | "name": "",
109 | "type": "uint8"
110 | }
111 | ],
112 | "payable": false,
113 | "stateMutability": "view",
114 | "type": "function"
115 | },
116 | {
117 | "constant": true,
118 | "inputs": [
119 |
120 | ],
121 | "name": "version",
122 | "outputs": [
123 | {
124 | "name": "",
125 | "type": "string"
126 | }
127 | ],
128 | "payable": false,
129 | "stateMutability": "view",
130 | "type": "function"
131 | },
132 | {
133 | "constant": false,
134 | "inputs": [
135 | {
136 | "name": "_token",
137 | "type": "address"
138 | },
139 | {
140 | "name": "_to",
141 | "type": "address"
142 | },
143 | {
144 | "name": "_amount",
145 | "type": "uint256"
146 | }
147 | ],
148 | "name": "withdrawTokens",
149 | "outputs": [
150 |
151 | ],
152 | "payable": false,
153 | "stateMutability": "nonpayable",
154 | "type": "function"
155 | },
156 | {
157 | "constant": true,
158 | "inputs": [
159 | {
160 | "name": "",
161 | "type": "address"
162 | }
163 | ],
164 | "name": "balanceOf",
165 | "outputs": [
166 | {
167 | "name": "",
168 | "type": "uint256"
169 | }
170 | ],
171 | "payable": false,
172 | "stateMutability": "view",
173 | "type": "function"
174 | },
175 | {
176 | "constant": false,
177 | "inputs": [
178 |
179 | ],
180 | "name": "acceptOwnership",
181 | "outputs": [
182 |
183 | ],
184 | "payable": false,
185 | "stateMutability": "nonpayable",
186 | "type": "function"
187 | },
188 | {
189 | "constant": false,
190 | "inputs": [
191 | {
192 | "name": "_to",
193 | "type": "address"
194 | },
195 | {
196 | "name": "_amount",
197 | "type": "uint256"
198 | }
199 | ],
200 | "name": "issue",
201 | "outputs": [
202 |
203 | ],
204 | "payable": false,
205 | "stateMutability": "nonpayable",
206 | "type": "function"
207 | },
208 | {
209 | "constant": true,
210 | "inputs": [
211 |
212 | ],
213 | "name": "owner",
214 | "outputs": [
215 | {
216 | "name": "",
217 | "type": "address"
218 | }
219 | ],
220 | "payable": false,
221 | "stateMutability": "view",
222 | "type": "function"
223 | },
224 | {
225 | "constant": true,
226 | "inputs": [
227 |
228 | ],
229 | "name": "symbol",
230 | "outputs": [
231 | {
232 | "name": "",
233 | "type": "string"
234 | }
235 | ],
236 | "payable": false,
237 | "stateMutability": "view",
238 | "type": "function"
239 | },
240 | {
241 | "constant": false,
242 | "inputs": [
243 | {
244 | "name": "_from",
245 | "type": "address"
246 | },
247 | {
248 | "name": "_amount",
249 | "type": "uint256"
250 | }
251 | ],
252 | "name": "destroy",
253 | "outputs": [
254 |
255 | ],
256 | "payable": false,
257 | "stateMutability": "nonpayable",
258 | "type": "function"
259 | },
260 | {
261 | "constant": false,
262 | "inputs": [
263 | {
264 | "name": "_to",
265 | "type": "address"
266 | },
267 | {
268 | "name": "_value",
269 | "type": "uint256"
270 | }
271 | ],
272 | "name": "transfer",
273 | "outputs": [
274 | {
275 | "name": "success",
276 | "type": "bool"
277 | }
278 | ],
279 | "payable": false,
280 | "stateMutability": "nonpayable",
281 | "type": "function"
282 | },
283 | {
284 | "constant": true,
285 | "inputs": [
286 |
287 | ],
288 | "name": "transfersEnabled",
289 | "outputs": [
290 | {
291 | "name": "",
292 | "type": "bool"
293 | }
294 | ],
295 | "payable": false,
296 | "stateMutability": "view",
297 | "type": "function"
298 | },
299 | {
300 | "constant": true,
301 | "inputs": [
302 |
303 | ],
304 | "name": "newOwner",
305 | "outputs": [
306 | {
307 | "name": "",
308 | "type": "address"
309 | }
310 | ],
311 | "payable": false,
312 | "stateMutability": "view",
313 | "type": "function"
314 | },
315 | {
316 | "constant": true,
317 | "inputs": [
318 | {
319 | "name": "",
320 | "type": "address"
321 | },
322 | {
323 | "name": "",
324 | "type": "address"
325 | }
326 | ],
327 | "name": "allowance",
328 | "outputs": [
329 | {
330 | "name": "",
331 | "type": "uint256"
332 | }
333 | ],
334 | "payable": false,
335 | "stateMutability": "view",
336 | "type": "function"
337 | },
338 | {
339 | "constant": false,
340 | "inputs": [
341 | {
342 | "name": "_newOwner",
343 | "type": "address"
344 | }
345 | ],
346 | "name": "transferOwnership",
347 | "outputs": [
348 |
349 | ],
350 | "payable": false,
351 | "stateMutability": "nonpayable",
352 | "type": "function"
353 | },
354 | {
355 | "inputs": [
356 | {
357 | "name": "_name",
358 | "type": "string"
359 | },
360 | {
361 | "name": "_symbol",
362 | "type": "string"
363 | },
364 | {
365 | "name": "_decimals",
366 | "type": "uint8"
367 | }
368 | ],
369 | "payable": false,
370 | "stateMutability": "nonpayable",
371 | "type": "constructor"
372 | },
373 | {
374 | "anonymous": false,
375 | "inputs": [
376 | {
377 | "indexed": false,
378 | "name": "_token",
379 | "type": "address"
380 | }
381 | ],
382 | "name": "NewSmartToken",
383 | "type": "event"
384 | },
385 | {
386 | "anonymous": false,
387 | "inputs": [
388 | {
389 | "indexed": false,
390 | "name": "_amount",
391 | "type": "uint256"
392 | }
393 | ],
394 | "name": "Issuance",
395 | "type": "event"
396 | },
397 | {
398 | "anonymous": false,
399 | "inputs": [
400 | {
401 | "indexed": false,
402 | "name": "_amount",
403 | "type": "uint256"
404 | }
405 | ],
406 | "name": "Destruction",
407 | "type": "event"
408 | },
409 | {
410 | "anonymous": false,
411 | "inputs": [
412 | {
413 | "indexed": true,
414 | "name": "_from",
415 | "type": "address"
416 | },
417 | {
418 | "indexed": true,
419 | "name": "_to",
420 | "type": "address"
421 | },
422 | {
423 | "indexed": false,
424 | "name": "_value",
425 | "type": "uint256"
426 | }
427 | ],
428 | "name": "Transfer",
429 | "type": "event"
430 | },
431 | {
432 | "anonymous": false,
433 | "inputs": [
434 | {
435 | "indexed": true,
436 | "name": "_owner",
437 | "type": "address"
438 | },
439 | {
440 | "indexed": true,
441 | "name": "_spender",
442 | "type": "address"
443 | },
444 | {
445 | "indexed": false,
446 | "name": "_value",
447 | "type": "uint256"
448 | }
449 | ],
450 | "name": "Approval",
451 | "type": "event"
452 | },
453 | {
454 | "anonymous": false,
455 | "inputs": [
456 | {
457 | "indexed": true,
458 | "name": "_prevOwner",
459 | "type": "address"
460 | },
461 | {
462 | "indexed": true,
463 | "name": "_newOwner",
464 | "type": "address"
465 | }
466 | ],
467 | "name": "OwnerUpdate",
468 | "type": "event"
469 | }
470 | ]
471 |
472 | export const SmartTokenControllerAbi = [{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_amount","type":"uint256"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
473 |
474 | export const SmartTokenByteCode = "60c0604052600360808190527f302e33000000000000000000000000000000000000000000000000000000000060a09081526200004091600891906200015a565b506009805460ff191660011790553480156200005b57600080fd5b5060405162000f1a38038062000f1a833981016040908152815160208301519183015160008054600160a060020a03191633178155918401805190949390930192909184918491849181108015620000b4575060008351115b1515620000c057600080fd5b8351620000d59060029060208701906200015a565b508251620000eb9060039060208601906200015a565b506004805460ff191660ff939093169290921790915560058190553360009081526006602090815260409182902092909255805130815290517ff4cd1f8571e8d9c97ffcb81558807ab73f9803d54de5da6a0420593c82a4a9f09450908190039091019150a1505050620001ff565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200019d57805160ff1916838001178555620001cd565b82800160010185558215620001cd579182015b82811115620001cd578251825591602001919060010190620001b0565b50620001db929150620001df565b5090565b620001fc91905b80821115620001db5760008155600101620001e6565b90565b610d0b806200020f6000396000f3006080604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461010b578063095ea7b3146101955780631608f18f146101cd57806318160ddd146101e957806323b872dd14610210578063313ce5671461023a57806354fd4d50146102655780635e35359e1461027a57806370a08231146102a457806379ba5097146102c5578063867904b4146102da5780638da5cb5b146102fe57806395d89b411461032f578063a24835d114610344578063a9059cbb14610368578063bef97c871461038c578063d4ee1d90146103a1578063dd62ed3e146103b6578063f2fde38b146103dd575b600080fd5b34801561011757600080fd5b506101206103fe565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015a578181015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a157600080fd5b506101b9600160a060020a0360043516602435610489565b604080519115158252519081900360200190f35b3480156101d957600080fd5b506101e76004351515610542565b005b3480156101f557600080fd5b506101fe61056b565b60408051918252519081900360200190f35b34801561021c57600080fd5b506101b9600160a060020a0360043581169060243516604435610571565b34801561024657600080fd5b5061024f61059f565b6040805160ff9092168252519081900360200190f35b34801561027157600080fd5b506101206105a8565b34801561028657600080fd5b506101e7600160a060020a0360043581169060243516604435610603565b3480156102b057600080fd5b506101fe600160a060020a03600435166106f9565b3480156102d157600080fd5b506101e761070b565b3480156102e657600080fd5b506101e7600160a060020a0360043516602435610793565b34801561030a57600080fd5b5061031361089c565b60408051600160a060020a039092168252519081900360200190f35b34801561033b57600080fd5b506101206108ab565b34801561035057600080fd5b506101e7600160a060020a0360043516602435610906565b34801561037457600080fd5b506101b9600160a060020a03600435166024356109ef565b34801561039857600080fd5b506101b9610a1b565b3480156103ad57600080fd5b50610313610a24565b3480156103c257600080fd5b506101fe600160a060020a0360043581169060243516610a33565b3480156103e957600080fd5b506101e7600160a060020a0360043516610a50565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156104815780601f1061045657610100808354040283529160200191610481565b820191906000526020600020905b81548152906001019060200180831161046457829003601f168201915b505050505081565b600082600160a060020a03811615156104a157600080fd5b8215806104cf5750336000908152600760209081526040808320600160a060020a0388168452909152902054155b15156104da57600080fd5b336000818152600760209081526040808320600160a060020a03891680855290835292819020879055805187815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600054600160a060020a0316331461055957600080fd5b6009805460ff19169115919091179055565b60055481565b60095460009060ff16151561058257fe5b61058d848484610ab1565b151561059557fe5b5060019392505050565b60045460ff1681565b6008805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104815780601f1061045657610100808354040283529160200191610481565b600054600160a060020a0316331461061a57600080fd5b82600160a060020a038116151561063057600080fd5b82600160a060020a038116151561064657600080fd5b83600160a060020a03811630141561065d57600080fd5b85600160a060020a031663a9059cbb86866040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156106d957600080fd5b505af11580156106ed573d6000803e3d6000fd5b50505050505050505050565b60066020526000908152604090205481565b600154600160a060020a0316331461072257600080fd5b60015460008054604051600160a060020a0393841693909116917f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a91a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600054600160a060020a031633146107aa57600080fd5b81600160a060020a03811615156107c057600080fd5b82600160a060020a0381163014156107d757600080fd5b6005546107ea908463ffffffff610bda16565b600555600160a060020a038416600090815260066020526040902054610816908463ffffffff610bda16565b600160a060020a03851660009081526006602090815260409182902092909255805185815290517f9386c90217c323f58030f9dadcbc938f807a940f4ff41cd4cead9562f5da7dc3929181900390910190a1604080518481529051600160a060020a038616913091600080516020610cc08339815191529181900360200190a350505050565b600054600160a060020a031681565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104815780601f1061045657610100808354040283529160200191610481565b33600160a060020a03831614806109275750600054600160a060020a031633145b151561093257600080fd5b600160a060020a03821660009081526006602052604090205461095b908263ffffffff610bf316565b600160a060020a038316600090815260066020526040902055600554610987908263ffffffff610bf316565b6005556040805182815290513091600160a060020a03851691600080516020610cc08339815191529181900360200190a36040805182815290517f9a1b418bc061a5d80270261562e6986a35d995f8051145f277be16103abd34539181900360200190a15050565b60095460009060ff161515610a0057fe5b610a0a8383610c08565b1515610a1257fe5b50600192915050565b60095460ff1681565b600154600160a060020a031681565b600760209081526000928352604080842090915290825290205481565b600054600160a060020a03163314610a6757600080fd5b600054600160a060020a0382811691161415610a8257600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600083600160a060020a0381161515610ac957600080fd5b83600160a060020a0381161515610adf57600080fd5b600160a060020a0386166000908152600760209081526040808320338452909152902054610b13908563ffffffff610bf316565b600160a060020a038716600081815260076020908152604080832033845282528083209490945591815260069091522054610b54908563ffffffff610bf316565b600160a060020a038088166000908152600660205260408082209390935590871681522054610b89908563ffffffff610bda16565b600160a060020a0380871660008181526006602090815260409182902094909455805188815290519193928a1692600080516020610cc083398151915292918290030190a350600195945050505050565b600082820183811015610bec57600080fd5b9392505050565b600081831015610c0257600080fd5b50900390565b600082600160a060020a0381161515610c2057600080fd5b33600090815260066020526040902054610c40908463ffffffff610bf316565b3360009081526006602052604080822092909255600160a060020a03861681522054610c72908463ffffffff610bda16565b600160a060020a038516600081815260066020908152604091829020939093558051868152905191923392600080516020610cc08339815191529281900390910190a350600193925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820ce51519b7f4e3128abe81f88a7ef774780cd8fec3f3a7fe7e2cd72f7ce44e58d0029"
--------------------------------------------------------------------------------
/src/contracts/bancor/BancorNetwork.js:
--------------------------------------------------------------------------------
1 | export const BancorNetworkAbi = [
2 | {
3 | "constant":false,
4 | "inputs":[
5 | {
6 | "name":"_token",
7 | "type":"address"
8 | },
9 | {
10 | "name":"_register",
11 | "type":"bool"
12 | }
13 | ],
14 | "name":"registerEtherToken",
15 | "outputs":[
16 |
17 | ],
18 | "payable":false,
19 | "stateMutability":"nonpayable",
20 | "type":"function"
21 | },
22 | {
23 | "constant":false,
24 | "inputs":[
25 | {
26 | "name":"_signerAddress",
27 | "type":"address"
28 | }
29 | ],
30 | "name":"setSignerAddress",
31 | "outputs":[
32 |
33 | ],
34 | "payable":false,
35 | "stateMutability":"nonpayable",
36 | "type":"function"
37 | },
38 | {
39 | "constant":true,
40 | "inputs":[
41 | {
42 | "name":"_path",
43 | "type":"address[]"
44 | },
45 | {
46 | "name":"_amount",
47 | "type":"uint256"
48 | }
49 | ],
50 | "name":"getReturnByPath",
51 | "outputs":[
52 | {
53 | "name":"",
54 | "type":"uint256"
55 | },
56 | {
57 | "name":"",
58 | "type":"uint256"
59 | }
60 | ],
61 | "payable":false,
62 | "stateMutability":"view",
63 | "type":"function"
64 | },
65 | {
66 | "constant":true,
67 | "inputs":[
68 |
69 | ],
70 | "name":"BANCOR_CONVERTER_UPGRADER",
71 | "outputs":[
72 | {
73 | "name":"",
74 | "type":"bytes32"
75 | }
76 | ],
77 | "payable":false,
78 | "stateMutability":"view",
79 | "type":"function"
80 | },
81 | {
82 | "constant":false,
83 | "inputs":[
84 | {
85 | "name":"_path",
86 | "type":"address[]"
87 | },
88 | {
89 | "name":"_amount",
90 | "type":"uint256"
91 | },
92 | {
93 | "name":"_minReturn",
94 | "type":"uint256"
95 | },
96 | {
97 | "name":"_for",
98 | "type":"address"
99 | },
100 | {
101 | "name":"_block",
102 | "type":"uint256"
103 | },
104 | {
105 | "name":"_nonce",
106 | "type":"uint256"
107 | },
108 | {
109 | "name":"_v",
110 | "type":"uint8"
111 | },
112 | {
113 | "name":"_r",
114 | "type":"bytes32"
115 | },
116 | {
117 | "name":"_s",
118 | "type":"bytes32"
119 | }
120 | ],
121 | "name":"convertForPrioritized",
122 | "outputs":[
123 | {
124 | "name":"",
125 | "type":"uint256"
126 | }
127 | ],
128 | "payable":true,
129 | "stateMutability":"payable",
130 | "type":"function"
131 | },
132 | {
133 | "constant":true,
134 | "inputs":[
135 |
136 | ],
137 | "name":"BNT_TOKEN",
138 | "outputs":[
139 | {
140 | "name":"",
141 | "type":"bytes32"
142 | }
143 | ],
144 | "payable":false,
145 | "stateMutability":"view",
146 | "type":"function"
147 | },
148 | {
149 | "constant":true,
150 | "inputs":[
151 |
152 | ],
153 | "name":"CONTRACT_REGISTRY",
154 | "outputs":[
155 | {
156 | "name":"",
157 | "type":"bytes32"
158 | }
159 | ],
160 | "payable":false,
161 | "stateMutability":"view",
162 | "type":"function"
163 | },
164 | {
165 | "constant":false,
166 | "inputs":[
167 | {
168 | "name":"_path",
169 | "type":"address[]"
170 | },
171 | {
172 | "name":"_amount",
173 | "type":"uint256"
174 | },
175 | {
176 | "name":"_minReturn",
177 | "type":"uint256"
178 | },
179 | {
180 | "name":"_for",
181 | "type":"address"
182 | },
183 | {
184 | "name":"_affiliateAccount",
185 | "type":"address"
186 | },
187 | {
188 | "name":"_affiliateFee",
189 | "type":"uint256"
190 | }
191 | ],
192 | "name":"claimAndConvertFor2",
193 | "outputs":[
194 | {
195 | "name":"",
196 | "type":"uint256"
197 | }
198 | ],
199 | "payable":false,
200 | "stateMutability":"nonpayable",
201 | "type":"function"
202 | },
203 | {
204 | "constant":false,
205 | "inputs":[
206 | {
207 | "name":"_path",
208 | "type":"address[]"
209 | },
210 | {
211 | "name":"_amount",
212 | "type":"uint256"
213 | },
214 | {
215 | "name":"_minReturn",
216 | "type":"uint256"
217 | },
218 | {
219 | "name":"_for",
220 | "type":"address"
221 | },
222 | {
223 | "name":"_signature",
224 | "type":"uint256[]"
225 | },
226 | {
227 | "name":"_affiliateAccount",
228 | "type":"address"
229 | },
230 | {
231 | "name":"_affiliateFee",
232 | "type":"uint256"
233 | }
234 | ],
235 | "name":"convertForPrioritized4",
236 | "outputs":[
237 | {
238 | "name":"",
239 | "type":"uint256"
240 | }
241 | ],
242 | "payable":true,
243 | "stateMutability":"payable",
244 | "type":"function"
245 | },
246 | {
247 | "constant":false,
248 | "inputs":[
249 | {
250 | "name":"_path",
251 | "type":"address[]"
252 | },
253 | {
254 | "name":"_amount",
255 | "type":"uint256"
256 | },
257 | {
258 | "name":"_minReturn",
259 | "type":"uint256"
260 | },
261 | {
262 | "name":"_affiliateAccount",
263 | "type":"address"
264 | },
265 | {
266 | "name":"_affiliateFee",
267 | "type":"uint256"
268 | }
269 | ],
270 | "name":"convert2",
271 | "outputs":[
272 | {
273 | "name":"",
274 | "type":"uint256"
275 | }
276 | ],
277 | "payable":true,
278 | "stateMutability":"payable",
279 | "type":"function"
280 | },
281 | {
282 | "constant":true,
283 | "inputs":[
284 |
285 | ],
286 | "name":"BANCOR_CONVERTER_FACTORY",
287 | "outputs":[
288 | {
289 | "name":"",
290 | "type":"bytes32"
291 | }
292 | ],
293 | "payable":false,
294 | "stateMutability":"view",
295 | "type":"function"
296 | },
297 | {
298 | "constant":true,
299 | "inputs":[
300 |
301 | ],
302 | "name":"signerAddress",
303 | "outputs":[
304 | {
305 | "name":"",
306 | "type":"address"
307 | }
308 | ],
309 | "payable":false,
310 | "stateMutability":"view",
311 | "type":"function"
312 | },
313 | {
314 | "constant":true,
315 | "inputs":[
316 |
317 | ],
318 | "name":"maxAffiliateFee",
319 | "outputs":[
320 | {
321 | "name":"",
322 | "type":"uint256"
323 | }
324 | ],
325 | "payable":false,
326 | "stateMutability":"view",
327 | "type":"function"
328 | },
329 | {
330 | "constant":false,
331 | "inputs":[
332 | {
333 | "name":"_token",
334 | "type":"address"
335 | },
336 | {
337 | "name":"_to",
338 | "type":"address"
339 | },
340 | {
341 | "name":"_amount",
342 | "type":"uint256"
343 | }
344 | ],
345 | "name":"withdrawTokens",
346 | "outputs":[
347 |
348 | ],
349 | "payable":false,
350 | "stateMutability":"nonpayable",
351 | "type":"function"
352 | },
353 | {
354 | "constant":true,
355 | "inputs":[
356 |
357 | ],
358 | "name":"BNT_CONVERTER",
359 | "outputs":[
360 | {
361 | "name":"",
362 | "type":"bytes32"
363 | }
364 | ],
365 | "payable":false,
366 | "stateMutability":"view",
367 | "type":"function"
368 | },
369 | {
370 | "constant":false,
371 | "inputs":[
372 | {
373 | "name":"_path",
374 | "type":"address[]"
375 | },
376 | {
377 | "name":"_amount",
378 | "type":"uint256"
379 | },
380 | {
381 | "name":"_minReturn",
382 | "type":"uint256"
383 | },
384 | {
385 | "name":"_toBlockchain",
386 | "type":"bytes32"
387 | },
388 | {
389 | "name":"_to",
390 | "type":"bytes32"
391 | },
392 | {
393 | "name":"_conversionId",
394 | "type":"uint256"
395 | },
396 | {
397 | "name":"_block",
398 | "type":"uint256"
399 | },
400 | {
401 | "name":"_v",
402 | "type":"uint8"
403 | },
404 | {
405 | "name":"_r",
406 | "type":"bytes32"
407 | },
408 | {
409 | "name":"_s",
410 | "type":"bytes32"
411 | }
412 | ],
413 | "name":"xConvertPrioritized",
414 | "outputs":[
415 | {
416 | "name":"",
417 | "type":"uint256"
418 | }
419 | ],
420 | "payable":true,
421 | "stateMutability":"payable",
422 | "type":"function"
423 | },
424 | {
425 | "constant":false,
426 | "inputs":[
427 | {
428 | "name":"_path",
429 | "type":"address[]"
430 | },
431 | {
432 | "name":"_amount",
433 | "type":"uint256"
434 | },
435 | {
436 | "name":"_minReturn",
437 | "type":"uint256"
438 | },
439 | {
440 | "name":"_for",
441 | "type":"address"
442 | },
443 | {
444 | "name":"_block",
445 | "type":"uint256"
446 | },
447 | {
448 | "name":"_v",
449 | "type":"uint8"
450 | },
451 | {
452 | "name":"_r",
453 | "type":"bytes32"
454 | },
455 | {
456 | "name":"_s",
457 | "type":"bytes32"
458 | }
459 | ],
460 | "name":"convertForPrioritized2",
461 | "outputs":[
462 | {
463 | "name":"",
464 | "type":"uint256"
465 | }
466 | ],
467 | "payable":true,
468 | "stateMutability":"payable",
469 | "type":"function"
470 | },
471 | {
472 | "constant":true,
473 | "inputs":[
474 |
475 | ],
476 | "name":"BANCOR_FORMULA",
477 | "outputs":[
478 | {
479 | "name":"",
480 | "type":"bytes32"
481 | }
482 | ],
483 | "payable":false,
484 | "stateMutability":"view",
485 | "type":"function"
486 | },
487 | {
488 | "constant":false,
489 | "inputs":[
490 |
491 | ],
492 | "name":"acceptOwnership",
493 | "outputs":[
494 |
495 | ],
496 | "payable":false,
497 | "stateMutability":"nonpayable",
498 | "type":"function"
499 | },
500 | {
501 | "constant":true,
502 | "inputs":[
503 |
504 | ],
505 | "name":"registry",
506 | "outputs":[
507 | {
508 | "name":"",
509 | "type":"address"
510 | }
511 | ],
512 | "payable":false,
513 | "stateMutability":"view",
514 | "type":"function"
515 | },
516 | {
517 | "constant":true,
518 | "inputs":[
519 | {
520 | "name":"",
521 | "type":"address"
522 | }
523 | ],
524 | "name":"etherTokens",
525 | "outputs":[
526 | {
527 | "name":"",
528 | "type":"bool"
529 | }
530 | ],
531 | "payable":false,
532 | "stateMutability":"view",
533 | "type":"function"
534 | },
535 | {
536 | "constant":true,
537 | "inputs":[
538 |
539 | ],
540 | "name":"CONTRACT_FEATURES",
541 | "outputs":[
542 | {
543 | "name":"",
544 | "type":"bytes32"
545 | }
546 | ],
547 | "payable":false,
548 | "stateMutability":"view",
549 | "type":"function"
550 | },
551 | {
552 | "constant":true,
553 | "inputs":[
554 | {
555 | "name":"",
556 | "type":"bytes32"
557 | }
558 | ],
559 | "name":"conversionHashes",
560 | "outputs":[
561 | {
562 | "name":"",
563 | "type":"bool"
564 | }
565 | ],
566 | "payable":false,
567 | "stateMutability":"view",
568 | "type":"function"
569 | },
570 | {
571 | "constant":true,
572 | "inputs":[
573 |
574 | ],
575 | "name":"owner",
576 | "outputs":[
577 | {
578 | "name":"",
579 | "type":"address"
580 | }
581 | ],
582 | "payable":false,
583 | "stateMutability":"view",
584 | "type":"function"
585 | },
586 | {
587 | "constant":true,
588 | "inputs":[
589 |
590 | ],
591 | "name":"BANCOR_NETWORK",
592 | "outputs":[
593 | {
594 | "name":"",
595 | "type":"bytes32"
596 | }
597 | ],
598 | "payable":false,
599 | "stateMutability":"view",
600 | "type":"function"
601 | },
602 | {
603 | "constant":true,
604 | "inputs":[
605 |
606 | ],
607 | "name":"BANCOR_GAS_PRICE_LIMIT",
608 | "outputs":[
609 | {
610 | "name":"",
611 | "type":"bytes32"
612 | }
613 | ],
614 | "payable":false,
615 | "stateMutability":"view",
616 | "type":"function"
617 | },
618 | {
619 | "constant":true,
620 | "inputs":[
621 |
622 | ],
623 | "name":"CONVERTER_CONVERSION_WHITELIST",
624 | "outputs":[
625 | {
626 | "name":"",
627 | "type":"uint256"
628 | }
629 | ],
630 | "payable":false,
631 | "stateMutability":"view",
632 | "type":"function"
633 | },
634 | {
635 | "constant":false,
636 | "inputs":[
637 | {
638 | "name":"_registry",
639 | "type":"address"
640 | }
641 | ],
642 | "name":"setRegistry",
643 | "outputs":[
644 |
645 | ],
646 | "payable":false,
647 | "stateMutability":"nonpayable",
648 | "type":"function"
649 | },
650 | {
651 | "constant":false,
652 | "inputs":[
653 | {
654 | "name":"_path",
655 | "type":"address[]"
656 | },
657 | {
658 | "name":"_amount",
659 | "type":"uint256"
660 | },
661 | {
662 | "name":"_minReturn",
663 | "type":"uint256"
664 | },
665 | {
666 | "name":"_for",
667 | "type":"address"
668 | },
669 | {
670 | "name":"_affiliateAccount",
671 | "type":"address"
672 | },
673 | {
674 | "name":"_affiliateFee",
675 | "type":"uint256"
676 | }
677 | ],
678 | "name":"convertFor2",
679 | "outputs":[
680 | {
681 | "name":"",
682 | "type":"uint256"
683 | }
684 | ],
685 | "payable":true,
686 | "stateMutability":"payable",
687 | "type":"function"
688 | },
689 | {
690 | "constant":false,
691 | "inputs":[
692 | {
693 | "name":"_path",
694 | "type":"address[]"
695 | },
696 | {
697 | "name":"_amount",
698 | "type":"uint256"
699 | },
700 | {
701 | "name":"_minReturn",
702 | "type":"uint256"
703 | },
704 | {
705 | "name":"_for",
706 | "type":"address"
707 | }
708 | ],
709 | "name":"claimAndConvertFor",
710 | "outputs":[
711 | {
712 | "name":"",
713 | "type":"uint256"
714 | }
715 | ],
716 | "payable":false,
717 | "stateMutability":"nonpayable",
718 | "type":"function"
719 | },
720 | {
721 | "constant":false,
722 | "inputs":[
723 | {
724 | "name":"_path",
725 | "type":"address[]"
726 | },
727 | {
728 | "name":"_amount",
729 | "type":"uint256"
730 | },
731 | {
732 | "name":"_minReturn",
733 | "type":"uint256"
734 | },
735 | {
736 | "name":"_for",
737 | "type":"address"
738 | },
739 | {
740 | "name":"_customVal",
741 | "type":"uint256"
742 | },
743 | {
744 | "name":"_block",
745 | "type":"uint256"
746 | },
747 | {
748 | "name":"_v",
749 | "type":"uint8"
750 | },
751 | {
752 | "name":"_r",
753 | "type":"bytes32"
754 | },
755 | {
756 | "name":"_s",
757 | "type":"bytes32"
758 | }
759 | ],
760 | "name":"convertForPrioritized3",
761 | "outputs":[
762 | {
763 | "name":"",
764 | "type":"uint256"
765 | }
766 | ],
767 | "payable":true,
768 | "stateMutability":"payable",
769 | "type":"function"
770 | },
771 | {
772 | "constant":true,
773 | "inputs":[
774 |
775 | ],
776 | "name":"BANCOR_X",
777 | "outputs":[
778 | {
779 | "name":"",
780 | "type":"bytes32"
781 | }
782 | ],
783 | "payable":false,
784 | "stateMutability":"view",
785 | "type":"function"
786 | },
787 | {
788 | "constant":false,
789 | "inputs":[
790 | {
791 | "name":"_path",
792 | "type":"address[]"
793 | },
794 | {
795 | "name":"_amount",
796 | "type":"uint256"
797 | },
798 | {
799 | "name":"_minReturn",
800 | "type":"uint256"
801 | },
802 | {
803 | "name":"_toBlockchain",
804 | "type":"bytes32"
805 | },
806 | {
807 | "name":"_to",
808 | "type":"bytes32"
809 | },
810 | {
811 | "name":"_conversionId",
812 | "type":"uint256"
813 | }
814 | ],
815 | "name":"xConvert",
816 | "outputs":[
817 | {
818 | "name":"",
819 | "type":"uint256"
820 | }
821 | ],
822 | "payable":true,
823 | "stateMutability":"payable",
824 | "type":"function"
825 | },
826 | {
827 | "constant":false,
828 | "inputs":[
829 | {
830 | "name":"_path",
831 | "type":"address[]"
832 | },
833 | {
834 | "name":"_amount",
835 | "type":"uint256"
836 | },
837 | {
838 | "name":"_minReturn",
839 | "type":"uint256"
840 | }
841 | ],
842 | "name":"claimAndConvert",
843 | "outputs":[
844 | {
845 | "name":"",
846 | "type":"uint256"
847 | }
848 | ],
849 | "payable":false,
850 | "stateMutability":"nonpayable",
851 | "type":"function"
852 | },
853 | {
854 | "constant":false,
855 | "inputs":[
856 | {
857 | "name":"_path",
858 | "type":"address[]"
859 | },
860 | {
861 | "name":"_amount",
862 | "type":"uint256"
863 | },
864 | {
865 | "name":"_minReturn",
866 | "type":"uint256"
867 | },
868 | {
869 | "name":"_for",
870 | "type":"address"
871 | }
872 | ],
873 | "name":"convertFor",
874 | "outputs":[
875 | {
876 | "name":"",
877 | "type":"uint256"
878 | }
879 | ],
880 | "payable":true,
881 | "stateMutability":"payable",
882 | "type":"function"
883 | },
884 | {
885 | "constant":true,
886 | "inputs":[
887 |
888 | ],
889 | "name":"BANCOR_X_UPGRADER",
890 | "outputs":[
891 | {
892 | "name":"",
893 | "type":"bytes32"
894 | }
895 | ],
896 | "payable":false,
897 | "stateMutability":"view",
898 | "type":"function"
899 | },
900 | {
901 | "constant":false,
902 | "inputs":[
903 | {
904 | "name":"_path",
905 | "type":"address[]"
906 | },
907 | {
908 | "name":"_amount",
909 | "type":"uint256"
910 | },
911 | {
912 | "name":"_minReturn",
913 | "type":"uint256"
914 | },
915 | {
916 | "name":"_toBlockchain",
917 | "type":"bytes32"
918 | },
919 | {
920 | "name":"_to",
921 | "type":"bytes32"
922 | },
923 | {
924 | "name":"_conversionId",
925 | "type":"uint256"
926 | },
927 | {
928 | "name":"_signature",
929 | "type":"uint256[]"
930 | }
931 | ],
932 | "name":"xConvertPrioritized2",
933 | "outputs":[
934 | {
935 | "name":"",
936 | "type":"uint256"
937 | }
938 | ],
939 | "payable":true,
940 | "stateMutability":"payable",
941 | "type":"function"
942 | },
943 | {
944 | "constant":true,
945 | "inputs":[
946 |
947 | ],
948 | "name":"newOwner",
949 | "outputs":[
950 | {
951 | "name":"",
952 | "type":"address"
953 | }
954 | ],
955 | "payable":false,
956 | "stateMutability":"view",
957 | "type":"function"
958 | },
959 | {
960 | "constant":false,
961 | "inputs":[
962 | {
963 | "name":"_path",
964 | "type":"address[]"
965 | },
966 | {
967 | "name":"_amount",
968 | "type":"uint256"
969 | },
970 | {
971 | "name":"_minReturn",
972 | "type":"uint256"
973 | },
974 | {
975 | "name":"_affiliateAccount",
976 | "type":"address"
977 | },
978 | {
979 | "name":"_affiliateFee",
980 | "type":"uint256"
981 | }
982 | ],
983 | "name":"claimAndConvert2",
984 | "outputs":[
985 | {
986 | "name":"",
987 | "type":"uint256"
988 | }
989 | ],
990 | "payable":false,
991 | "stateMutability":"nonpayable",
992 | "type":"function"
993 | },
994 | {
995 | "constant":false,
996 | "inputs":[
997 | {
998 | "name":"_newOwner",
999 | "type":"address"
1000 | }
1001 | ],
1002 | "name":"transferOwnership",
1003 | "outputs":[
1004 |
1005 | ],
1006 | "payable":false,
1007 | "stateMutability":"nonpayable",
1008 | "type":"function"
1009 | },
1010 | {
1011 | "constant":false,
1012 | "inputs":[
1013 | {
1014 | "name":"_path",
1015 | "type":"address[]"
1016 | },
1017 | {
1018 | "name":"_amount",
1019 | "type":"uint256"
1020 | },
1021 | {
1022 | "name":"_minReturn",
1023 | "type":"uint256"
1024 | }
1025 | ],
1026 | "name":"convert",
1027 | "outputs":[
1028 | {
1029 | "name":"",
1030 | "type":"uint256"
1031 | }
1032 | ],
1033 | "payable":true,
1034 | "stateMutability":"payable",
1035 | "type":"function"
1036 | },
1037 | {
1038 | "constant":false,
1039 | "inputs":[
1040 | {
1041 | "name":"_maxAffiliateFee",
1042 | "type":"uint256"
1043 | }
1044 | ],
1045 | "name":"setMaxAffiliateFee",
1046 | "outputs":[
1047 |
1048 | ],
1049 | "payable":false,
1050 | "stateMutability":"nonpayable",
1051 | "type":"function"
1052 | },
1053 | {
1054 | "constant":true,
1055 | "inputs":[
1056 |
1057 | ],
1058 | "name":"NON_STANDARD_TOKEN_REGISTRY",
1059 | "outputs":[
1060 | {
1061 | "name":"",
1062 | "type":"bytes32"
1063 | }
1064 | ],
1065 | "payable":false,
1066 | "stateMutability":"view",
1067 | "type":"function"
1068 | },
1069 | {
1070 | "inputs":[
1071 | {
1072 | "name":"_registry",
1073 | "type":"address"
1074 | }
1075 | ],
1076 | "payable":false,
1077 | "stateMutability":"nonpayable",
1078 | "type":"constructor"
1079 | },
1080 | {
1081 | "anonymous":false,
1082 | "inputs":[
1083 | {
1084 | "indexed":true,
1085 | "name":"_prevOwner",
1086 | "type":"address"
1087 | },
1088 | {
1089 | "indexed":true,
1090 | "name":"_newOwner",
1091 | "type":"address"
1092 | }
1093 | ],
1094 | "name":"OwnerUpdate",
1095 | "type":"event"
1096 | }
1097 | ]
--------------------------------------------------------------------------------