Skip to content

Commit

Permalink
(wip) skeleton running
Browse files Browse the repository at this point in the history
  • Loading branch information
fengtality committed Aug 21, 2024
1 parent 10db292 commit a862249
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 29 deletions.
7 changes: 7 additions & 0 deletions src/connectors/connectors.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { KujiraConfig } from './kujira/kujira.config';
import { OsmosisConfig } from '../chains/osmosis/osmosis.config';
import { CarbonConfig } from './carbon/carbon.config';
import { BalancerConfig } from './balancer/balancer.config';
import { OrcaConfig } from './orca/orca.config';

export namespace ConnectorsRoutes {
export const router = Router();
Expand Down Expand Up @@ -183,6 +184,12 @@ export namespace ConnectorsRoutes {
chain_type: BalancerConfig.config.chainType,
available_networks: BalancerConfig.config.availableNetworks,
},
{
name: 'orca',
trading_type: OrcaConfig.config.tradingTypes('LP'),
chain_type: OrcaConfig.config.chainType,
available_networks: OrcaConfig.config.availableNetworks,
},
],
});
})
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/orca/orca.lp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Orca implements OrcaLPish {
// private tokenList: TokenInfo[] = [];

private constructor(chain: string, network: string) {
this._whirlpoolsConfig = OrcaConfig.config.whirlpoolsConfig(network);
this._whirlpoolsConfig = OrcaConfig.config.routerAddress(network);
if (chain === 'solana') {
this.chain = Solana.getInstance(network);
} else {
Expand Down
9 changes: 8 additions & 1 deletion src/services/connection-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
UniswapLPish,
Xdcish,
Tezosish,
OrcaLPish,
} from './common-interfaces';
import { Traderjoe } from '../connectors/traderjoe/traderjoe';
import { Sushiswap } from '../connectors/sushiswap/sushiswap';
Expand All @@ -48,6 +49,7 @@ import { PancakeswapLP } from '../connectors/pancakeswap/pancakeswap.lp';
import { XRPLCLOB } from '../connectors/xrpl/xrpl';
import { Carbonamm } from '../connectors/carbon/carbonAMM';
import { Balancer } from '../connectors/balancer/balancer';
import { Orca } from '../connectors/orca/orca.lp';

export type ChainUnion =
| Algorand
Expand Down Expand Up @@ -170,6 +172,7 @@ export type ConnectorUnion =
| XRPLCLOB
| Curve
| KujiraCLOB
| OrcaLPish

export type Connector<T> = T extends Uniswapish
? Uniswapish
Expand All @@ -189,7 +192,9 @@ export type Connector<T> = T extends Uniswapish
? XRPLCLOB
: T extends KujiraCLOB
? KujiraCLOB
: never;
: T extends OrcaLPish
? OrcaLPish
: never;

export async function getConnector<T>(
chain: string,
Expand Down Expand Up @@ -243,6 +248,8 @@ export async function getConnector<T>(
connectorInstance = Tinyman.getInstance(network);
} else if (connector === 'plenty') {
connectorInstance = Plenty.getInstance(network);
} else if (connector === 'orca') {
connectorInstance = Orca.getInstance(chain, network);
} else {
throw new Error('unsupported chain or connector');
}
Expand Down
45 changes: 22 additions & 23 deletions src/services/schema/orca-schema.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"allowedSlippage": { "type": "string" },
"contractAddresses": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"type": "object",
"properties": {
"whirlpoolsConfig": { "type": "string" }
},
"required": ["whirlpoolsConfig"],
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": ["allowedSlippage", "contractAddresses"]
}

"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"allowedSlippage": { "type": "string" },
"contractAddresses": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"type": "object",
"properties": {
"routerAddress": { "type": "string" }
},
"required": ["routerAddress"],
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": ["allowedSlippage", "contractAddresses"]
}
6 changes: 3 additions & 3 deletions src/templates/orca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
allowedSlippage: '1/100'

contractAddresses:
mainnet-beta:
whirlpoolsConfig: '0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106'
mainnet:
routerAddress: '0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106'
devnet:
whirlpoolsConfig: '0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106'
routerAddress: '0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106'
5 changes: 5 additions & 0 deletions src/templates/root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ configurations:
$namespace solana:
configurationPath: solana.yml
schemaPath: solana-schema.json

$namespace telos:
configurationPath: telos.yml
schemaPath: ethereum-schema.json

$namespace orca:
configurationPath: orca.yml
schemaPath: orca-schema.json
2 changes: 1 addition & 1 deletion src/templates/solana.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
networks:
mainnet-beta:
mainnet:
nodeURL: https://api.mainnet-beta.solana.com
tokenListType: 'FILE'
tokenListSource: '/home/gateway/conf/lists/solflare-tokenlist.json'
Expand Down

0 comments on commit a862249

Please sign in to comment.