This commit is contained in:
Adrian Brzeziński 2023-10-02 14:10:50 +02:00
parent c56cac9040
commit 52683ba754
2 changed files with 12 additions and 2 deletions

View File

@ -32,7 +32,7 @@ declare const PREMIUM_LISTING: {
reduceOnly: number;
};
export type ListingPreset = typeof PREMIUM_LISTING;
export type LISTING_PRESETS_KEYS = "PREMIUM" | "MID" | "MEME" | "SHIT" | "UNTRUSTED";
export type LISTING_PRESETS_KEYS = "ULTRA_PREMIUM" | "PREMIUM" | "MID" | "MEME" | "SHIT" | "UNTRUSTED";
export declare const LISTING_PRESETS: {
[key in LISTING_PRESETS_KEYS]: ListingPreset | Record<string, never>;
};
@ -51,4 +51,5 @@ export declare const calculateMarketTradingParams: (basePrice: number, quotePric
export declare const coinTiersToNames: {
[key in LISTING_PRESETS_KEYS]: string;
};
export declare const getTierWithAdjustedNetBorrows: (tier: ListingPreset, currentTotalDepositsInUsdc: number) => ListingPreset;
export {};

View File

@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.coinTiersToNames = exports.calculateMarketTradingParams = exports.LISTING_PRESETS_PYTH = exports.LISTING_PRESETS = void 0;
exports.getTierWithAdjustedNetBorrows = exports.coinTiersToNames = exports.calculateMarketTradingParams = exports.LISTING_PRESETS_PYTH = exports.LISTING_PRESETS = void 0;
const bn_js_1 = __importDefault(require("bn.js"));
const PREMIUM_LISTING = {
maxStalenessSlots: 10000,
@ -39,6 +39,8 @@ const PREMIUM_LISTING = {
reduceOnly: 0,
};
exports.LISTING_PRESETS = {
//Price impact on $250,000 swap lower then 1%
ULTRA_PREMIUM: Object.assign(Object.assign({}, PREMIUM_LISTING), { netBorrowLimitPerWindowQuote: toNative(125000, 6).toNumber(), borrowWeightScaleStartQuote: toNative(500000, 6).toNumber(), depositWeightScaleStartQuote: toNative(500000, 6).toNumber(), preset_name: "ULTRA PREMIUM", preset_key: "ULTRA_PREMIUM", preset_target_amount: 250000 }),
//Price impact on $100,000 swap lower then 1%
PREMIUM: Object.assign({}, PREMIUM_LISTING),
//Price impact on $20,000 swap lower then 1%
@ -51,6 +53,7 @@ exports.LISTING_PRESETS = {
UNTRUSTED: {},
};
exports.LISTING_PRESETS_PYTH = {
ULTRA_PREMIUM: Object.assign(Object.assign({}, exports.LISTING_PRESETS.ULTRA_PREMIUM), { maxStalenessSlots: 250 }),
PREMIUM: Object.assign(Object.assign({}, exports.LISTING_PRESETS.PREMIUM), { maxStalenessSlots: 250 }),
MID: Object.assign(Object.assign({}, exports.LISTING_PRESETS.MID), { maxStalenessSlots: 250 }),
MEME: Object.assign(Object.assign({}, exports.LISTING_PRESETS.MEME), { maxStalenessSlots: 250 }),
@ -132,9 +135,15 @@ function toNative(uiAmount, decimals) {
return new bn_js_1.default((uiAmount * Math.pow(10, decimals)).toFixed(0));
}
exports.coinTiersToNames = {
ULTRA_PREMIUM: "Ultra Premium",
PREMIUM: "Blue Chip",
MID: "Mid-wit",
MEME: "Meme",
SHIT: "Shit Coin",
UNTRUSTED: "Untrusted",
};
const getTierWithAdjustedNetBorrows = (tier, currentTotalDepositsInUsdc) => {
const newNetBorrowLimitPerWindowQuote = Math.round(currentTotalDepositsInUsdc / 1000000000) * 1000000000;
return Object.assign(Object.assign({}, tier), { netBorrowLimitPerWindowQuote: newNetBorrowLimitPerWindowQuote });
};
exports.getTierWithAdjustedNetBorrows = getTierWithAdjustedNetBorrows;