Skip to content

Commit

Permalink
New asset GMC (GMCI30) (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipzeta authored Aug 28, 2024
1 parent 0135937 commit c289a74
Show file tree
Hide file tree
Showing 8 changed files with 294 additions and 201 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
Version changes are pinned to SDK releases.

## [1.43.0]

- New asset GMC. ([#415](https://github.com/zetamarkets/sdk/pull/415))

## [1.42.0]

- Skipped

## [1.41.0]

- Add self trade behaviour and PlacePerpOrderV5. ([#413](https://github.com/zetamarkets/sdk/pull/413))
- Add post-sign callback. ([#412](https://github.com/zetamarkets/sdk/pull/412))

## [1.40.0]

- Add versioned tx support for process transaction. ([#408](https://github.com/zetamarkets/sdk/pull/408))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zetamarkets/sdk",
"repository": "https://github.com/zetamarkets/sdk/",
"version": "1.41.0",
"version": "1.43.0",
"description": "Zeta SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
12 changes: 12 additions & 0 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function assetToName(asset: Asset): string | null {
if (asset == Asset.WIF) return "WIF";
if (asset == Asset.RNDR) return "RNDR";
if (asset == Asset.TNSR) return "TNSR";
if (asset == Asset.GMC) return "GMC";
if (asset == null) return null; // Some things, like clock callbacks, are for all assets and return asset=null
return "UNDEFINED";
}
Expand All @@ -88,6 +89,7 @@ export function nameToAsset(name: string): Asset {
if (name == "WIF") return Asset.WIF;
if (name == "RNDR") return Asset.RNDR;
if (name == "TNSR") return Asset.TNSR;
if (name == "GMC") return Asset.GMC;
return Asset.UNDEFINED;
}

Expand All @@ -113,6 +115,7 @@ export function toProgramAsset(asset: Asset): any {
if (asset == Asset.WIF) return { wif: {} };
if (asset == Asset.RNDR) return { rndr: {} };
if (asset == Asset.TNSR) return { tnsr: {} };
if (asset == Asset.GMC) return { gmc: {} };
return { undefined: {} };
}

Expand Down Expand Up @@ -168,6 +171,9 @@ export function fromProgramAsset(asset: any): Asset {
if (objectEquals(asset, { tnsr: {} })) {
return Asset.TNSR;
}
if (objectEquals(asset, { GMC: {} })) {
return Asset.GMC;
}
return Asset.UNDEFINED;
}

Expand Down Expand Up @@ -224,6 +230,9 @@ export function assetToIndex(asset: Asset): number {
case Asset.TNSR: {
return 16;
}
case Asset.GMC: {
return 17;
}
}
return 255; // Undefined is 255 onchain
}
Expand Down Expand Up @@ -281,6 +290,9 @@ export function indexToAsset(index: number): Asset {
case 16: {
return Asset.TNSR;
}
case 17: {
return Asset.GMC;
}
}
return Asset.UNDEFINED;
}
Expand Down
27 changes: 23 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum Asset {
WIF = "WIF",
RNDR = "RNDR",
TNSR = "TNSR",
GMC = "GMC",
UNDEFINED = "UNDEFINED",
}

Expand Down Expand Up @@ -83,6 +84,7 @@ export const FLEX_MINTS = {
[Asset.WIF]: new PublicKey("BgDrDxc75EqPTXPUTCFMnYVYPeWK3CimPz2LGw4egsYc"),
[Asset.RNDR]: new PublicKey("397Hd8iZXmzRf4jqCSuACtUUWeweYZRZ4DmgvVpMkHJf"),
[Asset.TNSR]: new PublicKey("58MFM7mjjYMc6GoK6QUu7HuUmsih8aL5MTHptPE29p8G"),
[Asset.GMC]: new PublicKey("wWmjLtKGmXqJnDFnyQtKX1ZNHoBs9JD6bVxNa47zJWr"),
},
devnet: {
[Asset.APT]: new PublicKey("FbfkphUHaAd7c27RqhzKBRAPX8T5AzFBH259sbGmNuvG"),
Expand All @@ -106,6 +108,7 @@ export const FLEX_MINTS = {
[Asset.WIF]: new PublicKey("7jCmRqJaJq5iojCwGqq5DdwUBYPhrpvJcgNZsFLM4Pd5"),
[Asset.RNDR]: new PublicKey("GSF4GTjWxacrQoVbf8PUcvCvMvZUzwXFEmb2Jso6XU5H"),
[Asset.TNSR]: new PublicKey("3bTWLSNoD95dP2SHq4diRz3ZTeDXmybTsjPUQzRpTCHR"),
[Asset.GMC]: new PublicKey("CoGwjBS8stc4HCwpa6xh55LmGRTPxPkNXDVc1qBjwa5"),
},
};

Expand Down Expand Up @@ -296,6 +299,8 @@ export const PYTHNET_PRICE_FEED_IDS = {
"0xab7347771135fc733f8f38db462ba085ed3309955f42554a14fa13e855ac0e2f",
[Asset.TNSR]:
"0x05ecd4597cd48fe13d6cc3596c62af4f9675aee06e2e0b94c06d8bee2b659e05",
[Asset.GMC]:
"0xb3bd2a89c026fe7873da91b39bf9347fdea24e5b588330b4899788cf48878133",
};

export const PYTH_PRICE_FEEDS = {
Expand All @@ -319,6 +324,7 @@ export const PYTH_PRICE_FEEDS = {
[Asset.WIF]: new PublicKey("Ae9pWfoS4jS8WFxMTApKHkmMaod171aRcekm1iFbsmoy"),
[Asset.RNDR]: new PublicKey("7DvNVeya3b6WqcxSzUZFW9CWdDayJoRYjnpg2HVbgv2h"),
[Asset.TNSR]: new PublicKey("2NVLHqPc1nhVYxb7nM5mjfXg26krgz8N2UKWtkJ7J77a"),
[Asset.GMC]: new PublicKey("3msDcvnV1csrwSetu98fZzoS3Nj2AXuQjjaGiTjSxPEg"),
},
devnet: {
[Asset.SOL]: new PublicKey("J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"),
Expand Down Expand Up @@ -351,6 +357,7 @@ export const PYTH_PRICE_FEEDS = {
[Asset.WIF]: new PublicKey("6B23K3tkb51vLZA14jcEQVCA1pfHptzEHFA93V5dYwbT"),
[Asset.RNDR]: new PublicKey("GbgH1oen3Ne1RY4LwDgh8kEeA1KywHvs5x8zsx6uNV5M"),
[Asset.TNSR]: new PublicKey("9TSGDwcPQX4JpAvZbu2Wp5b68wSYkQvHCvfeBjYcCyC"),
[Asset.GMC]: new PublicKey("GfvaqdmMFT6nmWrSjonR9wDx5tncRj8QPDmxRCtLKP89"),
},
};

Expand All @@ -375,8 +382,8 @@ export const ACTIVE_MARKETS = ACTIVE_EXPIRIES * PRODUCTS_PER_EXPIRY + 1; // +1 f
export const TOTAL_EXPIRIES = 5;
export const TOTAL_MARKETS = PRODUCTS_PER_EXPIRY * (TOTAL_EXPIRIES + 1);
export const PERP_INDEX = TOTAL_MARKETS - 1;
export const ACTIVE_PERP_MARKETS = 17;
export const UNUSED_PERP_MARKETS = 8;
export const ACTIVE_PERP_MARKETS = 18;
export const UNUSED_PERP_MARKETS = 7;

export const DEFAULT_EXCHANGE_POLL_INTERVAL = 10;
export const DEFAULT_MARKET_POLL_INTERVAL = 5;
Expand Down Expand Up @@ -535,8 +542,8 @@ export const STATIC_AND_PERPS_LUT: {
key: new PublicKey("LAZFv47awUnd9jHkv8XGKFvkUjHtbg64WxDiZqZHubz"),
state: {
deactivationSlot: BigInt("18446744073709551615"),
lastExtendedSlot: 272750852,
lastExtendedSlotStartIndex: 210,
lastExtendedSlot: 286114199,
lastExtendedSlotStartIndex: 227,
authority: new PublicKey("EwXPBSBUPqYDNA3dUVZ3nonFuaw3wGGJqEUTJbknDirH"),
addresses: [
new PublicKey("8eExPiLp47xbSDYkbuem4qnLUpbLTfZBeFuEJoh6EUr2"),
Expand Down Expand Up @@ -766,6 +773,18 @@ export const STATIC_AND_PERPS_LUT: {
new PublicKey("6B23K3tkb51vLZA14jcEQVCA1pfHptzEHFA93V5dYwbT"),
new PublicKey("GbgH1oen3Ne1RY4LwDgh8kEeA1KywHvs5x8zsx6uNV5M"),
new PublicKey("9TSGDwcPQX4JpAvZbu2Wp5b68wSYkQvHCvfeBjYcCyC"),
new PublicKey("GfvaqdmMFT6nmWrSjonR9wDx5tncRj8QPDmxRCtLKP89"),
new PublicKey("6o2AifckJtQnwwg8Ee82iFkpocGpJRr3pY9jM7zeNCH1"),
new PublicKey("CWY7nSGmkLAedL36cdc6cQYCdHGy9sUCV16vTNoupuw1"),
new PublicKey("9e1DZ5mKwUvFsGyBBuCh9DCJmwx72fpyDBsYo3gsGCwY"),
new PublicKey("6G5yk3YcJBWPM7SzZbhUsvhZLsEmonqTvc3FqQGdRA81"),
new PublicKey("2hFnuSe5wWvAu1kxwjNGngtLDXpUWiVpc7UvbNTTkZtg"),
new PublicKey("9ySay4rVbFDDffUHQrCfkq6WcK4oWdxyfquFcunxxbcR"),
new PublicKey("GdeTNiTU4sh5a3KAUPMgcVQkU7XQFNQyqQh4EE1KsMAT"),
new PublicKey("6cAKFTvynML7tR8LLQ1u2UwPorc7TibdvdqjouLquSwD"),
new PublicKey("CJESiofGZkrKmVYYR2DCtfxAj2h1jdT9oV6EsdfbYZjr"),
new PublicKey("6ZfjZUd2pgmcevfL6aLTGzpTsLoNyi8pxuboDUnrVf23"),
new PublicKey("5xt8uuStpThtSX1PqHeiJuWtXZFpnkrrTtHDK1srXuL8"),
],
},
}),
Expand Down
Loading

0 comments on commit c289a74

Please sign in to comment.