@heliofi/launchpad-common 0.0.1

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.
Files changed (227) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +18 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/src/domain/constants/blockchain.d.ts +13 -0
  5. package/dist/src/domain/constants/blockchain.js +27 -0
  6. package/dist/src/domain/constants/blockchain.js.map +1 -0
  7. package/dist/src/domain/constants/currency.d.ts +8 -0
  8. package/dist/src/domain/constants/currency.js +20 -0
  9. package/dist/src/domain/constants/currency.js.map +1 -0
  10. package/dist/src/domain/constants/curveType.d.ts +3 -0
  11. package/dist/src/domain/constants/curveType.js +8 -0
  12. package/dist/src/domain/constants/curveType.js.map +1 -0
  13. package/dist/src/domain/constants/generalNetwork.d.ts +5 -0
  14. package/dist/src/domain/constants/generalNetwork.js +10 -0
  15. package/dist/src/domain/constants/generalNetwork.js.map +1 -0
  16. package/dist/src/domain/constants/index.d.ts +9 -0
  17. package/dist/src/domain/constants/index.js +26 -0
  18. package/dist/src/domain/constants/index.js.map +1 -0
  19. package/dist/src/domain/constants/tokenType.d.ts +4 -0
  20. package/dist/src/domain/constants/tokenType.js +9 -0
  21. package/dist/src/domain/constants/tokenType.js.map +1 -0
  22. package/dist/src/domain/constants/tradeDirection.d.ts +4 -0
  23. package/dist/src/domain/constants/tradeDirection.js +9 -0
  24. package/dist/src/domain/constants/tradeDirection.js.map +1 -0
  25. package/dist/src/domain/constants/txStatus.d.ts +6 -0
  26. package/dist/src/domain/constants/txStatus.js +11 -0
  27. package/dist/src/domain/constants/txStatus.js.map +1 -0
  28. package/dist/src/domain/constants/txStatusTokenHeaderName.d.ts +1 -0
  29. package/dist/src/domain/constants/txStatusTokenHeaderName.js +5 -0
  30. package/dist/src/domain/constants/txStatusTokenHeaderName.js.map +1 -0
  31. package/dist/src/domain/constants/txType.d.ts +6 -0
  32. package/dist/src/domain/constants/txType.js +11 -0
  33. package/dist/src/domain/constants/txType.js.map +1 -0
  34. package/dist/src/domain/curves/BaseCurve.d.ts +13 -0
  35. package/dist/src/domain/curves/BaseCurve.js +7 -0
  36. package/dist/src/domain/curves/BaseCurve.js.map +1 -0
  37. package/dist/src/domain/curves/LinearCurveV1.d.ts +16 -0
  38. package/dist/src/domain/curves/LinearCurveV1.js +120 -0
  39. package/dist/src/domain/curves/LinearCurveV1.js.map +1 -0
  40. package/dist/src/domain/curves/index.d.ts +3 -0
  41. package/dist/src/domain/curves/index.js +20 -0
  42. package/dist/src/domain/curves/index.js.map +1 -0
  43. package/dist/src/domain/curves/tests/LinearCurveV1.spec.d.ts +1 -0
  44. package/dist/src/domain/curves/tests/LinearCurveV1.spec.js +52 -0
  45. package/dist/src/domain/curves/tests/LinearCurveV1.spec.js.map +1 -0
  46. package/dist/src/domain/curves/types.d.ts +18 -0
  47. package/dist/src/domain/curves/types.js +31 -0
  48. package/dist/src/domain/curves/types.js.map +1 -0
  49. package/dist/src/domain/index.d.ts +3 -0
  50. package/dist/src/domain/index.js +20 -0
  51. package/dist/src/domain/index.js.map +1 -0
  52. package/dist/src/domain/model/blockchain/entities/BaseBlockchain.entity.d.ts +7 -0
  53. package/dist/src/domain/model/blockchain/entities/BaseBlockchain.entity.js +8 -0
  54. package/dist/src/domain/model/blockchain/entities/BaseBlockchain.entity.js.map +1 -0
  55. package/dist/src/domain/model/blockchain/entities/Blockchain.entity.d.ts +9 -0
  56. package/dist/src/domain/model/blockchain/entities/Blockchain.entity.js +8 -0
  57. package/dist/src/domain/model/blockchain/entities/Blockchain.entity.js.map +1 -0
  58. package/dist/src/domain/model/blockchain/entities/index.d.ts +2 -0
  59. package/dist/src/domain/model/blockchain/entities/index.js +19 -0
  60. package/dist/src/domain/model/blockchain/entities/index.js.map +1 -0
  61. package/dist/src/domain/model/blockchain/index.d.ts +1 -0
  62. package/dist/src/domain/model/blockchain/index.js +18 -0
  63. package/dist/src/domain/model/blockchain/index.js.map +1 -0
  64. package/dist/src/domain/model/blockchain-engine/entities/BlockchainEngine.entity.d.ts +6 -0
  65. package/dist/src/domain/model/blockchain-engine/entities/BlockchainEngine.entity.js +8 -0
  66. package/dist/src/domain/model/blockchain-engine/entities/BlockchainEngine.entity.js.map +1 -0
  67. package/dist/src/domain/model/blockchain-engine/entities/index.d.ts +1 -0
  68. package/dist/src/domain/model/blockchain-engine/entities/index.js +18 -0
  69. package/dist/src/domain/model/blockchain-engine/entities/index.js.map +1 -0
  70. package/dist/src/domain/model/blockchain-engine/index.d.ts +1 -0
  71. package/dist/src/domain/model/blockchain-engine/index.js +18 -0
  72. package/dist/src/domain/model/blockchain-engine/index.js.map +1 -0
  73. package/dist/src/domain/model/currency/dtos/createCurrency.dto.d.ts +13 -0
  74. package/dist/src/domain/model/currency/dtos/createCurrency.dto.js +68 -0
  75. package/dist/src/domain/model/currency/dtos/createCurrency.dto.js.map +1 -0
  76. package/dist/src/domain/model/currency/dtos/index.d.ts +1 -0
  77. package/dist/src/domain/model/currency/dtos/index.js +18 -0
  78. package/dist/src/domain/model/currency/dtos/index.js.map +1 -0
  79. package/dist/src/domain/model/currency/entities/BaseCurrency.entity.d.ts +14 -0
  80. package/dist/src/domain/model/currency/entities/BaseCurrency.entity.js +8 -0
  81. package/dist/src/domain/model/currency/entities/BaseCurrency.entity.js.map +1 -0
  82. package/dist/src/domain/model/currency/entities/Currency.entity.d.ts +5 -0
  83. package/dist/src/domain/model/currency/entities/Currency.entity.js +8 -0
  84. package/dist/src/domain/model/currency/entities/Currency.entity.js.map +1 -0
  85. package/dist/src/domain/model/currency/entities/index.d.ts +2 -0
  86. package/dist/src/domain/model/currency/entities/index.js +19 -0
  87. package/dist/src/domain/model/currency/entities/index.js.map +1 -0
  88. package/dist/src/domain/model/currency/index.d.ts +2 -0
  89. package/dist/src/domain/model/currency/index.js +19 -0
  90. package/dist/src/domain/model/currency/index.js.map +1 -0
  91. package/dist/src/domain/model/curve/dtos/CreateCurve.dto.d.ts +12 -0
  92. package/dist/src/domain/model/curve/dtos/CreateCurve.dto.js +60 -0
  93. package/dist/src/domain/model/curve/dtos/CreateCurve.dto.js.map +1 -0
  94. package/dist/src/domain/model/curve/dtos/index.d.ts +1 -0
  95. package/dist/src/domain/model/curve/dtos/index.js +18 -0
  96. package/dist/src/domain/model/curve/dtos/index.js.map +1 -0
  97. package/dist/src/domain/model/curve/entities/Curve.entity.d.ts +15 -0
  98. package/dist/src/domain/model/curve/entities/Curve.entity.js +8 -0
  99. package/dist/src/domain/model/curve/entities/Curve.entity.js.map +1 -0
  100. package/dist/src/domain/model/curve/entities/index.d.ts +1 -0
  101. package/dist/src/domain/model/curve/entities/index.js +18 -0
  102. package/dist/src/domain/model/curve/entities/index.js.map +1 -0
  103. package/dist/src/domain/model/curve/index.d.ts +2 -0
  104. package/dist/src/domain/model/curve/index.js +19 -0
  105. package/dist/src/domain/model/curve/index.js.map +1 -0
  106. package/dist/src/domain/model/entity/Entity.d.ts +4 -0
  107. package/dist/src/domain/model/entity/Entity.js +14 -0
  108. package/dist/src/domain/model/entity/Entity.js.map +1 -0
  109. package/dist/src/domain/model/entity/index.d.ts +1 -0
  110. package/dist/src/domain/model/entity/index.js +6 -0
  111. package/dist/src/domain/model/entity/index.js.map +1 -0
  112. package/dist/src/domain/model/example/example.d.ts +4 -0
  113. package/dist/src/domain/model/example/example.js +8 -0
  114. package/dist/src/domain/model/example/example.js.map +1 -0
  115. package/dist/src/domain/model/example/index.d.ts +1 -0
  116. package/dist/src/domain/model/example/index.js +18 -0
  117. package/dist/src/domain/model/example/index.js.map +1 -0
  118. package/dist/src/domain/model/index.d.ts +9 -0
  119. package/dist/src/domain/model/index.js +26 -0
  120. package/dist/src/domain/model/index.js.map +1 -0
  121. package/dist/src/domain/model/mint/create/dtos/CreateMint.dto.d.ts +6 -0
  122. package/dist/src/domain/model/mint/create/dtos/CreateMint.dto.js +37 -0
  123. package/dist/src/domain/model/mint/create/dtos/CreateMint.dto.js.map +1 -0
  124. package/dist/src/domain/model/mint/create/dtos/index.d.ts +1 -0
  125. package/dist/src/domain/model/mint/create/dtos/index.js +18 -0
  126. package/dist/src/domain/model/mint/create/dtos/index.js.map +1 -0
  127. package/dist/src/domain/model/mint/create/entities/CreateMintResponse.entity.d.ts +4 -0
  128. package/dist/src/domain/model/mint/create/entities/CreateMintResponse.entity.js +8 -0
  129. package/dist/src/domain/model/mint/create/entities/CreateMintResponse.entity.js.map +1 -0
  130. package/dist/src/domain/model/mint/create/entities/index.d.ts +1 -0
  131. package/dist/src/domain/model/mint/create/entities/index.js +18 -0
  132. package/dist/src/domain/model/mint/create/entities/index.js.map +1 -0
  133. package/dist/src/domain/model/mint/create/index.d.ts +2 -0
  134. package/dist/src/domain/model/mint/create/index.js +19 -0
  135. package/dist/src/domain/model/mint/create/index.js.map +1 -0
  136. package/dist/src/domain/model/mint/index.d.ts +3 -0
  137. package/dist/src/domain/model/mint/index.js +20 -0
  138. package/dist/src/domain/model/mint/index.js.map +1 -0
  139. package/dist/src/domain/model/mint/prepare/dtos/MintTxPrepare.dto.d.ts +3 -0
  140. package/dist/src/domain/model/mint/prepare/dtos/MintTxPrepare.dto.js +22 -0
  141. package/dist/src/domain/model/mint/prepare/dtos/MintTxPrepare.dto.js.map +1 -0
  142. package/dist/src/domain/model/mint/prepare/dtos/index.d.ts +1 -0
  143. package/dist/src/domain/model/mint/prepare/dtos/index.js +18 -0
  144. package/dist/src/domain/model/mint/prepare/dtos/index.js.map +1 -0
  145. package/dist/src/domain/model/mint/prepare/entities/MintTxPrepareResponse.entity.d.ts +5 -0
  146. package/dist/src/domain/model/mint/prepare/entities/MintTxPrepareResponse.entity.js +8 -0
  147. package/dist/src/domain/model/mint/prepare/entities/MintTxPrepareResponse.entity.js.map +1 -0
  148. package/dist/src/domain/model/mint/prepare/entities/index.d.ts +1 -0
  149. package/dist/src/domain/model/mint/prepare/entities/index.js +18 -0
  150. package/dist/src/domain/model/mint/prepare/entities/index.js.map +1 -0
  151. package/dist/src/domain/model/mint/prepare/index.d.ts +2 -0
  152. package/dist/src/domain/model/mint/prepare/index.js +19 -0
  153. package/dist/src/domain/model/mint/prepare/index.js.map +1 -0
  154. package/dist/src/domain/model/mint/submit/dtos/MintTxSubmit.dto.d.ts +3 -0
  155. package/dist/src/domain/model/mint/submit/dtos/MintTxSubmit.dto.js +8 -0
  156. package/dist/src/domain/model/mint/submit/dtos/MintTxSubmit.dto.js.map +1 -0
  157. package/dist/src/domain/model/mint/submit/dtos/index.d.ts +1 -0
  158. package/dist/src/domain/model/mint/submit/dtos/index.js +18 -0
  159. package/dist/src/domain/model/mint/submit/dtos/index.js.map +1 -0
  160. package/dist/src/domain/model/mint/submit/entities/MintTxSubmitResponse.entity.d.ts +3 -0
  161. package/dist/src/domain/model/mint/submit/entities/MintTxSubmitResponse.entity.js +8 -0
  162. package/dist/src/domain/model/mint/submit/entities/MintTxSubmitResponse.entity.js.map +1 -0
  163. package/dist/src/domain/model/mint/submit/entities/index.d.ts +1 -0
  164. package/dist/src/domain/model/mint/submit/entities/index.js +18 -0
  165. package/dist/src/domain/model/mint/submit/entities/index.js.map +1 -0
  166. package/dist/src/domain/model/mint/submit/index.d.ts +2 -0
  167. package/dist/src/domain/model/mint/submit/index.js +19 -0
  168. package/dist/src/domain/model/mint/submit/index.js.map +1 -0
  169. package/dist/src/domain/model/token-pair/constants.d.ts +4 -0
  170. package/dist/src/domain/model/token-pair/constants.js +9 -0
  171. package/dist/src/domain/model/token-pair/constants.js.map +1 -0
  172. package/dist/src/domain/model/token-pair/dtos/CreateTokenPair.dto.d.ts +12 -0
  173. package/dist/src/domain/model/token-pair/dtos/CreateTokenPair.dto.js +60 -0
  174. package/dist/src/domain/model/token-pair/dtos/CreateTokenPair.dto.js.map +1 -0
  175. package/dist/src/domain/model/token-pair/dtos/index.d.ts +1 -0
  176. package/dist/src/domain/model/token-pair/dtos/index.js +18 -0
  177. package/dist/src/domain/model/token-pair/dtos/index.js.map +1 -0
  178. package/dist/src/domain/model/token-pair/entities/TokenPair.entity.d.ts +19 -0
  179. package/dist/src/domain/model/token-pair/entities/TokenPair.entity.js +8 -0
  180. package/dist/src/domain/model/token-pair/entities/TokenPair.entity.js.map +1 -0
  181. package/dist/src/domain/model/token-pair/entities/index.d.ts +1 -0
  182. package/dist/src/domain/model/token-pair/entities/index.js +18 -0
  183. package/dist/src/domain/model/token-pair/entities/index.js.map +1 -0
  184. package/dist/src/domain/model/token-pair/index.d.ts +3 -0
  185. package/dist/src/domain/model/token-pair/index.js +20 -0
  186. package/dist/src/domain/model/token-pair/index.js.map +1 -0
  187. package/dist/src/domain/model/tx/index.d.ts +1 -0
  188. package/dist/src/domain/model/tx/index.js +18 -0
  189. package/dist/src/domain/model/tx/index.js.map +1 -0
  190. package/dist/src/domain/model/tx/submit/dtos/BaseTxSubmit.dto.d.ts +5 -0
  191. package/dist/src/domain/model/tx/submit/dtos/BaseTxSubmit.dto.js +32 -0
  192. package/dist/src/domain/model/tx/submit/dtos/BaseTxSubmit.dto.js.map +1 -0
  193. package/dist/src/domain/model/tx/submit/dtos/index.d.ts +1 -0
  194. package/dist/src/domain/model/tx/submit/dtos/index.js +18 -0
  195. package/dist/src/domain/model/tx/submit/dtos/index.js.map +1 -0
  196. package/dist/src/domain/model/tx/submit/entities/BaseTxSubmitResponse.entity.d.ts +7 -0
  197. package/dist/src/domain/model/tx/submit/entities/BaseTxSubmitResponse.entity.js +8 -0
  198. package/dist/src/domain/model/tx/submit/entities/BaseTxSubmitResponse.entity.js.map +1 -0
  199. package/dist/src/domain/model/tx/submit/entities/TxStatusResponse.entity.d.ts +6 -0
  200. package/dist/src/domain/model/tx/submit/entities/TxStatusResponse.entity.js +8 -0
  201. package/dist/src/domain/model/tx/submit/entities/TxStatusResponse.entity.js.map +1 -0
  202. package/dist/src/domain/model/tx/submit/entities/TxStatusTokenPayload.d.ts +4 -0
  203. package/dist/src/domain/model/tx/submit/entities/TxStatusTokenPayload.js +3 -0
  204. package/dist/src/domain/model/tx/submit/entities/TxStatusTokenPayload.js.map +1 -0
  205. package/dist/src/domain/model/tx/submit/entities/index.d.ts +3 -0
  206. package/dist/src/domain/model/tx/submit/entities/index.js +20 -0
  207. package/dist/src/domain/model/tx/submit/entities/index.js.map +1 -0
  208. package/dist/src/domain/model/tx/submit/index.d.ts +2 -0
  209. package/dist/src/domain/model/tx/submit/index.js +19 -0
  210. package/dist/src/domain/model/tx/submit/index.js.map +1 -0
  211. package/dist/src/domain/model/tx-token-payload/TxTokenPayload.d.ts +5 -0
  212. package/dist/src/domain/model/tx-token-payload/TxTokenPayload.js +3 -0
  213. package/dist/src/domain/model/tx-token-payload/TxTokenPayload.js.map +1 -0
  214. package/dist/src/domain/model/tx-token-payload/index.d.ts +1 -0
  215. package/dist/src/domain/model/tx-token-payload/index.js +18 -0
  216. package/dist/src/domain/model/tx-token-payload/index.js.map +1 -0
  217. package/dist/src/domain/services/AmountService.d.ts +9 -0
  218. package/dist/src/domain/services/AmountService.js +34 -0
  219. package/dist/src/domain/services/AmountService.js.map +1 -0
  220. package/dist/src/index.d.ts +1 -0
  221. package/dist/src/index.js +18 -0
  222. package/dist/src/index.js.map +1 -0
  223. package/dist/tsconfig.tsbuildinfo +1 -0
  224. package/index.ts +1 -0
  225. package/package.json +28 -0
  226. package/tsconfig.build.json +4 -0
  227. package/tsconfig.json +10 -0
