Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/ balancer connector #280

Merged
merged 27 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2c44665
(feat) re-added changes from #130
fengtality Jul 25, 2023
d17710a
Merge branch 'development' into feat/balancer-connector
rapcmia Aug 2, 2023
ba9950c
Merge branch 'development' into feat/balancer-connector
nikspz Aug 14, 2023
9bcad26
add balancer connector with unit tests
vic-en Feb 12, 2024
eff70a7
Merge branch 'development' into feat/balancer
vic-en Feb 18, 2024
c0604e4
Merge branch 'development' into feat/balancer
nikspz Feb 22, 2024
fdc4598
Merge branch 'development' into feat/balancer
nikspz Feb 28, 2024
7c6c6f1
Merge branch 'development' into feat/balancer
vic-en Mar 8, 2024
18a5a4d
Merge branch 'development' of https://github.com/hummingbot/gateway i…
vic-en Apr 7, 2024
9aef95c
wqMerge branch 'development' of https://github.com/hummingbot/gateway…
vic-en Apr 12, 2024
e468d67
Merge branch 'feat/balancer' of https://github.com/vic-en/gateway int…
vic-en Apr 12, 2024
4ae4274
Merge branch 'development' into feat/balancer
nikspz Apr 15, 2024
2e1745e
branch conflict fix
vic-en Apr 15, 2024
77727e4
Merge branch 'feat/balancer' of https://github.com/vic-en/gateway int…
vic-en Apr 15, 2024
e2c9da6
update balancer
vic-en Apr 15, 2024
7c6da0e
yarn lock update
vic-en Apr 15, 2024
3fcfc89
yarn lock update
vic-en Apr 15, 2024
65f4d94
Merge branch 'development' into feat/balancer
fengtality Apr 18, 2024
c33d1b0
add avalanche support
vic-en Apr 22, 2024
59f0d03
Merge branch 'feat/balancer' of https://github.com/vic-en/gateway int…
vic-en Apr 22, 2024
07bd1cb
price update
vic-en May 8, 2024
59968d9
Merge branch 'development' into feat/balancer
nikspz May 17, 2024
00ec985
uniswap acks poolId when supplied
vic-en May 20, 2024
5fbdaae
Merge branch 'feat/balancer' of https://github.com/vic-en/gateway int…
vic-en May 20, 2024
a6e94a2
Merge branch 'development' into feat/balancer
nikspz May 20, 2024
58c0055
update trade
vic-en May 28, 2024
8384e51
Merge branch 'feat/balancer' of https://github.com/vic-en/gateway int…
vic-en May 28, 2024
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Loading