Skip to content

Commit

Permalink
Merge pull request #269 from hummingbot/development
Browse files Browse the repository at this point in the history
sync / development -> staging for Hummingbot version 1.24.0
  • Loading branch information
nikspz authored Jan 22, 2024
2 parents 6923d45 + b81b9c7 commit d14deef
Show file tree
Hide file tree
Showing 40 changed files with 4,038 additions and 196 deletions.
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hummingbot-gateway",
"version": "1.23.0",
"version": "dev-1.24.0",
"description": "Middleware that helps Hummingbot clients access standardized DEX API endpoints on different blockchain networks",
"main": "index.js",
"license": "Apache-2.0",
Expand Down Expand Up @@ -32,12 +32,14 @@
"@ethersproject/networks": "5.7.0",
"@ethersproject/providers": "5.7.0",
"@ethersproject/solidity": "5.7.0",
"@injectivelabs/sdk-ts": "^1.10.58",
"@harmony-js/core": "^0.1.57",
"@harmony-js/utils": "^0.1.56",
"@improbable-eng/grpc-web": "^0.13.0",
"@pancakeswap/sdk": "^2.4.5",
"@injectivelabs/sdk-ts": "^1.10.58",
"@pancakeswap/sdk": "^4.0.0",
"@pancakeswap/smart-router": "^4.2.1",
"@pancakeswap/swap-sdk-core": "^1.0.0",
"@pancakeswap/tokens": "^0.1.6",
"@pancakeswap/v3-core": "^1.0.2",
"@pancakeswap/v3-periphery": "^1.0.2",
"@pancakeswap/v3-sdk": "^3.7.0",
Expand Down Expand Up @@ -77,6 +79,7 @@
"express": "^4.17.1",
"express-winston": "^4.1.0",
"fs-extra": "^10.0.0",
"graphql-request": "^6.1.0",
"http-status-codes": "2.2.0",
"immutable": "^4.2.4",
"js-yaml": "^4.1.0",
Expand All @@ -90,15 +93,17 @@
"near-api-js": "1.0.0",
"promise-retry": "^2.0.1",
"quickswap-sdk": "^3.0.8",
"quipuswap-v3-sdk": "^0.0.7",
"swagger-ui-express": "^4.1.6",
"swap-router-sdk": "^1.21.1",
"tslib": "^2.3.1",
"uuid": "^8.3.2",
"vvs-sdk": "^2.4.0",
"web3": "^1.7.3",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.5",
"xsswap-sdk": "^1.0.1",
"xrpl": "^2.7.0",
"xsswap-sdk": "^1.0.1",
"yarn": "^1.22.17"
},
"devDependencies": {
Expand Down
24 changes: 18 additions & 6 deletions src/amm/amm.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ import {
trade as plentyTrade,
estimateGas as plentyEstimateGas,
} from '../connectors/plenty/plenty.controllers';
import {
price as quipuPrice,
trade as quipuTrade,
estimateGas as quipuEstimateGas,
} from '../connectors/quipuswap/quipuswap.controllers';
import {
getInitializedChain,
getConnector,
Expand All @@ -75,20 +80,23 @@ import {
import { Algorand } from '../chains/algorand/algorand';
import { Tinyman } from '../connectors/tinyman/tinyman';
import { Plenty } from '../connectors/plenty/plenty';
import { QuipuSwap } from '../connectors/quipuswap/quipuswap';

export async function price(req: PriceRequest): Promise<PriceResponse> {
const chain = await getInitializedChain<
Algorand | Ethereumish | Nearish | Tezosish
>(req.chain, req.network);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty =
await getConnector<Uniswapish | RefAMMish | Tinyman | Plenty>(
const connector: Uniswapish | RefAMMish | Tinyman | Plenty | QuipuSwap =
await getConnector<Uniswapish | RefAMMish | Tinyman | Plenty | QuipuSwap>(
req.chain,
req.network,
req.connector
);

if (connector instanceof Plenty) {
return plentyPrice(<Tezosish>chain, connector, req);
} else if (connector instanceof QuipuSwap) {
return quipuPrice(<Tezosish>chain, connector, req);
} else if ('routerAbi' in connector) {
// we currently use the presence of routerAbi to distinguish Uniswapish from RefAMMish
return uniswapPrice(<Ethereumish>chain, connector, req);
Expand All @@ -103,15 +111,17 @@ export async function trade(req: TradeRequest): Promise<TradeResponse> {
const chain = await getInitializedChain<
Algorand | Ethereumish | Nearish | Tezosish
>(req.chain, req.network);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty =
await getConnector<Uniswapish | RefAMMish | Tinyman | Plenty>(
const connector: Uniswapish | RefAMMish | Tinyman | Plenty | QuipuSwap =
await getConnector<Uniswapish | RefAMMish | Tinyman | Plenty | QuipuSwap>(
req.chain,
req.network,
req.connector
);

if (connector instanceof Plenty) {
return plentyTrade(<Tezosish>chain, connector, req);
} else if (connector instanceof QuipuSwap) {
return quipuTrade(<Tezosish>chain, connector, req);
} else if ('routerAbi' in connector) {
// we currently use the presence of routerAbi to distinguish Uniswapish from RefAMMish
return uniswapTrade(<Ethereumish>chain, connector, req);
Expand Down Expand Up @@ -190,15 +200,17 @@ export async function estimateGas(
const chain = await getInitializedChain<
Algorand | Ethereumish | Nearish | Tezosish
>(req.chain, req.network);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty =
await getConnector<Uniswapish | RefAMMish | Plenty>(
const connector: Uniswapish | RefAMMish | Tinyman | Plenty | QuipuSwap =
await getConnector<Uniswapish | RefAMMish | Plenty | QuipuSwap>(
req.chain,
req.network,
req.connector
);

if (connector instanceof Plenty) {
return plentyEstimateGas(<Tezosish>chain, connector);
} else if (connector instanceof QuipuSwap) {
return quipuEstimateGas(<Tezosish>chain, connector);
} else if ('routerAbi' in connector) {
// we currently use the presence of routerAbi to distinguish Uniswapish from RefAMMish
return uniswapEstimateGas(<Ethereumish>chain, connector);
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const startSwagger = async () => {

export const startGateway = async () => {
const port = ConfigManagerV2.getInstance().get('server.port');
const gateway_version="1.23.0"; // gateway version
const gateway_version="dev-1.24.0"; // gateway version
if (!ConfigManagerV2.getInstance().get('server.id')) {
ConfigManagerV2.getInstance().set(
'server.id',
Expand Down
3 changes: 3 additions & 0 deletions src/chains/tezos/tezos.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ export class TezosBase {
if (spender === 'plenty') {
// plenty doesn't need an allowance
return { value: constants.MaxUint256, decimals: tokenDecimals };
} else if (spender === 'quipuswap') {
// quipuswap doesn't need an allowance
return { value: constants.MaxUint256, decimals: tokenDecimals };
}

let value = BigNumber.from(0);
Expand Down
7 changes: 7 additions & 0 deletions src/connectors/connectors.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { CurveConfig } from './curve/curveswap.config';
import { PlentyConfig } from './plenty/plenty.config';
import { XRPLCLOBConfig } from './xrpl/xrpl.clob.config';
import { KujiraConfig } from './kujira/kujira.config';
import { QuipuswapConfig } from './quipuswap/quipuswap.config';

export namespace ConnectorsRoutes {
export const router = Router();
Expand Down Expand Up @@ -162,6 +163,12 @@ export namespace ConnectorsRoutes {
'Enter your kujira account number (input 0 if unsure) >>> ',
},
},
{
name: 'quipuswap',
trading_type: QuipuswapConfig.config.tradingTypes,
chain_type: QuipuswapConfig.config.chainType,
available_networks: QuipuswapConfig.config.availableNetworks,
}
],
});
})
Expand Down
Loading

0 comments on commit d14deef

Please sign in to comment.