@@ -0,0 +1 @@
1
+ export * from './src';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB"}
@@ -0,0 +1,13 @@
1
+ export declare enum BlockchainSymbol {
2
+ SOL = "SOL",
3
+ ETH = "ETH",
4
+ POLYGON = "POLYGON",
5
+ BITCOIN = "BITCOIN"
6
+ }
7
+ export declare enum BlockchainEngineType {
8
+ EVM = "EVM",
9
+ SOL = "SOL",
10
+ BTC = "BTC"
11
+ }
12
+ export declare const blockchainEngineMap: Map<BlockchainSymbol, BlockchainEngineType>;
13
+ export declare function getDefaultBlockChainName(): BlockchainSymbol;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultBlockChainName = exports.blockchainEngineMap = exports.BlockchainEngineType = exports.BlockchainSymbol = void 0;
4
+ var BlockchainSymbol;
5
+ (function (BlockchainSymbol) {
6
+ BlockchainSymbol["SOL"] = "SOL";
7
+ BlockchainSymbol["ETH"] = "ETH";
8
+ BlockchainSymbol["POLYGON"] = "POLYGON";
9
+ BlockchainSymbol["BITCOIN"] = "BITCOIN";
10
+ })(BlockchainSymbol = exports.BlockchainSymbol || (exports.BlockchainSymbol = {}));
11
+ var BlockchainEngineType;
12
+ (function (BlockchainEngineType) {
13
+ BlockchainEngineType["EVM"] = "EVM";
14
+ BlockchainEngineType["SOL"] = "SOL";
15
+ BlockchainEngineType["BTC"] = "BTC";
16
+ })(BlockchainEngineType = exports.BlockchainEngineType || (exports.BlockchainEngineType = {}));
17
+ exports.blockchainEngineMap = new Map([
18
+ [BlockchainSymbol.SOL, BlockchainEngineType.SOL],
19
+ [BlockchainSymbol.ETH, BlockchainEngineType.EVM],
20
+ [BlockchainSymbol.POLYGON, BlockchainEngineType.EVM],
21
+ [BlockchainSymbol.BITCOIN, BlockchainEngineType.BTC],
22
+ ]);
23
+ function getDefaultBlockChainName() {
24
+ return BlockchainSymbol.SOL;
25
+ }
26
+ exports.getDefaultBlockChainName = getDefaultBlockChainName;
27
+ //# sourceMappingURL=blockchain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockchain.js","sourceRoot":"","sources":["../../../../src/domain/constants/blockchain.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,+BAAW,CAAA;IACX,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B;AAED,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,mCAAW,CAAA;IACX,mCAAW,CAAA;IACX,mCAAW,CAAA;AACb,CAAC,EAJW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAI/B;AAEY,QAAA,mBAAmB,GAAG,IAAI,GAAG,CAGxC;IACA,CAAC,gBAAgB,CAAC,GAAG,EAAE,oBAAoB,CAAC,GAAG,CAAC;IAChD,CAAC,gBAAgB,CAAC,GAAG,EAAE,oBAAoB,CAAC,GAAG,CAAC;IAChD,CAAC,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC;IACpD,CAAC,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC;CACrD,CAAC,CAAC;AAEH,SAAgB,wBAAwB;IACtC,OAAO,gBAAgB,CAAC,GAAG,CAAC;AAC9B,CAAC;AAFD,4DAEC"}
@@ -0,0 +1,8 @@
1
+ export declare enum CurrencyType {
2
+ FIAT = "FIAT",
3
+ DIGITAL = "DIGITAL"
4
+ }
5
+ export declare enum DefaultCurrencies {
6
+ SOL = "SOL"
7
+ }
8
+ export declare const toDefaultCurrency: (currency: string) => DefaultCurrencies;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toDefaultCurrency = exports.DefaultCurrencies = exports.CurrencyType = void 0;
4
+ var CurrencyType;
5
+ (function (CurrencyType) {
6
+ CurrencyType["FIAT"] = "FIAT";
7
+ CurrencyType["DIGITAL"] = "DIGITAL";
8
+ })(CurrencyType = exports.CurrencyType || (exports.CurrencyType = {}));
9
+ var DefaultCurrencies;
10
+ (function (DefaultCurrencies) {
11
+ DefaultCurrencies["SOL"] = "SOL";
12
+ })(DefaultCurrencies = exports.DefaultCurrencies || (exports.DefaultCurrencies = {}));
13
+ const toDefaultCurrency = (currency) => {
14
+ if (currency === 'SOL') {
15
+ return DefaultCurrencies.SOL;
16
+ }
17
+ throw new Error(`Currency ${currency} is not supported`);
18
+ };
19
+ exports.toDefaultCurrency = toDefaultCurrency;
20
+ //# sourceMappingURL=currency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../../src/domain/constants/currency.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,mCAAmB,CAAA;AACrB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAED,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,gCAAW,CAAA;AACb,CAAC,EAFW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAE5B;AAEM,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAqB,EAAE;IACvE,IAAI,QAAQ,KAAK,KAAK,EAAE;QACtB,OAAO,iBAAiB,CAAC,GAAG,CAAC;KAC9B;IACD,MAAM,IAAI,KAAK,CAAC,YAAY,QAAQ,mBAAmB,CAAC,CAAC;AAC3D,CAAC,CAAC;AALW,QAAA,iBAAiB,qBAK5B"}
@@ -0,0 +1,3 @@
1
+ export declare enum CurveType {
2
+ LINEAR_V1 = "LINEAR_V1"
3
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CurveType = void 0;
4
+ var CurveType;
5
+ (function (CurveType) {
6
+ CurveType["LINEAR_V1"] = "LINEAR_V1";
7
+ })(CurveType = exports.CurveType || (exports.CurveType = {}));
8
+ //# sourceMappingURL=curveType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"curveType.js","sourceRoot":"","sources":["../../../../src/domain/constants/curveType.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,oCAAuB,CAAA;AACzB,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB"}
@@ -0,0 +1,5 @@
1
+ export declare enum GeneralNetwork {
2
+ MAINNET = "mainnet",
3
+ TESTNET = "testnet",
4
+ DEVNET = "devnet"
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeneralNetwork = void 0;
4
+ var GeneralNetwork;
5
+ (function (GeneralNetwork) {
6
+ GeneralNetwork["MAINNET"] = "mainnet";
7
+ GeneralNetwork["TESTNET"] = "testnet";
8
+ GeneralNetwork["DEVNET"] = "devnet";
9
+ })(GeneralNetwork = exports.GeneralNetwork || (exports.GeneralNetwork = {}));
10
+ //# sourceMappingURL=generalNetwork.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generalNetwork.js","sourceRoot":"","sources":["../../../../src/domain/constants/generalNetwork.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;AACnB,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB"}
@@ -0,0 +1,9 @@
1
+ export * from './blockchain';
2
+ export * from './currency';
3
+ export * from './curveType';
4
+ export * from './generalNetwork';
5
+ export * from './tokenType';
6
+ export * from './tradeDirection';
7
+ export * from './txStatus';
8
+ export * from './txType';
9
+ export * from './txStatusTokenHeaderName';
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./blockchain"), exports);
18
+ __exportStar(require("./currency"), exports);
19
+ __exportStar(require("./curveType"), exports);
20
+ __exportStar(require("./generalNetwork"), exports);
21
+ __exportStar(require("./tokenType"), exports);
22
+ __exportStar(require("./tradeDirection"), exports);
23
+ __exportStar(require("./txStatus"), exports);
24
+ __exportStar(require("./txType"), exports);
25
+ __exportStar(require("./txStatusTokenHeaderName"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,6CAA2B;AAC3B,8CAA4B;AAC5B,mDAAiC;AACjC,8CAA4B;AAC5B,mDAAiC;AACjC,6CAA2B;AAC3B,2CAAyB;AACzB,4DAA0C"}
@@ -0,0 +1,4 @@
1
+ export declare enum TokenType {
2
+ SPL = "SPL",
3
+ TOKEN_EXTENSION = "TOKEN_EXTENSION"
4
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TokenType = void 0;
4
+ var TokenType;
5
+ (function (TokenType) {
6
+ TokenType["SPL"] = "SPL";
7
+ TokenType["TOKEN_EXTENSION"] = "TOKEN_EXTENSION";
8
+ })(TokenType = exports.TokenType || (exports.TokenType = {}));
9
+ //# sourceMappingURL=tokenType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenType.js","sourceRoot":"","sources":["../../../../src/domain/constants/tokenType.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,gDAAmC,CAAA;AACrC,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
@@ -0,0 +1,4 @@
1
+ export declare enum TradeDirection {
2
+ BUY = "BUY",
3
+ SELL = "SELL"
4
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TradeDirection = void 0;
4
+ var TradeDirection;
5
+ (function (TradeDirection) {
6
+ TradeDirection["BUY"] = "BUY";
7
+ TradeDirection["SELL"] = "SELL";
8
+ })(TradeDirection = exports.TradeDirection || (exports.TradeDirection = {}));
9
+ //# sourceMappingURL=tradeDirection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tradeDirection.js","sourceRoot":"","sources":["../../../../src/domain/constants/tradeDirection.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB"}
@@ -0,0 +1,6 @@
1
+ export declare enum TxStatus {
2
+ INITIATED = "INITIATED",
3
+ PENDING = "PENDING",
4
+ SUCCESS = "SUCCESS",
5
+ FAILED = "FAILED"
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TxStatus = void 0;
4
+ var TxStatus;
5
+ (function (TxStatus) {
6
+ TxStatus["INITIATED"] = "INITIATED";
7
+ TxStatus["PENDING"] = "PENDING";
8
+ TxStatus["SUCCESS"] = "SUCCESS";
9
+ TxStatus["FAILED"] = "FAILED";
10
+ })(TxStatus = exports.TxStatus || (exports.TxStatus = {}));
11
+ //# sourceMappingURL=txStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txStatus.js","sourceRoot":"","sources":["../../../../src/domain/constants/txStatus.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,mCAAuB,CAAA;IACvB,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;AACnB,CAAC,EALW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAKnB"}
@@ -0,0 +1 @@
1
+ export declare const txStatusTokenHeaderName = "x-transaction-status-token";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.txStatusTokenHeaderName = void 0;
4
+ exports.txStatusTokenHeaderName = 'x-transaction-status-token';
5
+ //# sourceMappingURL=txStatusTokenHeaderName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txStatusTokenHeaderName.js","sourceRoot":"","sources":["../../../../src/domain/constants/txStatusTokenHeaderName.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,4BAA4B,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare enum TxType {
2
+ MINT = "MINT",
3
+ BUY = "BUY",
4
+ SELL = "SELL",
5
+ MIGRATE = "MIGRATE"
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TxType = void 0;
4
+ var TxType;
5
+ (function (TxType) {
6
+ TxType["MINT"] = "MINT";
7
+ TxType["BUY"] = "BUY";
8
+ TxType["SELL"] = "SELL";
9
+ TxType["MIGRATE"] = "MIGRATE";
10
+ })(TxType = exports.TxType || (exports.TxType = {}));
11
+ //# sourceMappingURL=txType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txType.js","sourceRoot":"","sources":["../../../../src/domain/constants/txType.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,uBAAa,CAAA;IACb,qBAAW,CAAA;IACX,uBAAa,CAAA;IACb,6BAAmB,CAAA;AACrB,CAAC,EALW,MAAM,GAAN,cAAM,KAAN,cAAM,QAKjB"}
@@ -0,0 +1,13 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { CurveType } from '../constants';
3
+ export declare abstract class BaseCurve {
4
+ dynamicThreshold: number;
5
+ curveType: CurveType;
6
+ abstract calculateCostForNTokens(nAmount: bigint, curvePosition: bigint, totalSupply: bigint, decimalNr: number, collateralThreshold: bigint, collateralDecimals: number): bigint | undefined;
7
+ abstract tokensToMigrate(curveAllocation: bigint, totalSupply: bigint, decimals: number, collateralThreshold: bigint, collateralDecimals: number): bigint | undefined;
8
+ abstract tokensToBurn(totalSupply: bigint, allocation: bigint, tokensToMigrate: bigint): bigint | undefined;
9
+ abstract migrationFee(): bigint;
10
+ abstract calculateCurvePrice(curvePosition: bigint, totalSupply: bigint, decimalNr: number, collateralThreshold: bigint, collateralDecimals: number): bigint | undefined;
11
+ abstract getCoefA(totalSupply: bigint, decimalNr: number, collateralThreshold: bigint, collateralDecimals: number): BigNumber;
12
+ abstract getCoefB(collateralDecimals: number): BigNumber;
13
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseCurve = void 0;
4
+ class BaseCurve {
5
+ }
6
+ exports.BaseCurve = BaseCurve;
7
+ //# sourceMappingURL=BaseCurve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseCurve.js","sourceRoot":"","sources":["../../../../src/domain/curves/BaseCurve.ts"],"names":[],"mappings":";;;AAGA,MAAsB,SAAS;CA8C9B;AA9CD,8BA8CC"}
@@ -0,0 +1,16 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { BaseCurve } from './BaseCurve';
3
+ import { CurveDefaults } from './types';
4
+ export declare class LinearCurveV1 extends BaseCurve {
5
+ dynamicThreshold: number;
6
+ maxThreshold: number;
7
+ readonly curveDefaults: CurveDefaults;
8
+ constructor();
9
+ calculateCostForNTokens(nAmount: bigint, curvePosition: bigint, totalSupply: bigint, decimalNr: number, collateralThreshold: bigint, collateralDecimalsNr: number): bigint | undefined;
10
+ tokensToMigrate(curveAllocation: bigint, totalSupply: bigint, decimalsNr: number, collateralThreshold: bigint, collateralDecimalsNr: number): bigint | undefined;
11
+ tokensToBurn(totalSupply: bigint, allocation: bigint, tokensToMigrate: bigint): bigint | undefined;
12
+ migrationFee(): bigint;
13
+ calculateCurvePrice(curvePosition: bigint, totalSupply: bigint, decimalNr: number, collateralThreshold: bigint, collateralDecimalsNr: number): bigint | undefined;
14
+ getCoefA(totalSupply: bigint, decimalNr: number, collateralThreshold: bigint, collateralDecimalsNr: number): BigNumber;
15
+ getCoefB(collateralDecimalsNr: number): BigNumber;
16
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LinearCurveV1 = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const constants_1 = require("../constants");
9
+ const BaseCurve_1 = require("./BaseCurve");
10
+ class LinearCurveV1 extends BaseCurve_1.BaseCurve {
11
+ constructor() {
12
+ super();
13
+ this.dynamicThreshold = 55;
14
+ this.maxThreshold = 65;
15
+ this.curveDefaults = {
16
+ tokenDecimals: 9,
17
+ type: constants_1.CurveType.LINEAR_V1,
18
+ feeBps: 100,
19
+ totalSupply: BigInt(1e18),
20
+ minAllocationTokenAmount: (BigInt(1e18) * BigInt(this.dynamicThreshold)) / 100n,
21
+ maxAllocationTokenAmount: (BigInt(1e18) * BigInt(this.maxThreshold)) / 100n,
22
+ marketCapThreshold: 500n * BigInt(1e9),
23
+ };
24
+ this.curveType = constants_1.CurveType.LINEAR_V1;
25
+ }
26
+ calculateCostForNTokens(nAmount, curvePosition, totalSupply, decimalNr, collateralThreshold, collateralDecimalsNr) {
27
+ const coefA = this.getCoefA(totalSupply, decimalNr, collateralThreshold, collateralDecimalsNr);
28
+ const decimals = new bignumber_js_1.default(10).pow(decimalNr);
29
+ const collateralDecimalValue = new bignumber_js_1.default(10).pow(collateralDecimalsNr);
30
+ const coefficientB = this.getCoefB(collateralDecimalsNr);
31
+ const n = new bignumber_js_1.default(nAmount.toString()).div(decimals);
32
+ const m = new bignumber_js_1.default(curvePosition.toString()).div(decimals);
33
+ const cost = coefA
34
+ .multipliedBy(n)
35
+ .multipliedBy(new bignumber_js_1.default(2).multipliedBy(m).plus(n))
36
+ .plus(coefficientB.multipliedBy(n))
37
+ .multipliedBy(collateralDecimalValue);
38
+ try {
39
+ return BigInt(cost.toFixed(0));
40
+ }
41
+ catch (error) {
42
+ return undefined;
43
+ }
44
+ }
45
+ tokensToMigrate(curveAllocation, totalSupply, decimalsNr, collateralThreshold, collateralDecimalsNr) {
46
+ const coefA = this.getCoefA(totalSupply, decimalsNr, collateralThreshold, collateralDecimalsNr);
47
+ try {
48
+ const decimals = new bignumber_js_1.default(10).pow(decimalsNr);
49
+ const collateralDecimals = new bignumber_js_1.default(10).pow(collateralDecimalsNr);
50
+ const coefficientB = this.getCoefB(collateralDecimalsNr);
51
+ const curveAllocationNormalized = new bignumber_js_1.default(curveAllocation.toString()).div(decimals);
52
+ const feeInSol = new bignumber_js_1.default(this.migrationFee().toString()).div(collateralDecimals);
53
+ const numerator = new bignumber_js_1.default(5)
54
+ .multipliedBy(coefA)
55
+ .multipliedBy(curveAllocationNormalized)
56
+ .multipliedBy(curveAllocationNormalized)
57
+ .plus(coefficientB.multipliedBy(curveAllocationNormalized))
58
+ .minus(feeInSol);
59
+ const denominator = coefA
60
+ .multipliedBy(curveAllocationNormalized)
61
+ .plus(coefficientB);
62
+ return BigInt(numerator.div(denominator).multipliedBy(decimals).toFixed(0));
63
+ }
64
+ catch (error) {
65
+ return undefined;
66
+ }
67
+ }
68
+ tokensToBurn(totalSupply, allocation, tokensToMigrate) {
69
+ if (totalSupply < allocation) {
70
+ return undefined;
71
+ }
72
+ const remainingSupply = totalSupply - allocation;
73
+ if (remainingSupply < tokensToMigrate) {
74
+ return undefined;
75
+ }
76
+ return remainingSupply - tokensToMigrate;
77
+ }
78
+ migrationFee() {
79
+ return BigInt(2000000000);
80
+ }
81
+ calculateCurvePrice(curvePosition, totalSupply, decimalNr, collateralThreshold, collateralDecimalsNr) {
82
+ const coefA = this.getCoefA(totalSupply, decimalNr, collateralThreshold, collateralDecimalsNr);
83
+ const decimals = new bignumber_js_1.default(10).pow(collateralDecimalsNr);
84
+ const x = new bignumber_js_1.default(curvePosition.toString());
85
+ const coefficientB = this.getCoefB(collateralDecimalsNr);
86
+ try {
87
+ const price = coefA
88
+ .multipliedBy(x)
89
+ .div(decimals)
90
+ .plus(coefficientB)
91
+ .multipliedBy(decimals);
92
+ return BigInt(price.toFixed(0));
93
+ }
94
+ catch (error) {
95
+ return undefined;
96
+ }
97
+ }
98
+ getCoefA(totalSupply, decimalNr, collateralThreshold, collateralDecimalsNr) {
99
+ const decimals = new bignumber_js_1.default(10).pow(decimalNr);
100
+ const collateralDecimals = new bignumber_js_1.default(10).pow(collateralDecimalsNr);
101
+ const coefficientB = this.getCoefB(collateralDecimalsNr);
102
+ const dynamicThreshold = new bignumber_js_1.default(this.dynamicThreshold.toString()).div(100);
103
+ const dynamicThresholdInTokens = new bignumber_js_1.default(totalSupply.toString())
104
+ .multipliedBy(dynamicThreshold)
105
+ .div(decimals);
106
+ const collateralThresholdInSol = new bignumber_js_1.default(collateralThreshold.toString()).div(collateralDecimals);
107
+ const numerator = new bignumber_js_1.default(2)
108
+ .multipliedBy(collateralThresholdInSol)
109
+ .minus(new bignumber_js_1.default(2)
110
+ .multipliedBy(coefficientB)
111
+ .multipliedBy(dynamicThresholdInTokens));
112
+ const denominator = dynamicThresholdInTokens;
113
+ return numerator.div(denominator).div(denominator);
114
+ }
115
+ getCoefB(collateralDecimalsNr) {
116
+ return new bignumber_js_1.default(1).dividedBy(new bignumber_js_1.default(10).pow(collateralDecimalsNr));
117
+ }
118
+ }
119
+ exports.LinearCurveV1 = LinearCurveV1;
120
+ //# sourceMappingURL=LinearCurveV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinearCurveV1.js","sourceRoot":"","sources":["../../../../src/domain/curves/LinearCurveV1.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,4CAAyC;AACzC,2CAAwC;AAGxC,MAAa,aAAc,SAAQ,qBAAS;IAgB1C;QACE,KAAK,EAAE,CAAC;QAhBV,qBAAgB,GAAG,EAAE,CAAC;QAEtB,iBAAY,GAAG,EAAE,CAAC;QAET,kBAAa,GAAkB;YACtC,aAAa,EAAE,CAAC;YAChB,IAAI,EAAE,qBAAS,CAAC,SAAS;YACzB,MAAM,EAAE,GAAG;YACX,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC;YACzB,wBAAwB,EACtB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,GAAG,IAAI;YACvD,wBAAwB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI;YAC3E,kBAAkB,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;SAC9B,CAAC;QAIT,IAAI,CAAC,SAAS,GAAG,qBAAS,CAAC,SAAS,CAAC;IACvC,CAAC;IAED,uBAAuB,CACrB,OAAe,EACf,aAAqB,EACrB,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vE,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;QAEzD,MAAM,gBAAgB,GAAG,IAAI,sBAAS,CACpC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CACjC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACX,MAAM,wBAAwB,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;aACnE,YAAY,CAAC,gBAAgB,CAAC;aAC9B,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjB,MAAM,wBAAwB,GAAG,IAAI,sBAAS,CAC5C,mBAAmB,CAAC,QAAQ,EAAE,CAC/B,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAE1B,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC;aAC/B,YAAY,CAAC,wBAAwB,CAAC;aACtC,KAAK,CACJ,IAAI,sBAAS,CAAC,CAAC,CAAC;aACb,YAAY,CAAC,YAAY,CAAC;aAC1B,YAAY,CAAC,wBAAwB,CAAC,CAC1C,CAAC;QAEJ,MAAM,WAAW,GAAG,wBAAwB,CAAC;QAE7C,OAAO,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;IAED,QAAQ,CAAC,oBAA4B;QACnC,OAAO,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAC/B,IAAI,sBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAC5C,CAAC;IACJ,CAAC;CACF;AA5LD,sCA4LC"}
@@ -0,0 +1,3 @@
1
+ export * from './BaseCurve';
2
+ export * from './LinearCurveV1';
3
+ export * from './types';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BaseCurve"), exports);
18
+ __exportStar(require("./LinearCurveV1"), exports);
19
+ __exportStar(require("./types"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/curves/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC;AAChC,0CAAwB"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const LinearCurveV1_1 = require("../LinearCurveV1");
4
+ describe('LinearCurveV1', () => {
5
+ let curve;
6
+ const totalSupply = BigInt((1e18).toString());
7
+ const decimalNr = 9;
8
+ const collateralThreshold = BigInt(200e9);
9
+ const collateralDecimals = 9;
10
+ beforeAll(() => {
11
+ curve = new LinearCurveV1_1.LinearCurveV1();
12
+ });
13
+ describe('getCoeeficientA', () => {
14
+ it('should get coefficient a value', () => {
15
+ const coefA = curve.getCoefA(totalSupply, decimalNr, collateralThreshold, collateralDecimals);
16
+ expect(coefA.toNumber()).toBeGreaterThan(1e-15);
17
+ expect(coefA.toNumber()).toBeLessThan(2e-15);
18
+ });
19
+ });
20
+ describe('calculateCostForNTokens', () => {
21
+ it('should calculate the correct cost for 1e6 tokens', () => {
22
+ const nAmount = BigInt(1e12);
23
+ const curvePosition = BigInt(0);
24
+ const expectedCost = curve.calculateCostForNTokens(nAmount, curvePosition, totalSupply, decimalNr, collateralThreshold, collateralDecimals);
25
+ expect(expectedCost).toBe(BigInt(1001));
26
+ });
27
+ });
28
+ describe('tokensToBurn', () => {
29
+ it('should calculate the correct tokens to burn after migration', () => {
30
+ const allocation = BigInt(1e12);
31
+ const tokensToMigrate = BigInt(2e17);
32
+ const expectedBurn = curve.tokensToBurn(totalSupply, allocation, tokensToMigrate);
33
+ expect(expectedBurn).toBeDefined();
34
+ });
35
+ });
36
+ describe('tokensToMigrate', () => {
37
+ it('should calculate the correct tokens to migrate based on allocation', () => {
38
+ const curveAllocation = BigInt(5.5e17);
39
+ const expectedMigrate = curve.tokensToMigrate(curveAllocation, totalSupply, decimalNr, collateralThreshold, collateralDecimals);
40
+ expect(expectedMigrate).toBeDefined();
41
+ });
42
+ });
43
+ describe('tokensToBurn', () => {
44
+ it('should calculate the correct tokens to burn after migration', () => {
45
+ const allocation = BigInt(1e6);
46
+ const tokensToMigrate = BigInt(500000);
47
+ const expectedBurn = curve.tokensToBurn(totalSupply, allocation, tokensToMigrate);
48
+ expect(expectedBurn).toBeDefined();
49
+ });
50
+ });
51
+ });
52
+ //# sourceMappingURL=LinearCurveV1.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinearCurveV1.spec.js","sourceRoot":"","sources":["../../../../../src/domain/curves/tests/LinearCurveV1.spec.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AAEjD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,KAAoB,CAAC;IACzB,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,CAAC,CAAC;IACpB,MAAM,mBAAmB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,kBAAkB,GAAG,CAAC,CAAC;IAE7B,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,GAAG,IAAI,6BAA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AAC,WAAW,EAAE,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;YAC5E,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YACvC,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,CAC3C,eAAe,EACf,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,kBAAkB,CACnB,CAAC;YACF,MAAM,CAAC,eAAe,CAAC,CAAC,WAAW,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;YACrE,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YACvC,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CACrC,WAAW,EACX,UAAU,EACV,eAAe,CAChB,CAAC;YACF,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { CurveType, DefaultCurrencies } from '../constants';
2
+ export declare type CurveDefaults = {
3
+ tokenDecimals: number;
4
+ type: CurveType;
5
+ feeBps: number;
6
+ totalSupply: bigint;
7
+ minAllocationTokenAmount: bigint;
8
+ maxAllocationTokenAmount: bigint;
9
+ marketCapThreshold: bigint;
10
+ };
11
+ export declare enum ContractCurrency {
12
+ SOL = 0
13
+ }
14
+ export declare enum ContractCurveType {
15
+ LINEAR_V1 = 0
16
+ }
17
+ export declare const toContractCurrency: (currency: DefaultCurrencies) => ContractCurrency;
18
+ export declare const toContractCurveType: (curveType: CurveType) => ContractCurveType;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toContractCurveType = exports.toContractCurrency = exports.ContractCurveType = exports.ContractCurrency = void 0;
4
+ const constants_1 = require("../constants");
5
+ var ContractCurrency;
6
+ (function (ContractCurrency) {
7
+ ContractCurrency[ContractCurrency["SOL"] = 0] = "SOL";
8
+ })(ContractCurrency = exports.ContractCurrency || (exports.ContractCurrency = {}));
9
+ var ContractCurveType;
10
+ (function (ContractCurveType) {
11
+ ContractCurveType[ContractCurveType["LINEAR_V1"] = 0] = "LINEAR_V1";
12
+ })(ContractCurveType = exports.ContractCurveType || (exports.ContractCurveType = {}));
13
+ const toContractCurrency = (currency) => {
14
+ switch (currency) {
15
+ case constants_1.DefaultCurrencies.SOL:
16
+ return ContractCurrency.SOL;
17
+ default:
18
+ throw new Error(`Unknown curve type: ${currency}`);
19
+ }
20
+ };
21
+ exports.toContractCurrency = toContractCurrency;
22
+ const toContractCurveType = (curveType) => {
23
+ switch (curveType) {
24
+ case constants_1.CurveType.LINEAR_V1:
25
+ return ContractCurveType.LINEAR_V1;
26
+ default:
27
+ throw new Error(`Unknown curve type: ${curveType}`);
28
+ }
29
+ };
30
+ exports.toContractCurveType = toContractCurveType;
31
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/domain/curves/types.ts"],"names":[],"mappings":";;;AAAA,4CAA4D;AAY5D,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,qDAAO,CAAA;AACT,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAE3B;AAED,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,mEAAa,CAAA;AACf,CAAC,EAFW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAE5B;AAEM,MAAM,kBAAkB,GAAG,CAChC,QAA2B,EACT,EAAE;IACpB,QAAQ,QAAQ,EAAE;QAChB,KAAK,6BAAiB,CAAC,GAAG;YACxB,OAAO,gBAAgB,CAAC,GAAG,CAAC;QAC9B;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAC;KACtD;AACH,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B;AAEK,MAAM,mBAAmB,GAAG,CACjC,SAAoB,EACD,EAAE;IACrB,QAAQ,SAAS,EAAE;QACjB,KAAK,qBAAS,CAAC,SAAS;YACtB,OAAO,iBAAiB,CAAC,SAAS,CAAC;QACrC;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,SAAS,EAAE,CAAC,CAAC;KACvD;AACH,CAAC,CAAC;AATW,QAAA,mBAAmB,uBAS9B"}
@@ -0,0 +1,3 @@
1
+ export * from './model';
2
+ export * from './constants';
3
+ export * from './curves';