@heliofi/launchpad-common 0.0.2 → 0.0.8
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/dist/src/domain/curves/BaseCurve.d.ts +7 -5
- package/dist/src/domain/curves/BaseCurve.js.map +1 -1
- package/dist/src/domain/curves/LinearCurveV1.d.ts +6 -5
- package/dist/src/domain/curves/LinearCurveV1.js +57 -59
- package/dist/src/domain/curves/LinearCurveV1.js.map +1 -1
- package/dist/src/domain/curves/getCurve.d.ts +3 -0
- package/dist/src/domain/curves/getCurve.js +13 -0
- package/dist/src/domain/curves/getCurve.js.map +1 -0
- package/dist/src/domain/curves/index.d.ts +1 -0
- package/dist/src/domain/curves/index.js +1 -0
- package/dist/src/domain/curves/index.js.map +1 -1
- package/dist/src/domain/curves/tests/LinearCurveV1.spec.js +21 -16
- package/dist/src/domain/curves/tests/LinearCurveV1.spec.js.map +1 -1
- package/dist/src/domain/curves/types.d.ts +10 -0
- package/dist/src/domain/curves/types.js.map +1 -1
- package/dist/src/domain/model/buy/prepare/dtos/BuyTxPrepare.dto.d.ts +2 -5
- package/dist/src/domain/model/buy/prepare/dtos/BuyTxPrepare.dto.js +2 -34
- package/dist/src/domain/model/buy/prepare/dtos/BuyTxPrepare.dto.js.map +1 -1
- package/dist/src/domain/model/buy/prepare/entities/BuyTxPrepareResponse.entity.d.ts +2 -4
- package/dist/src/domain/model/buy/prepare/entities/BuyTxPrepareResponse.entity.js +2 -2
- package/dist/src/domain/model/buy/prepare/entities/BuyTxPrepareResponse.entity.js.map +1 -1
- package/dist/src/domain/model/buy/submit/entities/BuyTxSubmitResponse.entity.js.map +1 -1
- package/dist/src/domain/model/curve/dtos/CreateCurve.dto.d.ts +1 -0
- package/dist/src/domain/model/curve/dtos/CreateCurve.dto.js +5 -0
- package/dist/src/domain/model/curve/dtos/CreateCurve.dto.js.map +1 -1
- package/dist/src/domain/model/curve/entities/Curve.entity.d.ts +1 -0
- package/dist/src/domain/model/curve/entities/Curve.entity.js.map +1 -1
- package/dist/src/domain/model/curve/entities/CurvePositionResponse.entity.d.ts +4 -0
- package/dist/src/domain/model/curve/entities/CurvePositionResponse.entity.js +8 -0
- package/dist/src/domain/model/curve/entities/CurvePositionResponse.entity.js.map +1 -0
- package/dist/src/domain/model/curve/entities/index.d.ts +1 -0
- package/dist/src/domain/model/curve/entities/index.js +1 -0
- package/dist/src/domain/model/curve/entities/index.js.map +1 -1
- package/dist/src/domain/model/index.d.ts +3 -2
- package/dist/src/domain/model/index.js +3 -2
- package/dist/src/domain/model/index.js.map +1 -1
- package/dist/src/domain/model/sell/index.d.ts +2 -0
- package/dist/src/domain/model/sell/index.js +19 -0
- package/dist/src/domain/model/sell/index.js.map +1 -0
- package/dist/src/domain/model/sell/prepare/dtos/SellTxPrepare.dto.d.ts +3 -0
- package/dist/src/domain/model/sell/prepare/dtos/SellTxPrepare.dto.js +8 -0
- package/dist/src/domain/model/sell/prepare/dtos/SellTxPrepare.dto.js.map +1 -0
- package/dist/src/domain/model/sell/prepare/dtos/index.d.ts +1 -0
- package/dist/src/domain/model/sell/prepare/dtos/index.js +18 -0
- package/dist/src/domain/model/sell/prepare/dtos/index.js.map +1 -0
- package/dist/src/domain/model/sell/prepare/entities/SellTxPrepareResponse.entity.d.ts +5 -0
- package/dist/src/domain/model/sell/prepare/entities/SellTxPrepareResponse.entity.js +8 -0
- package/dist/src/domain/model/sell/prepare/entities/SellTxPrepareResponse.entity.js.map +1 -0
- package/dist/src/domain/model/sell/prepare/entities/index.d.ts +1 -0
- package/dist/src/domain/model/sell/prepare/entities/index.js +18 -0
- package/dist/src/domain/model/sell/prepare/entities/index.js.map +1 -0
- package/dist/src/domain/model/sell/prepare/index.d.ts +2 -0
- package/dist/src/domain/model/sell/prepare/index.js +19 -0
- package/dist/src/domain/model/sell/prepare/index.js.map +1 -0
- package/dist/src/domain/model/sell/submit/dtos/SellTxSubmit.dto.d.ts +3 -0
- package/dist/src/domain/model/sell/submit/dtos/SellTxSubmit.dto.js +8 -0
- package/dist/src/domain/model/sell/submit/dtos/SellTxSubmit.dto.js.map +1 -0
- package/dist/src/domain/model/sell/submit/dtos/index.d.ts +1 -0
- package/dist/src/domain/model/sell/submit/dtos/index.js +18 -0
- package/dist/src/domain/model/sell/submit/dtos/index.js.map +1 -0
- package/dist/src/domain/model/sell/submit/entities/SellTxSubmitResponse.entity.d.ts +3 -0
- package/dist/src/domain/model/sell/submit/entities/SellTxSubmitResponse.entity.js +8 -0
- package/dist/src/domain/model/sell/submit/entities/SellTxSubmitResponse.entity.js.map +1 -0
- package/dist/src/domain/model/sell/submit/entities/index.d.ts +1 -0
- package/dist/src/domain/model/sell/submit/entities/index.js +18 -0
- package/dist/src/domain/model/sell/submit/entities/index.js.map +1 -0
- package/dist/src/domain/model/sell/submit/index.d.ts +2 -0
- package/dist/src/domain/model/sell/submit/index.js +19 -0
- package/dist/src/domain/model/sell/submit/index.js.map +1 -0
- package/dist/src/domain/model/tx/index.d.ts +1 -0
- package/dist/src/domain/model/tx/index.js +1 -0
- package/dist/src/domain/model/tx/index.js.map +1 -1
- package/dist/src/domain/model/tx/prepare/dtos/BaseTxPrepare.dto.d.ts +5 -0
- package/dist/src/domain/model/tx/prepare/dtos/BaseTxPrepare.dto.js +33 -0
- package/dist/src/domain/model/tx/prepare/dtos/BaseTxPrepare.dto.js.map +1 -0
- package/dist/src/domain/model/tx/prepare/dtos/index.d.ts +1 -0
- package/dist/src/domain/model/tx/prepare/dtos/index.js +18 -0
- package/dist/src/domain/model/tx/prepare/dtos/index.js.map +1 -0
- package/dist/src/domain/model/tx/prepare/entities/BaseTxPrepareResponse.entity.d.ts +5 -0
- package/dist/src/domain/model/tx/prepare/entities/BaseTxPrepareResponse.entity.js +8 -0
- package/dist/src/domain/model/tx/prepare/entities/BaseTxPrepareResponse.entity.js.map +1 -0
- package/dist/src/domain/model/tx/prepare/entities/index.d.ts +1 -0
- package/dist/src/domain/model/tx/prepare/entities/index.js +18 -0
- package/dist/src/domain/model/tx/prepare/entities/index.js.map +1 -0
- package/dist/src/domain/model/tx/prepare/index.d.ts +2 -0
- package/dist/src/domain/model/tx/prepare/index.js +19 -0
- package/dist/src/domain/model/tx/prepare/index.js.map +1 -0
- package/dist/src/domain/model/tx-token-payload/TxTokenPayload.d.ts +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { CurveType } from '../constants';
|
|
3
|
+
import { CalculatePriceOptions } from './types';
|
|
3
4
|
export declare abstract class BaseCurve {
|
|
4
5
|
dynamicThreshold: number;
|
|
6
|
+
curveLimit: number;
|
|
5
7
|
curveType: CurveType;
|
|
6
|
-
abstract calculateCostForNTokens(
|
|
7
|
-
abstract tokensToMigrate(
|
|
8
|
+
abstract calculateCostForNTokens(options: CalculatePriceOptions): bigint | undefined;
|
|
9
|
+
abstract tokensToMigrate(coefA: BigNumber, coefB: BigNumber, allocation: bigint, decimalsNr: number, migrationFee: number): bigint | undefined;
|
|
8
10
|
abstract tokensToBurn(totalSupply: bigint, allocation: bigint, tokensToMigrate: bigint): bigint | undefined;
|
|
9
11
|
abstract migrationFee(): bigint;
|
|
10
|
-
abstract calculateCurvePrice(
|
|
11
|
-
abstract getCoefA(totalSupply: bigint, decimalNr: number,
|
|
12
|
-
abstract getCoefB(
|
|
12
|
+
abstract calculateCurvePrice(coefA: BigNumber, coefB: BigNumber, curvePosition: bigint, collateralDecimals: number): bigint | undefined;
|
|
13
|
+
abstract getCoefA(coef_b: BigNumber, totalSupply: bigint, decimalNr: number, marketcapThreshold: bigint, marketcapDecimalNr: number): BigNumber;
|
|
14
|
+
abstract getCoefB(collateralDecimalsNr: number): BigNumber;
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCurve.js","sourceRoot":"","sources":["../../../../src/domain/curves/BaseCurve.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"BaseCurve.js","sourceRoot":"","sources":["../../../../src/domain/curves/BaseCurve.ts"],"names":[],"mappings":";;;AAIA,MAAsB,SAAS;CA2C9B;AA3CD,8BA2CC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { BaseCurve } from './BaseCurve';
|
|
3
|
-
import { CurveDefaults } from './types';
|
|
3
|
+
import { CalculatePriceOptions, CurveDefaults } from './types';
|
|
4
4
|
export declare class LinearCurveV1 extends BaseCurve {
|
|
5
5
|
dynamicThreshold: number;
|
|
6
6
|
maxThreshold: number;
|
|
7
|
+
curveLimit: number;
|
|
7
8
|
readonly curveDefaults: CurveDefaults;
|
|
8
9
|
constructor();
|
|
9
|
-
calculateCostForNTokens(
|
|
10
|
-
tokensToMigrate(
|
|
10
|
+
calculateCostForNTokens(options: CalculatePriceOptions): bigint | undefined;
|
|
11
|
+
tokensToMigrate(coefA: BigNumber, coefB: BigNumber, allocation: bigint, decimalsNr: number, migrationFee: number): bigint | undefined;
|
|
11
12
|
tokensToBurn(totalSupply: bigint, allocation: bigint, tokensToMigrate: bigint): bigint | undefined;
|
|
12
13
|
migrationFee(): bigint;
|
|
13
|
-
calculateCurvePrice(
|
|
14
|
-
getCoefA(totalSupply: bigint, decimalNr: number,
|
|
14
|
+
calculateCurvePrice(coefA: BigNumber, coefB: BigNumber, curvePosition: bigint, collateralDecimals: number): bigint | undefined;
|
|
15
|
+
getCoefA(coefB: BigNumber, totalSupply: bigint, decimalNr: number, marketcapThreshold: bigint, marketcapDecimalNr: number): BigNumber;
|
|
15
16
|
getCoefB(collateralDecimalsNr: number): BigNumber;
|
|
16
17
|
}
|
|
@@ -7,11 +7,13 @@ exports.LinearCurveV1 = void 0;
|
|
|
7
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const BaseCurve_1 = require("./BaseCurve");
|
|
10
|
+
bignumber_js_1.default.config({ DECIMAL_PLACES: 28 });
|
|
10
11
|
class LinearCurveV1 extends BaseCurve_1.BaseCurve {
|
|
11
12
|
constructor() {
|
|
12
13
|
super();
|
|
13
14
|
this.dynamicThreshold = 55;
|
|
14
15
|
this.maxThreshold = 65;
|
|
16
|
+
this.curveLimit = 3300;
|
|
15
17
|
this.curveDefaults = {
|
|
16
18
|
tokenDecimals: 9,
|
|
17
19
|
type: constants_1.CurveType.LINEAR_V1,
|
|
@@ -20,48 +22,50 @@ class LinearCurveV1 extends BaseCurve_1.BaseCurve {
|
|
|
20
22
|
minAllocationTokenAmount: (BigInt(1e18) * BigInt(this.dynamicThreshold)) / 100n,
|
|
21
23
|
maxAllocationTokenAmount: (BigInt(1e18) * BigInt(this.maxThreshold)) / 100n,
|
|
22
24
|
marketCapThreshold: 500n * BigInt(1e9),
|
|
25
|
+
address: '11111111111111111111111111111111',
|
|
23
26
|
};
|
|
24
27
|
this.curveType = constants_1.CurveType.LINEAR_V1;
|
|
25
28
|
}
|
|
26
|
-
calculateCostForNTokens(
|
|
27
|
-
const coefA
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
29
|
+
calculateCostForNTokens(options) {
|
|
30
|
+
const { coefA, coefB, nAmount, curvePosition, decimalsNr, collateralDecimalsNr, } = options;
|
|
31
|
+
const tokenDecimals = new bignumber_js_1.default(10).pow(decimalsNr);
|
|
32
|
+
const collateralDecimals = new bignumber_js_1.default(10).pow(collateralDecimalsNr);
|
|
33
|
+
const n = new bignumber_js_1.default(nAmount.toString()).dividedBy(tokenDecimals);
|
|
34
|
+
const m = new bignumber_js_1.default(curvePosition.toString()).dividedBy(tokenDecimals);
|
|
35
|
+
const two = new bignumber_js_1.default(2);
|
|
36
|
+
const half = new bignumber_js_1.default(0.5);
|
|
37
|
+
const result = half
|
|
38
|
+
.multipliedBy(coefA)
|
|
34
39
|
.multipliedBy(n)
|
|
35
|
-
.multipliedBy(
|
|
36
|
-
.plus(
|
|
37
|
-
.multipliedBy(
|
|
40
|
+
.multipliedBy(two.multipliedBy(m).plus(n))
|
|
41
|
+
.plus(coefB.multipliedBy(n))
|
|
42
|
+
.multipliedBy(collateralDecimals);
|
|
38
43
|
try {
|
|
39
|
-
return BigInt(
|
|
44
|
+
return BigInt(result.toFixed(0));
|
|
40
45
|
}
|
|
41
|
-
catch (
|
|
46
|
+
catch (e) {
|
|
42
47
|
return undefined;
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
|
-
tokensToMigrate(
|
|
46
|
-
const
|
|
50
|
+
tokensToMigrate(coefA, coefB, allocation, decimalsNr, migrationFee) {
|
|
51
|
+
const decimalsPow = new bignumber_js_1.default(10).pow(decimalsNr);
|
|
52
|
+
const curveAllocationNormalized = new bignumber_js_1.default(allocation.toString()).dividedBy(decimalsPow);
|
|
53
|
+
const feeInCollateral = new bignumber_js_1.default(migrationFee).dividedBy(decimalsPow);
|
|
54
|
+
const half = new bignumber_js_1.default(0.5);
|
|
55
|
+
const numerator = half
|
|
56
|
+
.multipliedBy(coefA)
|
|
57
|
+
.multipliedBy(curveAllocationNormalized)
|
|
58
|
+
.multipliedBy(curveAllocationNormalized)
|
|
59
|
+
.plus(coefB.multipliedBy(curveAllocationNormalized))
|
|
60
|
+
.minus(feeInCollateral);
|
|
61
|
+
const denominator = coefA
|
|
62
|
+
.multipliedBy(curveAllocationNormalized)
|
|
63
|
+
.plus(coefB);
|
|
64
|
+
const result = numerator.dividedBy(denominator).multipliedBy(decimalsPow);
|
|
47
65
|
try {
|
|
48
|
-
|
|
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));
|
|
66
|
+
return BigInt(result.toFixed(0));
|
|
63
67
|
}
|
|
64
|
-
catch (
|
|
68
|
+
catch (e) {
|
|
65
69
|
return undefined;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
@@ -69,48 +73,42 @@ class LinearCurveV1 extends BaseCurve_1.BaseCurve {
|
|
|
69
73
|
if (totalSupply < allocation) {
|
|
70
74
|
return undefined;
|
|
71
75
|
}
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
76
|
+
const remaining_supply = totalSupply - allocation;
|
|
77
|
+
if (remaining_supply < tokensToMigrate) {
|
|
74
78
|
return undefined;
|
|
75
79
|
}
|
|
76
|
-
return
|
|
80
|
+
return remaining_supply - tokensToMigrate;
|
|
77
81
|
}
|
|
78
82
|
migrationFee() {
|
|
79
83
|
return BigInt(2000000000);
|
|
80
84
|
}
|
|
81
|
-
calculateCurvePrice(
|
|
82
|
-
const
|
|
83
|
-
const decimals = new bignumber_js_1.default(10).pow(collateralDecimalsNr);
|
|
85
|
+
calculateCurvePrice(coefA, coefB, curvePosition, collateralDecimals) {
|
|
86
|
+
const decimals = new bignumber_js_1.default(10).pow(collateralDecimals);
|
|
84
87
|
const x = new bignumber_js_1.default(curvePosition.toString());
|
|
85
|
-
const
|
|
88
|
+
const price = coefA
|
|
89
|
+
.multipliedBy(x)
|
|
90
|
+
.dividedBy(decimals)
|
|
91
|
+
.plus(coefB)
|
|
92
|
+
.multipliedBy(decimals);
|
|
86
93
|
try {
|
|
87
|
-
const price = coefA
|
|
88
|
-
.multipliedBy(x)
|
|
89
|
-
.div(decimals)
|
|
90
|
-
.plus(coefficientB)
|
|
91
|
-
.multipliedBy(decimals);
|
|
92
94
|
return BigInt(price.toFixed(0));
|
|
93
95
|
}
|
|
94
|
-
catch (
|
|
96
|
+
catch (e) {
|
|
95
97
|
return undefined;
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
|
-
getCoefA(totalSupply, decimalNr,
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
const dynamicThresholdInTokens = new bignumber_js_1.default(totalSupply.toString())
|
|
100
|
+
getCoefA(coefB, totalSupply, decimalNr, marketcapThreshold, marketcapDecimalNr) {
|
|
101
|
+
const tokenDecimals = new bignumber_js_1.default(10).pow(decimalNr);
|
|
102
|
+
const marketcapDecimals = new bignumber_js_1.default(10).pow(marketcapDecimalNr);
|
|
103
|
+
const dynamicThreshold = new bignumber_js_1.default(this.dynamicThreshold.toString()).dividedBy(100);
|
|
104
|
+
const dynamicThresholdInWholeUnit = new bignumber_js_1.default(totalSupply.toString())
|
|
104
105
|
.multipliedBy(dynamicThreshold)
|
|
105
|
-
.
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
.
|
|
109
|
-
.minus(
|
|
110
|
-
.
|
|
111
|
-
.multipliedBy(dynamicThresholdInTokens));
|
|
112
|
-
const denominator = dynamicThresholdInTokens;
|
|
113
|
-
return numerator.div(denominator).div(denominator);
|
|
106
|
+
.dividedBy(tokenDecimals);
|
|
107
|
+
const marketcapThresholdInWholeUnit = new bignumber_js_1.default(marketcapThreshold.toString()).dividedBy(marketcapDecimals);
|
|
108
|
+
return marketcapThresholdInWholeUnit
|
|
109
|
+
.dividedBy(dynamicThresholdInWholeUnit)
|
|
110
|
+
.minus(coefB)
|
|
111
|
+
.dividedBy(dynamicThresholdInWholeUnit);
|
|
114
112
|
}
|
|
115
113
|
getCoefB(collateralDecimalsNr) {
|
|
116
114
|
return new bignumber_js_1.default(1).dividedBy(new bignumber_js_1.default(10).pow(collateralDecimalsNr));
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"LinearCurveV1.js","sourceRoot":"","sources":["../../../../src/domain/curves/LinearCurveV1.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,4CAAyC;AACzC,2CAAwC;AAGxC,sBAAS,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;AAEzC,MAAa,aAAc,SAAQ,qBAAS;IAmB1C;QACE,KAAK,EAAE,CAAC;QAnBV,qBAAgB,GAAG,EAAE,CAAC;QAEtB,iBAAY,GAAG,EAAE,CAAC;QAElB,eAAU,GAAG,IAAK,CAAC;QAEV,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;YACtC,OAAO,EAAE,kCAAkC;SACnC,CAAC;QAIT,IAAI,CAAC,SAAS,GAAG,qBAAS,CAAC,SAAS,CAAC;IACvC,CAAC;IAED,uBAAuB,CAAC,OAA8B;QAC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C,2BAA2B,CAAC;aACtC,KAAK,CAAC,KAAK,CAAC;aACZ,SAAS,CAAC,2BAA2B,CAAC,CAAC;IAC5C,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;AA/KD,sCA+KC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurve = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const LinearCurveV1_1 = require("./LinearCurveV1");
|
|
6
|
+
const getCurve = (curveType) => {
|
|
7
|
+
if (curveType === constants_1.CurveType.LINEAR_V1) {
|
|
8
|
+
return new LinearCurveV1_1.LinearCurveV1();
|
|
9
|
+
}
|
|
10
|
+
throw new Error('Curve type not supported');
|
|
11
|
+
};
|
|
12
|
+
exports.getCurve = getCurve;
|
|
13
|
+
//# sourceMappingURL=getCurve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurve.js","sourceRoot":"","sources":["../../../../src/domain/curves/getCurve.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAEzC,mDAAgD;AAEzC,MAAM,QAAQ,GAAG,CAAC,SAAoB,EAAa,EAAE;IAC1D,IAAI,SAAS,KAAK,qBAAS,CAAC,SAAS,EAAE;QACrC,OAAO,IAAI,6BAAa,EAAE,CAAC;KAC5B;IACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC9C,CAAC,CAAC;AALW,QAAA,QAAQ,YAKnB"}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./BaseCurve"), exports);
|
|
18
18
|
__exportStar(require("./LinearCurveV1"), exports);
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./getCurve"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/curves/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC;AAChC,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/curves/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC;AAChC,0CAAwB;AACxB,6CAA2B"}
|
|
@@ -4,15 +4,21 @@ const LinearCurveV1_1 = require("../LinearCurveV1");
|
|
|
4
4
|
describe('LinearCurveV1', () => {
|
|
5
5
|
let curve;
|
|
6
6
|
const totalSupply = BigInt((1e18).toString());
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const decimalsNr = 9;
|
|
8
|
+
const marketcapThreshold = BigInt(500e9);
|
|
9
|
+
const marketcapDecimalsNr = 9;
|
|
10
|
+
const collateralDecimalsNr = 9;
|
|
11
|
+
const migrationFee = 2;
|
|
12
|
+
let coefA;
|
|
13
|
+
let coefB;
|
|
10
14
|
beforeAll(() => {
|
|
11
15
|
curve = new LinearCurveV1_1.LinearCurveV1();
|
|
12
16
|
});
|
|
13
|
-
describe('
|
|
14
|
-
it('should get coefficient a value', () => {
|
|
15
|
-
|
|
17
|
+
describe('getCoeficients', () => {
|
|
18
|
+
it('should get coefficient a and b value', () => {
|
|
19
|
+
coefB = curve.getCoefB(collateralDecimalsNr);
|
|
20
|
+
expect(coefB.toNumber()).toBe(1e-9);
|
|
21
|
+
coefA = curve.getCoefA(coefB, totalSupply, decimalsNr, marketcapThreshold, marketcapDecimalsNr);
|
|
16
22
|
expect(coefA.toNumber()).toBeGreaterThan(1e-15);
|
|
17
23
|
expect(coefA.toNumber()).toBeLessThan(2e-15);
|
|
18
24
|
});
|
|
@@ -21,22 +27,21 @@ describe('LinearCurveV1', () => {
|
|
|
21
27
|
it('should calculate the correct cost for 1e6 tokens', () => {
|
|
22
28
|
const nAmount = BigInt(1e12);
|
|
23
29
|
const curvePosition = BigInt(0);
|
|
24
|
-
const expectedCost = curve.calculateCostForNTokens(
|
|
30
|
+
const expectedCost = curve.calculateCostForNTokens({
|
|
31
|
+
coefA,
|
|
32
|
+
coefB,
|
|
33
|
+
nAmount,
|
|
34
|
+
curvePosition,
|
|
35
|
+
decimalsNr,
|
|
36
|
+
collateralDecimalsNr,
|
|
37
|
+
});
|
|
25
38
|
expect(expectedCost).toBe(BigInt(1001));
|
|
26
39
|
});
|
|
27
40
|
});
|
|
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
41
|
describe('tokensToMigrate', () => {
|
|
37
42
|
it('should calculate the correct tokens to migrate based on allocation', () => {
|
|
38
43
|
const curveAllocation = BigInt(5.5e17);
|
|
39
|
-
const expectedMigrate = curve.tokensToMigrate(
|
|
44
|
+
const expectedMigrate = curve.tokensToMigrate(coefA, coefB, curveAllocation, decimalsNr, migrationFee);
|
|
40
45
|
expect(expectedMigrate).toBeDefined();
|
|
41
46
|
});
|
|
42
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinearCurveV1.spec.js","sourceRoot":"","sources":["../../../../../src/domain/curves/tests/LinearCurveV1.spec.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"LinearCurveV1.spec.js","sourceRoot":"","sources":["../../../../../src/domain/curves/tests/LinearCurveV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../constants';
|
|
2
3
|
export declare type CurveDefaults = {
|
|
3
4
|
tokenDecimals: number;
|
|
@@ -7,6 +8,7 @@ export declare type CurveDefaults = {
|
|
|
7
8
|
minAllocationTokenAmount: bigint;
|
|
8
9
|
maxAllocationTokenAmount: bigint;
|
|
9
10
|
marketCapThreshold: bigint;
|
|
11
|
+
address: string;
|
|
10
12
|
};
|
|
11
13
|
export declare enum ContractCurrency {
|
|
12
14
|
SOL = 0
|
|
@@ -16,3 +18,11 @@ export declare enum ContractCurveType {
|
|
|
16
18
|
}
|
|
17
19
|
export declare const toContractCurrency: (currency: DefaultCurrencies) => ContractCurrency;
|
|
18
20
|
export declare const toContractCurveType: (curveType: CurveType) => ContractCurveType;
|
|
21
|
+
export interface CalculatePriceOptions {
|
|
22
|
+
coefA: BigNumber;
|
|
23
|
+
coefB: BigNumber;
|
|
24
|
+
nAmount: bigint;
|
|
25
|
+
curvePosition: bigint;
|
|
26
|
+
decimalsNr: number;
|
|
27
|
+
collateralDecimalsNr: number;
|
|
28
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/domain/curves/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/domain/curves/types.ts"],"names":[],"mappings":";;;AACA,4CAA4D;AAa5D,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"}
|
|
@@ -1,40 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.BuyTxPrepareDto = void 0;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
class BuyTxPrepareDto {
|
|
4
|
+
const prepare_1 = require("../../../tx/prepare");
|
|
5
|
+
class BuyTxPrepareDto extends prepare_1.BaseTxPrepareDto {
|
|
16
6
|
}
|
|
17
|
-
__decorate([
|
|
18
|
-
(0, class_validator_1.IsString)(),
|
|
19
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
20
|
-
__metadata("design:type", String)
|
|
21
|
-
], BuyTxPrepareDto.prototype, "creatorPK", void 0);
|
|
22
|
-
__decorate([
|
|
23
|
-
(0, class_transformer_1.Transform)(({ value }) => BigInt(value)),
|
|
24
|
-
(0, class_validator_1.IsString)(),
|
|
25
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], BuyTxPrepareDto.prototype, "amount", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, class_transformer_1.Transform)(({ value }) => BigInt(value)),
|
|
30
|
-
(0, class_validator_1.IsString)(),
|
|
31
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
32
|
-
__metadata("design:type", String)
|
|
33
|
-
], BuyTxPrepareDto.prototype, "collateralAmount", void 0);
|
|
34
|
-
__decorate([
|
|
35
|
-
(0, class_validator_1.IsNumber)(),
|
|
36
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
37
|
-
__metadata("design:type", Number)
|
|
38
|
-
], BuyTxPrepareDto.prototype, "slippageBps", void 0);
|
|
39
7
|
exports.BuyTxPrepareDto = BuyTxPrepareDto;
|
|
40
8
|
//# sourceMappingURL=BuyTxPrepare.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyTxPrepare.dto.js","sourceRoot":"","sources":["../../../../../../../src/domain/model/buy/prepare/dtos/BuyTxPrepare.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BuyTxPrepare.dto.js","sourceRoot":"","sources":["../../../../../../../src/domain/model/buy/prepare/dtos/BuyTxPrepare.dto.ts"],"names":[],"mappings":";;;AAAA,iDAAuD;AAEvD,MAAa,eAAgB,SAAQ,0BAAgB;CAAG;AAAxD,0CAAwD"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class BuyTxPrepareResponse extends
|
|
3
|
-
transaction: string;
|
|
4
|
-
token: string;
|
|
1
|
+
import { BaseTxPrepareResponse } from '../../../tx/prepare';
|
|
2
|
+
export declare class BuyTxPrepareResponse extends BaseTxPrepareResponse {
|
|
5
3
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuyTxPrepareResponse = void 0;
|
|
4
|
-
const
|
|
5
|
-
class BuyTxPrepareResponse extends
|
|
4
|
+
const prepare_1 = require("../../../tx/prepare");
|
|
5
|
+
class BuyTxPrepareResponse extends prepare_1.BaseTxPrepareResponse {
|
|
6
6
|
}
|
|
7
7
|
exports.BuyTxPrepareResponse = BuyTxPrepareResponse;
|
|
8
8
|
//# sourceMappingURL=BuyTxPrepareResponse.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyTxPrepareResponse.entity.js","sourceRoot":"","sources":["../../../../../../../src/domain/model/buy/prepare/entities/BuyTxPrepareResponse.entity.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"BuyTxPrepareResponse.entity.js","sourceRoot":"","sources":["../../../../../../../src/domain/model/buy/prepare/entities/BuyTxPrepareResponse.entity.ts"],"names":[],"mappings":";;;AAAA,iDAA4D;AAE5D,MAAa,oBAAqB,SAAQ,+BAAqB;CAAG;AAAlE,oDAAkE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyTxSubmitResponse.entity.js","sourceRoot":"","sources":["../../../../../../../src/domain/model/buy/submit/entities/BuyTxSubmitResponse.entity.ts"],"names":[],"mappings":";;;AAAA,oCAAmD;
|
|
1
|
+
{"version":3,"file":"BuyTxSubmitResponse.entity.js","sourceRoot":"","sources":["../../../../../../../src/domain/model/buy/submit/entities/BuyTxSubmitResponse.entity.ts"],"names":[],"mappings":";;;AAAA,oCAAmD;AAEnD,MAAa,mBAAoB,SAAQ,yBAAoB;CAAG;AAAhE,kDAAgE"}
|
|
@@ -56,5 +56,10 @@ __decorate([
|
|
|
56
56
|
(0, class_validator_1.IsNotEmpty)(),
|
|
57
57
|
__metadata("design:type", String)
|
|
58
58
|
], CreateCurveDto.prototype, "collateralCurrencyId", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, class_validator_1.IsString)(),
|
|
61
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], CreateCurveDto.prototype, "address", void 0);
|
|
59
64
|
exports.CreateCurveDto = CreateCurveDto;
|
|
60
65
|
//# sourceMappingURL=CreateCurve.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateCurve.dto.js","sourceRoot":"","sources":["../../../../../../src/domain/model/curve/dtos/CreateCurve.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyE;AACzE,kDAA+C;AAE/C,MAAa,cAAc;
|
|
1
|
+
{"version":3,"file":"CreateCurve.dto.js","sourceRoot":"","sources":["../../../../../../src/domain/model/curve/dtos/CreateCurve.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyE;AACzE,kDAA+C;AAE/C,MAAa,cAAc;CAqC1B;AApCC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAM,EAAC,qBAAS,CAAC;IACjB,IAAA,4BAAU,GAAE;;4CACG;AAEhB;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;8CACE;AAEf;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;8CACE;AAEf;IAAC,IAAA,4BAAU,GAAE;;mDACO;AAEpB;IAAC,IAAA,4BAAU,GAAE;;gEACoB;AAEjC;IAAC,IAAA,4BAAU,GAAE;;gEACoB;AAEjC;IAAC,IAAA,4BAAU,GAAE;;0DACc;AAE3B;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;2DACe;AAE5B;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;4DACgB;AAE7B;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;+CACG;AApClB,wCAqCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Curve.entity.js","sourceRoot":"","sources":["../../../../../../src/domain/model/curve/entities/Curve.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,yCAAsC;AAItC,MAAa,KAAM,SAAQ,eAAM;
|
|
1
|
+
{"version":3,"file":"Curve.entity.js","sourceRoot":"","sources":["../../../../../../src/domain/model/curve/entities/Curve.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,yCAAsC;AAItC,MAAa,KAAM,SAAQ,eAAM;CAwBhC;AAvBC;IAAC,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;0CACpB;AAEpB;IAAC,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;uDACP;AAEjC;IAAC,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;uDACP;AAEjC;IAAC,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;iDACb;AAX7B,sBAwBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CurvePositionResponse = void 0;
|
|
4
|
+
const entity_1 = require("../../entity");
|
|
5
|
+
class CurvePositionResponse extends entity_1.Entity {
|
|
6
|
+
}
|
|
7
|
+
exports.CurvePositionResponse = CurvePositionResponse;
|
|
8
|
+
//# sourceMappingURL=CurvePositionResponse.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurvePositionResponse.entity.js","sourceRoot":"","sources":["../../../../../../src/domain/model/curve/entities/CurvePositionResponse.entity.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAEtC,MAAa,qBAAsB,SAAQ,eAAM;CAEhD;AAFD,sDAEC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Curve.entity"), exports);
|
|
18
|
+
__exportStar(require("./CurvePositionResponse.entity"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/domain/model/curve/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/domain/model/curve/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,iEAA+C"}
|
|
@@ -4,7 +4,8 @@ export * from './buy';
|
|
|
4
4
|
export * from './currency';
|
|
5
5
|
export * from './curve';
|
|
6
6
|
export * from './example';
|
|
7
|
-
export * from './token-pair';
|
|
8
7
|
export * from './mint';
|
|
9
|
-
export * from './
|
|
8
|
+
export * from './sell';
|
|
9
|
+
export * from './token-pair';
|
|
10
10
|
export * from './tx';
|
|
11
|
+
export * from './tx-token-payload';
|
|
@@ -20,8 +20,9 @@ __exportStar(require("./buy"), exports);
|
|
|
20
20
|
__exportStar(require("./currency"), exports);
|
|
21
21
|
__exportStar(require("./curve"), exports);
|
|
22
22
|
__exportStar(require("./example"), exports);
|
|
23
|
-
__exportStar(require("./token-pair"), exports);
|
|
24
23
|
__exportStar(require("./mint"), exports);
|
|
25
|
-
__exportStar(require("./
|
|
24
|
+
__exportStar(require("./sell"), exports);
|
|
25
|
+
__exportStar(require("./token-pair"), exports);
|
|
26
26
|
__exportStar(require("./tx"), exports);
|
|
27
|
+
__exportStar(require("./tx-token-payload"), exports);
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,sDAAoC;AACpC,wCAAsB;AACtB,6CAA2B;AAC3B,0CAAwB;AACxB,4CAA0B;AAC1B,+CAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,sDAAoC;AACpC,wCAAsB;AACtB,6CAA2B;AAC3B,0CAAwB;AACxB,4CAA0B;AAC1B,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,uCAAqB;AACrB,qDAAmC"}
|