Skip to content
This repository was archived by the owner on Feb 25, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b1001d3
(feat) standard endpoints & consolidate protocol library functions
Jan 30, 2021
94b10fa
(fix) incorrect key param name. add request logging to console
Feb 1, 2021
5c22b1a
(fix) Uniswap return json key name as info
Feb 1, 2021
895a6b8
(fix) Incorrect request param key name for wallet
Feb 1, 2021
61cc2bc
(feat) Add cache pool refresh timer. Fix Uniswap update token pools
Feb 2, 2021
9b1816a
Default max swap to 4 if not configured. Comment out `get-weth` test …
Feb 4, 2021
9c572ff
(feat) Add fee retrieval from ethgastation base-on .env interval
Feb 9, 2021
c0fca11
Add eth gas station param to .env.example
Feb 9, 2021
76ba980
(feat) Retrieve ERC20 token list from external source specific in .env
Feb 10, 2021
e938c53
Remove static mainnet erc20 token list file
Feb 10, 2021
26dbeb8
(fix) Remove Winston rejection transport & use handleRejections config
Feb 17, 2021
1516337
Consolidate logging into info
Feb 20, 2021
5abfb87
(feat) Move exchange proxy & other parameters into .env
Feb 25, 2021
21fdada
(fix) Uppercase for buy / sell param
Mar 1, 2021
8791030
(feat) Add gas price, limit, cost info to response json data
Mar 2, 2021
aa15575
(fix) Uniswap no pool response as error instead of info
Mar 3, 2021
0a40ecd
(feat) check for valid token symbols else return error 500
Mar 7, 2021
2a504a8
Merge branch 'development' into feat/optimize_protocol_endpoints
Mar 9, 2021
a1f72ce
(feat) Convert proper value for eth gas station set in .env
Mar 10, 2021
36797e0
Remove unnecessary uniswap pool update in `/start` endpoint
Mar 12, 2021
aec0f15
(feat) Add Perpetual Finance provider url overwrite
Mar 13, 2021
54c33ee
Update balancer on-chain balance on price lookup
Mar 14, 2021
9ceb1c8
Update spender when Uniswap is being used.
vic-en Mar 16, 2021
2fb292e
(refactor) make start endpoint to only initiate pool/path and not han…
vic-en Mar 18, 2021
c70b37c
(feat) optimize Uniswap connector
vic-en Mar 23, 2021
6f4051b
Merge branch 'feat/optimize_uniswap' into feat/optimize_protocol_endp…
Mar 24, 2021
9cbba7d
(fix) incorrect token update function name
Mar 24, 2021
f3a8c65
(fix) revert Uniswap, Balancer start endpoint to GET
Mar 24, 2021
6584298
Merge pull request #48 from CoinAlpha/feat/optimize_uniswap
dennisocana Mar 29, 2021
e354cbe
Merge branch 'development' of https://github.com/CoinAlpha/gateway-ap…
vic-en Mar 29, 2021
95fcfcd
(feat) allow decimal values for uniswap slippage
vic-en Mar 29, 2021
2d8feb0
(fix) incorrect mathjs module in package.json
Mar 30, 2021
c54af16
Add uniswap slippage example using decimal value
Mar 31, 2021
bf7cc08
Merge pull request #37 from CoinAlpha/feat/optimize_protocol_endpoints
vic-en Mar 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ TERRA_CHAIN={testnet_chain_id}
# Ethereum
# - chain: mainnet, kovan, etc
# - rpc url: infura or other rpc url
# - token list: erc20 token list source (ref: https://tokenlists.org/)
ETHEREUM_CHAIN={chain}
ETHEREUM_RPC_URL=https://{chain}.infura.io/v3/{api_key}
ETHEREUM_TOKEN_LIST_URL=https://wispy-bird-88a7.uniswap.workers.dev/?url=http://tokens.1inch.eth.link

# Balancer
# subgraph_chain
Expand All @@ -41,7 +43,15 @@ EXCHANGE_PROXY={exchange_proxy}

