Skip to content

Commit

Permalink
Merge branch 'development' into fix/osmosis-amm-lp
Browse files Browse the repository at this point in the history
  • Loading branch information
mlguys committed Jul 11, 2024
2 parents 78e6981 + 22fbbe0 commit 646459a
Show file tree
Hide file tree
Showing 21 changed files with 1,271 additions and 19 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hummingbot-gateway",
"version": "dev-1.27.0",
"version": "dev-2.0.1",
"description": "Middleware that helps Hummingbot clients access standardized DEX API endpoints on different blockchain networks",
"main": "index.js",
"license": "Apache-2.0",
Expand All @@ -24,6 +24,7 @@
},
"dependencies": {
"@cosmjs/amino": "^0.32.2",
"@balancer-labs/sdk": "^1.1.5",
"@bancor/carbon-sdk": "^0.0.93-DEV",
"@cosmjs/proto-signing": "^0.31.1",
"@cosmjs/stargate": "^0.31.1",
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="dev-1.27.0"
const gateway_version="dev-2.0.1"
if (!ConfigManagerV2.getInstance().get('server.id')) {
ConfigManagerV2.getInstance().set(
'server.id',
Expand Down
3 changes: 3 additions & 0 deletions src/chains/avalanche/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { SushiswapConfig } from '../../connectors/sushiswap/sushiswap.config';
import { ConfigManagerV2 } from '../../services/config-manager-v2';
import { EVMController } from '../ethereum/evm.controllers';
import { Curve } from '../../connectors/curve/curve';
import { BalancerConfig } from '../../connectors/balancer/balancer.config';

export class Avalanche extends EthereumBase implements Ethereumish {
private static _instances: { [name: string]: Avalanche };
Expand Down Expand Up @@ -101,6 +102,8 @@ export class Avalanche extends EthereumBase implements Ethereumish {
throw Error('Curve not ready');
}
spender = curve.router;
} else if (reqSpender === 'balancer') {
spender = BalancerConfig.config.routerAddress(this._chain);
} else {
spender = reqSpender;
}
Expand Down
1 change: 1 addition & 0 deletions src/chains/avalanche/avalanche.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const validateSpender: Validator = mkValidator(
val === 'traderjoe' ||
val === 'openocean' ||
val === 'sushiswap' ||
val === 'balancer' ||
isAddress(val))
);

Expand Down
3 changes: 3 additions & 0 deletions src/chains/ethereum/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { SushiswapConfig } from '../../connectors/sushiswap/sushiswap.config';
import { OpenoceanConfig } from '../../connectors/openocean/openocean.config';
import { Curve } from '../../connectors/curve/curve';
import { CarbonConfig } from '../../connectors/carbon/carbon.config';
import { BalancerConfig } from '../../connectors/balancer/balancer.config';

// MKR does not match the ERC20 perfectly so we need to use a separate ABI.
const MKR_ADDRESS = '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2';
Expand Down Expand Up @@ -217,6 +218,8 @@ export class Ethereum extends EthereumBase implements Ethereumish {
throw Error('Curve not ready');
}
spender = curve.router;
} else if (reqSpender === 'balancer') {
spender = BalancerConfig.config.routerAddress(this._chain);
} else {
spender = reqSpender;
}
Expand Down
1 change: 1 addition & 0 deletions src/chains/ethereum/ethereum.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const validateSpender: Validator = mkValidator(
val === 'xsswap' ||
val === 'curve' ||
val === 'carbonamm' ||
val === 'balancer' ||
isAddress(val))
);

Expand Down
3 changes: 3 additions & 0 deletions src/chains/polygon/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ConfigManagerV2 } from '../../services/config-manager-v2';
import { OpenoceanConfig } from '../../connectors/openocean/openocean.config';
import { EVMController } from '../ethereum/evm.controllers';
import { Curve } from '../../connectors/curve/curve';
import { BalancerConfig } from '../../connectors/balancer/balancer.config';

export class Polygon extends EthereumBase implements Ethereumish {
private static _instances: { [name: string]: Polygon };
Expand Down Expand Up @@ -94,6 +95,8 @@ export class Polygon extends EthereumBase implements Ethereumish {
throw Error('Curve not ready');
}
spender = curve.router;
} else if (reqSpender === 'balancer') {
spender = BalancerConfig.config.routerAddress(this._chain);
} else {
spender = reqSpender;
}
Expand Down
1 change: 1 addition & 0 deletions src/chains/polygon/polygon.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const validateSpender: Validator = mkValidator(
val === 'sushi' ||
val === 'quickswap' ||
val === 'openocean' ||
val === 'balancer' ||
isAddress(val))
);

Expand Down
23 changes: 23 additions & 0 deletions src/connectors/balancer/balancer.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { buildConfig, NetworkConfig } from '../../network/network.utils';

export namespace BalancerConfig {
export const config: NetworkConfig = buildConfig(
'balancer',
['AMM'],
[
{
chain: 'avalanche',
networks: ['avalanche'],
},
{
chain: 'ethereum',
networks: ['mainnet', 'arbitrum', 'optimism'],
},
{
chain: 'polygon',
networks: ['mainnet'],
},
],
'EVM'
);
}
Loading

0 comments on commit 646459a

Please sign in to comment.