Skip to content

Commit

Permalink
Add support for BSC
Browse files Browse the repository at this point in the history
Made the main token addresses configurable
  • Loading branch information
valo committed Feb 8, 2021
1 parent 7e6b473 commit d05da60
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ __pycache__
reports
Dockerfile
heroku.yml
.env
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ WORKDIR /app

RUN pip install -r requirements.txt

ENV HOME /app

COPY ./network-config.yaml $HOME/.brownie/network-config.yaml

COPY . /app

RUN brownie compile
Expand Down
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os
from brownie import project, network
p = project.load()
network.connect("mainnet")
network.connect(os.environ.get('NETWORK', 'mainnet'))
sys.modules["brownie"].interface = p.interface

from scripts.utils import priceOf, priceOf1InchPair, priceOfUniPair
Expand Down
25 changes: 25 additions & 0 deletions network-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
live:
- name: Ethereum
networks:
- chainid: 1
explorer: https://api.etherscan.io/api
host: https://mainnet.infura.io/v3/$WEB3_INFURA_PROJECT_ID
id: mainnet
name: Mainnet (Infura)
- name: BSC
networks:
- chainid: 56
host: $BSC_RPC_ENDPOINT
id: bsc-mainnet
name: bsc-mainnet
development:
- cmd: ganache-cli
cmd_settings:
accounts: 10
evm_version: istanbul
gas_limit: 12000000
mnemonic: brownie
port: 8545
host: http://127.0.0.1
id: development
name: Ganache-CLI
9 changes: 5 additions & 4 deletions scripts/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
from brownie import interface
from brownie.exceptions import ContractNotFound
from datetime import datetime, timedelta
from functools import lru_cache

DAI = interface.IERC20("0x6b175474e89094c44da98b954eedeac495271d0f")
WETH = interface.IERC20("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2")
USDT = interface.IERC20("0xdac17f958d2ee523a2206206994597c13d831ec7")
USDC = interface.IERC20("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48")
DAI = interface.IERC20(os.environ.get('DAI_ADDRESS', "0x6b175474e89094c44da98b954eedeac495271d0f"))
WETH = interface.IERC20(os.environ.get('WETH_ADDRESS', "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"))
USDT = interface.IERC20(os.environ.get('USDT_ADDRESS', "0xdac17f958d2ee523a2206206994597c13d831ec7"))
USDC = interface.IERC20(os.environ.get('USDC_ADDRESS', "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"))

@lru_cache
def getFactory(router):
Expand Down

0 comments on commit d05da60

Please sign in to comment.