@reyaxyz/common 0.310.2 → 0.311.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/transactions/trade.js +1 -22
- package/dist/transactions/trade.js.map +1 -1
- package/dist/types/transactions/trade.d.ts +0 -1
- package/dist/types/transactions/trade.d.ts.map +1 -1
- package/dist/types/vltz-api-types.d.ts +2 -0
- package/dist/types/vltz-api-types.d.ts.map +1 -1
- package/dist/utils/minting-helpers.js +3 -3
- package/dist/utils/minting-helpers.js.map +1 -1
- package/dist/vltz-api-types.js.map +1 -1
- package/package.json +2 -2
- package/src/transactions/trade.ts +0 -26
- package/src/utils/minting-helpers.ts +3 -3
- package/src/vltz-api-types.ts +2 -0
package/README.md
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
|
|
7
7
|
| Statements | Branches | Functions | Lines |
|
|
8
8
|
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
|
|
9
|
-
|  |  |  |  |
|
|
10
10
|
|
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.calculateMaxPriceLimit =
|
|
7
|
-
var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
3
|
+
exports.calculateMaxPriceLimit = void 0;
|
|
8
4
|
var ethers_1 = require("ethers");
|
|
9
|
-
// todo: need the ability to supply custom slippage or use a more conservative default for the slippage tolerance
|
|
10
|
-
function calculatePriceLimitForTrade(orderPrice, amount, factor) {
|
|
11
|
-
if (factor === void 0) { factor = 100; }
|
|
12
|
-
// Ensure orderPrice is BigInt
|
|
13
|
-
var orderPriceBigInt = (0, bignumber_js_1.default)(orderPrice);
|
|
14
|
-
// Calculate 1% (or provided factor) of the order price
|
|
15
|
-
var offset = orderPriceBigInt.div(factor);
|
|
16
|
-
// Determine if the amount is positive or negative and adjust the price accordingly
|
|
17
|
-
if (amount > 0) {
|
|
18
|
-
// Trade is long, so add
|
|
19
|
-
return BigInt((0, bignumber_js_1.default)(orderPriceBigInt).plus(offset).times(1e18).toFixed(0));
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return BigInt((0, bignumber_js_1.default)(orderPriceBigInt).minus(offset).times(1e18).toFixed(0));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.calculatePriceLimitForTrade = calculatePriceLimitForTrade;
|
|
26
5
|
function calculateMaxPriceLimit(isLong) {
|
|
27
6
|
// Determine if the amount is positive or negative and adjust the price accordingly
|
|
28
7
|
if (isLong) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trade.js","sourceRoot":"/","sources":["transactions/trade.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trade.js","sourceRoot":"/","sources":["transactions/trade.ts"],"names":[],"mappings":";;;AAAA,iCAAoC;AAEpC,SAAgB,sBAAsB,CAAC,MAAe;IACpD,mFAAmF;IACnF,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,mBAAU,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;AACH,CAAC;AAPD,wDAOC","sourcesContent":["import { MaxUint256 } from 'ethers';\n\nexport function calculateMaxPriceLimit(isLong: boolean): bigint {\n // Determine if the amount is positive or negative and adjust the price accordingly\n if (isLong) {\n return MaxUint256;\n } else {\n return BigInt(0);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trade.d.ts","sourceRoot":"/","sources":["transactions/trade.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trade.d.ts","sourceRoot":"/","sources":["transactions/trade.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAO9D"}
|
|
@@ -5,6 +5,7 @@ export type VltzRoundInfo = {
|
|
|
5
5
|
mintedAmount: number;
|
|
6
6
|
totalAllocation: number;
|
|
7
7
|
totalRealizedPnl: number;
|
|
8
|
+
leaderboardCachedTimestampMs: number;
|
|
8
9
|
leaderboard: {
|
|
9
10
|
data: {
|
|
10
11
|
walletAddress: string;
|
|
@@ -19,6 +20,7 @@ export type VltzWalletInfo = {
|
|
|
19
20
|
allocationInfo: VltzAllocationInfo;
|
|
20
21
|
merkleRoot: string;
|
|
21
22
|
merkleProof: string[];
|
|
23
|
+
contractAddress: string;
|
|
22
24
|
realizedPnl: number;
|
|
23
25
|
positionInLeaderboard: number | null;
|
|
24
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vltz-api-types.d.ts","sourceRoot":"/","sources":["vltz-api-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE;QACX,IAAI,EAAE;YACJ,aAAa,EAAE,MAAM,CAAC;YACtB,WAAW,EAAE,MAAM,CAAC;SACrB,EAAE,CAAC;QACJ,IAAI,EAAE,kBAAkB,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,kBAAkB,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,EAAE,WAAW,CAC3B,aAAa,EACb;QACE,EAAE,EAAE,MAAM,CAAC;KACZ,GAAG,oBAAoB,CACzB,CAAC;IAEF,+BAA+B,EAAE,WAAW,CAC1C,cAAc,EACd,YAAY,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CACnC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;KACnB,CAAC,IAAI,MAAM,aAAa,GAAG;QAC1B,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACnC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACjC,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;KACrD;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"vltz-api-types.d.ts","sourceRoot":"/","sources":["vltz-api-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,4BAA4B,EAAE,MAAM,CAAC;IACrC,WAAW,EAAE;QACX,IAAI,EAAE;YACJ,aAAa,EAAE,MAAM,CAAC;YACtB,WAAW,EAAE,MAAM,CAAC;SACrB,EAAE,CAAC;QACJ,IAAI,EAAE,kBAAkB,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,kBAAkB,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,EAAE,WAAW,CAC3B,aAAa,EACb;QACE,EAAE,EAAE,MAAM,CAAC;KACZ,GAAG,oBAAoB,CACzB,CAAC;IAEF,+BAA+B,EAAE,WAAW,CAC1C,cAAc,EACd,YAAY,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CACnC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;KACnB,CAAC,IAAI,MAAM,aAAa,GAAG;QAC1B,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACnC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACjC,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;KACrD;CACF,CAAC"}
|
|
@@ -21,10 +21,10 @@ exports.VLTZ_MINTING_DETAILS = (_a = {},
|
|
|
21
21
|
contractAddress: '0x7A00255ebcBE36FbF469e0A6265A271749560aE4',
|
|
22
22
|
rounds: {
|
|
23
23
|
1: {
|
|
24
|
-
mintDeadline:
|
|
25
|
-
mintStart:
|
|
24
|
+
mintDeadline: 1761742800,
|
|
25
|
+
mintStart: 1760529600,
|
|
26
26
|
totalAllocation: 1000000000, // 1 Billion
|
|
27
|
-
root: '
|
|
27
|
+
root: '0x2055f18a8e96ea548a78552f33632989ab0afa5706e530b10bd24c8bfcdafe71',
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minting-helpers.js","sourceRoot":"/","sources":["utils/minting-helpers.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,kCAA6C;AAM7C,6CAA6C;AAChC,QAAA,oBAAoB;IAe/B,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE;YACN,CAAC,EAAE;gBACD,YAAY,EAAE,UAAU;gBACxB,SAAS,EAAE,UAAU;gBACrB,eAAe,EAAE,UAAU,EAAE,YAAY;gBACzC,IAAI,EAAE,oEAAoE;aAC3E;SACF;KACF;IACD,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE;YACN,CAAC,EAAE;gBACD,YAAY,EAAE,UAAU;gBACxB,SAAS,EAAE,UAAU;gBACrB,eAAe,EAAE,UAAU,EAAE,YAAY;gBACzC,IAAI,EAAE,oEAAoE;aAC3E;SACF;KACF;QACD;AAEF,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,+BAAe,CAAA;IACf,+BAAe,CAAA;IACf,+BAAe,CAAA;IACf,uCAAuB,CAAA;IACvB,uCAAuB,CAAA;AACzB,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB;AAED,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,6BAAc,CAAA;IACd,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,4BAAa,CAAA;AACf,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAaM,IAAM,WAAW,GAAG,UACzB,aAAqB,EACrB,UAAkB;IAElB,IAAM,WAAW,GAAG,eAAM,CAAC,SAAS,CAClC,eAAM,CAAC,cAAc,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAC3E,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB","sourcesContent":["import { ethers } from 'ethers';\nimport { MoneyInOutChainId } from '../types';\n\ntype VltzMintingChainIds =\n | MoneyInOutChainId.ethereumMainnet\n | MoneyInOutChainId.ethereumSepolia;\n\n// mapping from round, to network, to details\nexport const VLTZ_MINTING_DETAILS: Record<\n VltzMintingChainIds,\n {\n contractAddress: string;\n rounds: Record<\n number,\n {\n mintDeadline: number;\n mintStart: number;\n totalAllocation: number;\n root: string;\n }\n >;\n }\n> = {\n [MoneyInOutChainId.ethereumSepolia]: {\n contractAddress: '0x7A00255ebcBE36FbF469e0A6265A271749560aE4',\n rounds: {\n 1: {\n mintDeadline: 1761742800,\n mintStart: 1760529600,\n totalAllocation: 1000000000, // 1 Billion\n root: '0x1aaeed7e414b0946dee1e5ddb2eb8bd63953c2f4f4a0f413998a1070a30b06d8',\n },\n },\n },\n [MoneyInOutChainId.ethereumMainnet]: {\n contractAddress: '0x7A00255ebcBE36FbF469e0A6265A271749560aE4',\n rounds: {\n 1: {\n mintDeadline:
|
|
1
|
+
{"version":3,"file":"minting-helpers.js","sourceRoot":"/","sources":["utils/minting-helpers.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,kCAA6C;AAM7C,6CAA6C;AAChC,QAAA,oBAAoB;IAe/B,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE;YACN,CAAC,EAAE;gBACD,YAAY,EAAE,UAAU;gBACxB,SAAS,EAAE,UAAU;gBACrB,eAAe,EAAE,UAAU,EAAE,YAAY;gBACzC,IAAI,EAAE,oEAAoE;aAC3E;SACF;KACF;IACD,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,eAAe,EAAE,4CAA4C;QAC7D,MAAM,EAAE;YACN,CAAC,EAAE;gBACD,YAAY,EAAE,UAAU;gBACxB,SAAS,EAAE,UAAU;gBACrB,eAAe,EAAE,UAAU,EAAE,YAAY;gBACzC,IAAI,EAAE,oEAAoE;aAC3E;SACF;KACF;QACD;AAEF,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,+BAAe,CAAA;IACf,+BAAe,CAAA;IACf,+BAAe,CAAA;IACf,uCAAuB,CAAA;IACvB,uCAAuB,CAAA;AACzB,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB;AAED,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,6BAAc,CAAA;IACd,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,4BAAa,CAAA;AACf,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAaM,IAAM,WAAW,GAAG,UACzB,aAAqB,EACrB,UAAkB;IAElB,IAAM,WAAW,GAAG,eAAM,CAAC,SAAS,CAClC,eAAM,CAAC,cAAc,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAC3E,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB","sourcesContent":["import { ethers } from 'ethers';\nimport { MoneyInOutChainId } from '../types';\n\ntype VltzMintingChainIds =\n | MoneyInOutChainId.ethereumMainnet\n | MoneyInOutChainId.ethereumSepolia;\n\n// mapping from round, to network, to details\nexport const VLTZ_MINTING_DETAILS: Record<\n VltzMintingChainIds,\n {\n contractAddress: string;\n rounds: Record<\n number,\n {\n mintDeadline: number;\n mintStart: number;\n totalAllocation: number;\n root: string;\n }\n >;\n }\n> = {\n [MoneyInOutChainId.ethereumSepolia]: {\n contractAddress: '0x7A00255ebcBE36FbF469e0A6265A271749560aE4',\n rounds: {\n 1: {\n mintDeadline: 1761742800,\n mintStart: 1760529600,\n totalAllocation: 1000000000, // 1 Billion\n root: '0x1aaeed7e414b0946dee1e5ddb2eb8bd63953c2f4f4a0f413998a1070a30b06d8',\n },\n },\n },\n [MoneyInOutChainId.ethereumMainnet]: {\n contractAddress: '0x7A00255ebcBE36FbF469e0A6265A271749560aE4',\n rounds: {\n 1: {\n mintDeadline: 1761742800,\n mintStart: 1760529600,\n totalAllocation: 1000000000, // 1 Billion\n root: '0x2055f18a8e96ea548a78552f33632989ab0afa5706e530b10bd24c8bfcdafe71',\n },\n },\n },\n};\n\nexport enum VltzTierName {\n tier1 = 'tier1',\n tier2 = 'tier2',\n tier3 = 'tier3',\n legendary = 'legendary',\n easterEgg = 'easterEgg',\n}\n\nexport enum VltzSeasons {\n seasonOg = '0',\n season1 = '1',\n season2 = '2',\n season3 = '3',\n season4 = '4',\n}\n\nexport type VltzAllocationInfo = {\n walletAddress: string;\n totalAllocation: number;\n allocationPerSeasonBadge: Record<VltzSeasons, Record<VltzTierName, number>>;\n};\n\nexport type VltzLeafInfo = {\n walletAddress: string;\n allocation: string;\n};\n\nexport const getVltzLeaf = (\n walletAddress: string,\n allocation: string,\n): Buffer => {\n const messageHash = ethers.keccak256(\n ethers.solidityPacked(['address', 'uint256'], [walletAddress, allocation]),\n );\n return Buffer.from(messageHash.slice(2), 'hex');\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vltz-api-types.js","sourceRoot":"/","sources":["vltz-api-types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n AddressParam,\n ApiEndpoint,\n PaginatedQueryMeta,\n PaginatedQueryParams,\n Stringified,\n} from './api-types';\nimport { VltzAllocationInfo } from './utils';\n\nexport type VltzRoundInfo = {\n deadlineMs: number;\n mintedAmount: number;\n totalAllocation: number;\n totalRealizedPnl: number;\n leaderboard: {\n data: {\n walletAddress: string;\n realizedPnl: number;\n }[];\n meta: PaginatedQueryMeta;\n };\n};\n\nexport type VltzWalletInfo = {\n minted: boolean;\n mintedAmountSoFar: number;\n allocationInfo: VltzAllocationInfo;\n merkleRoot: string;\n merkleProof: string[];\n realizedPnl: number;\n positionInLeaderboard: number | null;\n};\n\nexport type VltzApiSource = {\n 'vltz/round/:id': ApiEndpoint<\n VltzRoundInfo,\n {\n id: string;\n } & PaginatedQueryParams\n >;\n\n 'vltz/wallet/:address/:roundId': ApiEndpoint<\n VltzWalletInfo,\n AddressParam & { roundId: string }\n >;\n};\n\nexport type VltzApi = {\n [K in keyof VltzApiSource]: {\n params: VltzApiSource[K]['params'];\n query: VltzApiSource[K]['query'];\n response: Stringified<VltzApiSource[K]['response']>;\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"vltz-api-types.js","sourceRoot":"/","sources":["vltz-api-types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n AddressParam,\n ApiEndpoint,\n PaginatedQueryMeta,\n PaginatedQueryParams,\n Stringified,\n} from './api-types';\nimport { VltzAllocationInfo } from './utils';\n\nexport type VltzRoundInfo = {\n deadlineMs: number;\n mintedAmount: number;\n totalAllocation: number;\n totalRealizedPnl: number;\n leaderboardCachedTimestampMs: number;\n leaderboard: {\n data: {\n walletAddress: string;\n realizedPnl: number;\n }[];\n meta: PaginatedQueryMeta;\n };\n};\n\nexport type VltzWalletInfo = {\n minted: boolean;\n mintedAmountSoFar: number;\n allocationInfo: VltzAllocationInfo;\n merkleRoot: string;\n merkleProof: string[];\n contractAddress: string;\n realizedPnl: number;\n positionInLeaderboard: number | null;\n};\n\nexport type VltzApiSource = {\n 'vltz/round/:id': ApiEndpoint<\n VltzRoundInfo,\n {\n id: string;\n } & PaginatedQueryParams\n >;\n\n 'vltz/wallet/:address/:roundId': ApiEndpoint<\n VltzWalletInfo,\n AddressParam & { roundId: string }\n >;\n};\n\nexport type VltzApi = {\n [K in keyof VltzApiSource]: {\n params: VltzApiSource[K]['params'];\n query: VltzApiSource[K]['query'];\n response: Stringified<VltzApiSource[K]['response']>;\n };\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.311.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
45
45
|
},
|
|
46
46
|
"packageManager": "pnpm@8.3.1",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "820bf1d931672522440894ba3b13568bc7ea753e"
|
|
48
48
|
}
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
|
2
1
|
import { MaxUint256 } from 'ethers';
|
|
3
2
|
|
|
4
|
-
// todo: need the ability to supply custom slippage or use a more conservative default for the slippage tolerance
|
|
5
|
-
export function calculatePriceLimitForTrade(
|
|
6
|
-
orderPrice: number,
|
|
7
|
-
amount: number,
|
|
8
|
-
factor = 100,
|
|
9
|
-
): bigint {
|
|
10
|
-
// Ensure orderPrice is BigInt
|
|
11
|
-
const orderPriceBigInt = BigNumber(orderPrice);
|
|
12
|
-
|
|
13
|
-
// Calculate 1% (or provided factor) of the order price
|
|
14
|
-
const offset = orderPriceBigInt.div(factor);
|
|
15
|
-
|
|
16
|
-
// Determine if the amount is positive or negative and adjust the price accordingly
|
|
17
|
-
if (amount > 0) {
|
|
18
|
-
// Trade is long, so add
|
|
19
|
-
return BigInt(
|
|
20
|
-
BigNumber(orderPriceBigInt).plus(offset).times(1e18).toFixed(0),
|
|
21
|
-
);
|
|
22
|
-
} else {
|
|
23
|
-
return BigInt(
|
|
24
|
-
BigNumber(orderPriceBigInt).minus(offset).times(1e18).toFixed(0),
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
3
|
export function calculateMaxPriceLimit(isLong: boolean): bigint {
|
|
30
4
|
// Determine if the amount is positive or negative and adjust the price accordingly
|
|
31
5
|
if (isLong) {
|
|
@@ -36,10 +36,10 @@ export const VLTZ_MINTING_DETAILS: Record<
|
|
|
36
36
|
contractAddress: '0x7A00255ebcBE36FbF469e0A6265A271749560aE4',
|
|
37
37
|
rounds: {
|
|
38
38
|
1: {
|
|
39
|
-
mintDeadline:
|
|
40
|
-
mintStart:
|
|
39
|
+
mintDeadline: 1761742800,
|
|
40
|
+
mintStart: 1760529600,
|
|
41
41
|
totalAllocation: 1000000000, // 1 Billion
|
|
42
|
-
root: '
|
|
42
|
+
root: '0x2055f18a8e96ea548a78552f33632989ab0afa5706e530b10bd24c8bfcdafe71',
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
},
|
package/src/vltz-api-types.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type VltzRoundInfo = {
|
|
|
12
12
|
mintedAmount: number;
|
|
13
13
|
totalAllocation: number;
|
|
14
14
|
totalRealizedPnl: number;
|
|
15
|
+
leaderboardCachedTimestampMs: number;
|
|
15
16
|
leaderboard: {
|
|
16
17
|
data: {
|
|
17
18
|
walletAddress: string;
|
|
@@ -27,6 +28,7 @@ export type VltzWalletInfo = {
|
|
|
27
28
|
allocationInfo: VltzAllocationInfo;
|
|
28
29
|
merkleRoot: string;
|
|
29
30
|
merkleProof: string[];
|
|
31
|
+
contractAddress: string;
|
|
30
32
|
realizedPnl: number;
|
|
31
33
|
positionInLeaderboard: number | null;
|
|
32
34
|
};
|