# Uniswap
# Reference: https://uniswap.org/docs/v2/smart-contracts/router02/
# UniswapV2Router02 is deployed at 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D on the Ethereum mainnet, and the Ropsten, Rinkeby, Görli, and Kovan testnets.
# It was built from commit 6961711.
UNISWAP_ROUTER=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
# allowed slippage for swap transactions
UNISWAP_ALLOWED_SLIPPAGE=1.5
# restrict updating pairs that have no reserves or failed for 5 minutes
UNISWAP_NO_RESERVE_CHECK_INTERVAL=300000
# cache info about pair for 1 second
UNISWAP_PAIRS_CACHE_TIME=1000

# cert
CERT_PATH={full_path_to_certs_folder}
Expand All @@ -51,5 +61,23 @@ CERT_PASSPHRASE={passphrase}
# default to ./logs if path is not set
LOG_PATH=/Users/hbot/hummingbot_files/hummingbot_logs

# GMT offset
GMT_OFFSET=-0800
# GMT offset for logging (alpine docker image default to UTC timezone)
# -0800, -0500, +0200, +0800
GMT_OFFSET=+0800

# EthGasStation
# API key for defipulse.com gas station API
# Gas level you want to use for Ethereum transactions (fast, fastest, safeLow, average)
ENABLE_ETH_GAS_STATION=true
ETH_GAS_STATION_API_KEY={apikey}
ETH_GAS_STATION_GAS_LEVEL=fast
ETH_GAS_STATION_REFRESH_TIME=60
MANUAL_GAS_PRICE=100

# Balancer Config
BALANCER_MAX_SWAPS=4


# Perpetual Finance Provider URL
# default: https://dai.poa.network , https://rpc.xdaichain.com, etc
XDAI_PROVIDER={providerUrl}
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ RUN apk add --no-cache tzdata

# Set labels
LABEL application="gateway-api"
LABEL branch=${BRANCH}
LABEL commit=${COMMIT}
LABEL date=${BUILD_DATE}

# Set ENV variables
ENV COMMIT_BRANCH=${BRANCH}
ENV COMMIT_SHA=${COMMIT}
ENV BUILD_DATE=${DATE}

# app directory
WORKDIR /usr/src/app
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@perp/contract": "^1.0.6",
"@balancer-labs/sor": "^0.3.3",
"@perp/contract": "^1.0.6",
"@terra-money/terra.js": "^0.5.8",
"@uniswap/sdk": "^3.0.3",
"app-root-path": "^3.0.0",
"axios": "^0.21.1",
"bignumber.js": "^9.0.0",
"body-parser": "^1.19.0",
"capture-console": "^1.0.1",
"cross-fetch": "^3.0.6",
"debug": "^4.2.0",
"dotenv": "^8.2.0",
"ethers": "^5.0.14",
Expand All @@ -29,11 +30,11 @@
"helmet": "^4.1.1",
"http-status-codes": "^2.1.3",
"lodash": "^4.17.20",
"mathjs": "^9.3.0",
"moment": "^2.29.1",
"util": "^0.12.3",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.0",
"cross-fetch": "^3.0.6"
"winston-daily-rotate-file": "^4.5.0"
},
"devDependencies": {
"@babel/core": "^7.11.6",
Expand All @@ -47,5 +48,8 @@
"eslint-plugin-standard": "^4.0.1",
"nodemon": "^2.0.4"
},
"engines": {
"node": "10.x"
},
"type": "module"
}
8 changes: 4 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ app.use(bodyParser.urlencoded({ extended: true }));

app.use(validateAccess)

// mount all routes to this path
app.use('/uniswap', uniswapRoutes);
// mount routes to specific path
app.use('/api', apiRoutes);
app.use('/eth', ethRoutes);
// app.use('/celo', celoRoutes);
app.use('/eth/uniswap', uniswapRoutes);
app.use('/eth/balancer', balancerRoutes);
app.use('/terra', terraRoutes);
app.use('/balancer', balancerRoutes);
app.use('/perpfi', perpFiRoutes);
// app.use('/celo', celoRoutes);

app.get('/', (req, res, next) => {
res.send('ok')
Expand Down
Loading