Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Update Orca Swap Program Id, Fix Bugs & Remove stable-curve pools (#33)
Browse files Browse the repository at this point in the history
* Remove stable pool config since we don't support it yet
* update orca swap programId
* Pass null as hostFeeAccount

Co-authored-by: Yutaro Mori <me@yutaromori.com>
  • Loading branch information
odcheung and Yutaro Mori authored Aug 19, 2021
1 parent 423dc17 commit dd1ac4c
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 271 deletions.
26 changes: 0 additions & 26 deletions src/constants/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,31 +382,6 @@ export const mapsSolPool: OrcaPoolParams = Object.freeze({
},
});

export const usdcUsdtPool: OrcaPoolParams = Object.freeze({
address: new PublicKey("F13xvvx45jVGd84ynK3c8T89UejQVxjCLtmHfPmAXAHP"),
nonce: 255,
authority: new PublicKey("3cGHDS8uWhdxQj14vTmFtYHX3NMouPpE4o9MjQ43Bbf4"),
poolTokenMint: new PublicKey("H2uzgruPvonVpCRhwwdukcpXK8TG17swFNzYFr2rtPxy"),
poolTokenDecimals: 6,
feeAccount: new PublicKey("B4RNxMJGRzKFQyTq2Uwkmpyjtew13n7KtdqZy6qgENTu"),
tokenIds: [Tokens.usdcToken.mint.toString(), Tokens.usdtToken.mint.toString()],
tokens: {
[Tokens.usdcToken.mint.toString()]: {
...Tokens.usdcToken,
addr: new PublicKey("6uUn2okWk5v4x9Gc4n2LLGHtWoa9tmizHq1363dW7t9W"),
},
[Tokens.usdtToken.mint.toString()]: {
...Tokens.usdtToken,
addr: new PublicKey("AiwmnLy7xPT28dqZpkRm6i1ZGwELUCzCsuN92v4JkSeU"),
},
},
curveType: CurveType.Stable,
feeStructure: {
traderFee: Percentage.fromFraction(6, 10000),
ownerFee: Percentage.fromFraction(1, 10000),
},
});

export const orcaSolPool: OrcaPoolParams = Object.freeze({
address: new PublicKey("2ZnVuidTHpi5WWKUwFXauYGhvdT9jRKYv5MDahtbwtYr"),
nonce: 255,
Expand Down Expand Up @@ -552,7 +527,6 @@ export const orcaPoolConfigs: Record<string, OrcaPoolParams> = {
HiwRobjfHZ4zsPtqCC4oBS24pSmy4t8GGkXRbQj4yU6L: merSolPool,
EYsNdtyu4gGTaGz8N5m5iQ3G1N6rDyMbR72B3CqbWW4W: fidaSolPool,
"99pfC8fWymXgbq3CvrExhx3UxQDC1fMWEWLbNT83F45e": mapsSolPool,
H2uzgruPvonVpCRhwwdukcpXK8TG17swFNzYFr2rtPxy: usdcUsdtPool,
"2uVjAuRXavpM6h1scGQaxqb6HVaNRn6T2X7HHXTabz25": orcaSolPool,
n8Mpu28RjeYD7oUX3LG1tPxzhRZh3YYLRSHcHRdS3Zx: orcaUsdcPool,
HEvnD66WcBfTajS9adUYnGRBMDehFtLySiFHSD6kEBWs: kinSolPool,
Expand Down
1 change: 1 addition & 0 deletions src/model/orca/pool/orca-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export class OrcaPoolImpl implements OrcaPool {
inputPoolToken.mint,
amountInU64
);

const { address: outputPoolTokenUserAddress, ...resolveOutputAddrInstructions } =
await resolveOrCreateAssociatedTokenAddress(
this.connection,
Expand Down
1 change: 0 additions & 1 deletion src/public/pools/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export enum OrcaPoolConfig {
MER_SOL = "HiwRobjfHZ4zsPtqCC4oBS24pSmy4t8GGkXRbQj4yU6L",
FIDA_SOL = "EYsNdtyu4gGTaGz8N5m5iQ3G1N6rDyMbR72B3CqbWW4W",
MAPS_SOL = "99pfC8fWymXgbq3CvrExhx3UxQDC1fMWEWLbNT83F45e",
USDC_USDT = "H2uzgruPvonVpCRhwwdukcpXK8TG17swFNzYFr2rtPxy",
ORCA_SOL = "2uVjAuRXavpM6h1scGQaxqb6HVaNRn6T2X7HHXTabz25",
ORCA_USDC = "n8Mpu28RjeYD7oUX3LG1tPxzhRZh3YYLRSHcHRdS3Zx",
KIN_SOL = "HEvnD66WcBfTajS9adUYnGRBMDehFtLySiFHSD6kEBWs",
Expand Down
2 changes: 1 addition & 1 deletion src/public/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PublicKey } from "@solana/web3.js";

export const ORCA_TOKEN_SWAP_ID: PublicKey = new PublicKey(
"DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1"
"9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP"
);

export const SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID: PublicKey = new PublicKey(
Expand Down
2 changes: 1 addition & 1 deletion src/public/utils/web3/instructions/pool-instructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const createSwapInstruction = async (
outputTokenUserAddress,
poolParams.poolTokenMint,
poolParams.feeAccount,
owner.publicKey,
null,
ORCA_TOKEN_SWAP_ID,
TOKEN_PROGRAM_ID,
amountInU64,
Expand Down
Loading

0 comments on commit dd1ac4c

Please sign in to comment.