@gala-chain/launchpad 1.0.9 → 1.0.11

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 (36) hide show
  1. package/CLAUDE.md +279 -0
  2. package/lib/package.json +2 -2
  3. package/lib/src/api/utils/error.js +1 -1
  4. package/lib/src/api/utils/error.js.map +1 -1
  5. package/lib/src/chaincode/launchpad/buyExactToken.js +1 -1
  6. package/lib/src/chaincode/launchpad/buyExactToken.js.map +1 -1
  7. package/lib/src/chaincode/launchpad/buyWithNative.d.ts.map +1 -1
  8. package/lib/src/chaincode/launchpad/buyWithNative.js +12 -5
  9. package/lib/src/chaincode/launchpad/buyWithNative.js.map +1 -1
  10. package/lib/src/chaincode/launchpad/sellExactToken.js +1 -1
  11. package/lib/src/chaincode/launchpad/sellExactToken.js.map +1 -1
  12. package/lib/src/chaincode/launchpad/sellWithNative.d.ts.map +1 -1
  13. package/lib/src/chaincode/launchpad/sellWithNative.js +10 -2
  14. package/lib/src/chaincode/launchpad/sellWithNative.js.map +1 -1
  15. package/lib/src/chaincode/test/launchpadgala.js +1 -1
  16. package/lib/src/chaincode/test/launchpadgala.js.map +1 -1
  17. package/lib/tsconfig.tsbuildinfo +1 -1
  18. package/package.json +2 -2
  19. package/src/api/utils/error.ts +1 -1
  20. package/src/chaincode/launchpad/buyExactToken.spec.ts +90 -20
  21. package/src/chaincode/launchpad/buyExactToken.ts +1 -1
  22. package/src/chaincode/launchpad/buyWithNative.spec.ts +99 -26
  23. package/src/chaincode/launchpad/buyWithNative.ts +21 -6
  24. package/src/chaincode/launchpad/callMemeTokenIn.spec.ts +244 -0
  25. package/src/chaincode/launchpad/callMemeTokenOut.spec.ts +1 -1
  26. package/src/chaincode/launchpad/callNativeTokenIn.spec.ts +269 -0
  27. package/src/chaincode/launchpad/callNativeTokenOut.spec.ts +276 -0
  28. package/src/chaincode/launchpad/configureLaunchpadFeeConfig.spec.ts +202 -0
  29. package/src/chaincode/launchpad/createSale.spec.ts +259 -0
  30. package/src/chaincode/launchpad/fetchSaleDetails.spec.ts +141 -0
  31. package/src/chaincode/launchpad/finalizeTokenAllocation.spec.ts +126 -0
  32. package/src/chaincode/launchpad/sellExactToken.spec.ts +284 -0
  33. package/src/chaincode/launchpad/sellExactToken.ts +1 -1
  34. package/src/chaincode/launchpad/sellWithNative.spec.ts +329 -0
  35. package/src/chaincode/launchpad/sellWithNative.ts +23 -6
  36. package/src/chaincode/test/launchpadgala.ts +1 -1
@@ -0,0 +1,244 @@
1
+ /*
2
+ * Copyright (c) Gala Games Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+ import {
16
+ TokenBalance,
17
+ TokenClass,
18
+ TokenClassKey,
19
+ TokenInstance,
20
+ UserAlias,
21
+ asValidUserAlias,
22
+ randomUniqueKey
23
+ } from "@gala-chain/api";
24
+ import { currency, fixture, users } from "@gala-chain/test";
25
+ import BigNumber from "bignumber.js";
26
+ import { plainToInstance } from "class-transformer";
27
+
28
+ import { LaunchpadSale, NativeTokenQuantityDto } from "../../api/types";
29
+ import { LaunchpadContract } from "../LaunchpadContract";
30
+ import launchpadgala from "../test/launchpadgala";
31
+
32
+ describe("callMemeTokenIn", () => {
33
+ let currencyClass: TokenClass;
34
+ let currencyInstance: TokenInstance;
35
+ let launchpadGalaClass: TokenClass;
36
+ let launchpadGalaInstance: TokenInstance;
37
+ let launchpadGalaClassKey: TokenClassKey;
38
+ let vaultAddress: UserAlias;
39
+ let sale: LaunchpadSale;
40
+ let salelaunchpadGalaBalance: TokenBalance;
41
+ let saleCurrencyBalance: TokenBalance;
42
+ let userlaunchpadGalaBalance: TokenBalance;
43
+ let userCurrencyBalance: TokenBalance;
44
+
45
+ beforeEach(() => {
46
+ currencyClass = currency.tokenClass();
47
+ currencyInstance = currency.tokenInstance();
48
+ launchpadGalaClass = launchpadgala.tokenClass();
49
+ launchpadGalaInstance = launchpadgala.tokenInstance();
50
+ launchpadGalaClassKey = launchpadgala.tokenClassKey();
51
+
52
+ vaultAddress = asValidUserAlias(`service|${launchpadGalaClassKey.toStringKey()}$launchpad`);
53
+
54
+ // Initialize sale with manual values
55
+ sale = new LaunchpadSale(
56
+ vaultAddress,
57
+ currencyInstance.instanceKeyObj(),
58
+ undefined,
59
+ users.testUser1.identityKey
60
+ );
61
+
62
+ // Create sale balances - sale needs tokens to pay out
63
+ salelaunchpadGalaBalance = plainToInstance(TokenBalance, {
64
+ ...launchpadgala.tokenBalance(),
65
+ owner: vaultAddress,
66
+ quantity: new BigNumber("97.238975330345368866")
67
+ });
68
+ saleCurrencyBalance = plainToInstance(TokenBalance, {
69
+ ...currency.tokenBalance(),
70
+ owner: vaultAddress,
71
+ quantity: new BigNumber("188809.790718")
72
+ });
73
+
74
+ // Create user balances - user needs tokens to swap
75
+ userlaunchpadGalaBalance = plainToInstance(TokenBalance, {
76
+ ...launchpadgala.tokenBalance(),
77
+ owner: users.testUser1.identityKey,
78
+ quantity: new BigNumber("10000") // User has 10k launchpadGala tokens
79
+ });
80
+ userCurrencyBalance = plainToInstance(TokenBalance, {
81
+ ...currency.tokenBalance(),
82
+ owner: users.testUser1.identityKey,
83
+ quantity: new BigNumber("10000") // User has 10k CURRENCY tokens
84
+ });
85
+ });
86
+
87
+ it("should calculate meme token required amount for selling", async () => {
88
+ // Given
89
+ sale.buyToken(new BigNumber("605.60177406237267161"), new BigNumber(0.01));
90
+ const { ctx, contract } = fixture(LaunchpadContract)
91
+ .registeredUsers(users.testUser1)
92
+ .savedState(
93
+ currencyClass,
94
+ currencyInstance,
95
+ launchpadGalaClass,
96
+ launchpadGalaInstance,
97
+ sale,
98
+ salelaunchpadGalaBalance,
99
+ saleCurrencyBalance,
100
+ userlaunchpadGalaBalance,
101
+ userCurrencyBalance
102
+ );
103
+
104
+ const callMemeTokenInDto = new NativeTokenQuantityDto(vaultAddress, new BigNumber(1));
105
+ callMemeTokenInDto.uniqueKey = randomUniqueKey();
106
+
107
+ const signedDto = callMemeTokenInDto.signed(users.testUser1.privateKey);
108
+
109
+ // When
110
+ const response = await contract.CallMemeTokenIn(ctx, signedDto);
111
+
112
+ // Then
113
+ expect(response.Status).toBe(1);
114
+ expect(response.Data).toHaveProperty("calculatedQuantity");
115
+ expect(response.Data).toHaveProperty("extraFees");
116
+ expect(response.Data?.extraFees).toHaveProperty("reverseBondingCurve");
117
+ expect(response.Data?.extraFees).toHaveProperty("transactionFees");
118
+ });
119
+
120
+ it("should calculate tokens required for native token amount of 10", async () => {
121
+ // Given
122
+ sale.buyToken(new BigNumber("605.60177406237267161"), new BigNumber(0.01));
123
+ const { ctx, contract } = fixture(LaunchpadContract)
124
+ .registeredUsers(users.testUser1)
125
+ .savedState(
126
+ currencyClass,
127
+ currencyInstance,
128
+ launchpadGalaClass,
129
+ launchpadGalaInstance,
130
+ sale,
131
+ salelaunchpadGalaBalance,
132
+ saleCurrencyBalance,
133
+ userlaunchpadGalaBalance,
134
+ userCurrencyBalance
135
+ );
136
+
137
+ const callMemeTokenInDto = new NativeTokenQuantityDto(vaultAddress, new BigNumber(10));
138
+ callMemeTokenInDto.uniqueKey = randomUniqueKey();
139
+
140
+ const signedDto = callMemeTokenInDto.signed(users.testUser1.privateKey);
141
+
142
+ // When
143
+ const response = await contract.CallMemeTokenIn(ctx, signedDto);
144
+
145
+ // Then
146
+ expect(response.Status).toBe(1);
147
+ expect(response.Data?.calculatedQuantity).toBeDefined();
148
+ expect(new BigNumber(response.Data?.calculatedQuantity || "0").isPositive()).toBe(true);
149
+ });
150
+
151
+ it("should handle edge case with minimal native token amount", async () => {
152
+ // Given
153
+ sale.buyToken(new BigNumber("100"), new BigNumber(0.01));
154
+ const { ctx, contract } = fixture(LaunchpadContract)
155
+ .registeredUsers(users.testUser1)
156
+ .savedState(
157
+ currencyClass,
158
+ currencyInstance,
159
+ launchpadGalaClass,
160
+ launchpadGalaInstance,
161
+ sale,
162
+ salelaunchpadGalaBalance,
163
+ saleCurrencyBalance,
164
+ userlaunchpadGalaBalance,
165
+ userCurrencyBalance
166
+ );
167
+
168
+ const callMemeTokenInDto = new NativeTokenQuantityDto(vaultAddress, new BigNumber("0.001"));
169
+ callMemeTokenInDto.uniqueKey = randomUniqueKey();
170
+
171
+ const signedDto = callMemeTokenInDto.signed(users.testUser1.privateKey);
172
+
173
+ // When
174
+ const response = await contract.CallMemeTokenIn(ctx, signedDto);
175
+
176
+ // Then
177
+ expect(response.Status).toBe(1);
178
+ expect(response.Data?.calculatedQuantity).toBeDefined();
179
+ });
180
+
181
+ it("should handle calculation when native token amount exceeds vault balance", async () => {
182
+ // Given
183
+ sale.buyToken(new BigNumber("100"), new BigNumber(0.01));
184
+ const { ctx, contract } = fixture(LaunchpadContract)
185
+ .registeredUsers(users.testUser1)
186
+ .savedState(
187
+ currencyClass,
188
+ currencyInstance,
189
+ launchpadGalaClass,
190
+ launchpadGalaInstance,
191
+ sale,
192
+ salelaunchpadGalaBalance,
193
+ saleCurrencyBalance,
194
+ userlaunchpadGalaBalance,
195
+ userCurrencyBalance
196
+ );
197
+
198
+ // Request more native tokens than available in vault
199
+ const callMemeTokenInDto = new NativeTokenQuantityDto(vaultAddress, new BigNumber("1000000"));
200
+ callMemeTokenInDto.uniqueKey = randomUniqueKey();
201
+
202
+ const signedDto = callMemeTokenInDto.signed(users.testUser1.privateKey);
203
+
204
+ // When
205
+ const response = await contract.CallMemeTokenIn(ctx, signedDto);
206
+
207
+ // Then
208
+ expect(response.Status).toBe(1);
209
+ expect(response.Data?.calculatedQuantity).toBeDefined();
210
+ });
211
+
212
+ it("should calculate correct fees for transaction", async () => {
213
+ // Given
214
+ sale.buyToken(new BigNumber("500"), new BigNumber(0.01));
215
+ const { ctx, contract } = fixture(LaunchpadContract)
216
+ .registeredUsers(users.testUser1)
217
+ .savedState(
218
+ currencyClass,
219
+ currencyInstance,
220
+ launchpadGalaClass,
221
+ launchpadGalaInstance,
222
+ sale,
223
+ salelaunchpadGalaBalance,
224
+ saleCurrencyBalance,
225
+ userlaunchpadGalaBalance,
226
+ userCurrencyBalance
227
+ );
228
+
229
+ const callMemeTokenInDto = new NativeTokenQuantityDto(vaultAddress, new BigNumber(5));
230
+ callMemeTokenInDto.uniqueKey = randomUniqueKey();
231
+
232
+ const signedDto = callMemeTokenInDto.signed(users.testUser1.privateKey);
233
+
234
+ // When
235
+ const response = await contract.CallMemeTokenIn(ctx, signedDto);
236
+
237
+ // Then
238
+ expect(response.Status).toBe(1);
239
+ expect(response.Data?.extraFees.reverseBondingCurve).toBeDefined();
240
+ expect(response.Data?.extraFees.transactionFees).toBeDefined();
241
+ expect(new BigNumber(response.Data?.extraFees.reverseBondingCurve || "0").isFinite()).toBe(true);
242
+ expect(new BigNumber(response.Data?.extraFees.transactionFees || "0").isFinite()).toBe(true);
243
+ });
244
+ });
@@ -54,7 +54,7 @@ describe("callMemeTokenOut", () => {
54
54
  // Initialize sale with manual values
55
55
  sale = new LaunchpadSale(
56
56
  vaultAddress,
57
- launchpadGalaInstance.instanceKeyObj(),
57
+ currencyInstance.instanceKeyObj(),
58
58
  undefined,
59
59
  users.testUser1.identityKey
60
60
  );
@@ -0,0 +1,269 @@
1
+ /*
2
+ * Copyright (c) Gala Games Inc. All rights reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+ import {
16
+ TokenBalance,
17
+ TokenClass,
18
+ TokenClassKey,
19
+ TokenInstance,
20
+ UserAlias,
21
+ asValidUserAlias,
22
+ randomUniqueKey
23
+ } from "@gala-chain/api";
24
+ import { currency, fixture, users } from "@gala-chain/test";
25
+ import BigNumber from "bignumber.js";
26
+ import { plainToInstance } from "class-transformer";
27
+
28
+ import { ExactTokenQuantityDto, LaunchpadSale } from "../../api/types";
29
+ import { LaunchpadContract } from "../LaunchpadContract";
30
+ import launchpadgala from "../test/launchpadgala";
31
+
32
+ describe("callNativeTokenIn", () => {
33
+ let currencyClass: TokenClass;
34
+ let currencyInstance: TokenInstance;
35
+ let launchpadGalaClass: TokenClass;
36
+ let launchpadGalaInstance: TokenInstance;
37
+ let launchpadGalaClassKey: TokenClassKey;
38
+ let vaultAddress: UserAlias;
39
+ let sale: LaunchpadSale;
40
+ let salelaunchpadGalaBalance: TokenBalance;
41
+ let saleCurrencyBalance: TokenBalance;
42
+ let userlaunchpadGalaBalance: TokenBalance;
43
+ let userCurrencyBalance: TokenBalance;
44
+
45
+ beforeEach(() => {
46
+ currencyClass = currency.tokenClass();
47
+ currencyInstance = currency.tokenInstance();
48
+ launchpadGalaClass = launchpadgala.tokenClass();
49
+ launchpadGalaInstance = launchpadgala.tokenInstance();
50
+ launchpadGalaClassKey = launchpadgala.tokenClassKey();
51
+
52
+ vaultAddress = asValidUserAlias(`service|${launchpadGalaClassKey.toStringKey()}$launchpad`);
53
+
54
+ // Initialize sale with manual values
55
+ sale = new LaunchpadSale(
56
+ vaultAddress,
57
+ currencyInstance.instanceKeyObj(),
58
+ undefined,
59
+ users.testUser1.identityKey
60
+ );
61
+
62
+ // Create sale balances - sale needs tokens to pay out
63
+ salelaunchpadGalaBalance = plainToInstance(TokenBalance, {
64
+ ...launchpadgala.tokenBalance(),
65
+ owner: vaultAddress,
66
+ quantity: new BigNumber("97.238975330345368866")
67
+ });
68
+ saleCurrencyBalance = plainToInstance(TokenBalance, {
69
+ ...currency.tokenBalance(),
70
+ owner: vaultAddress,
71
+ quantity: new BigNumber("188809.790718")
72
+ });
73
+
74
+ // Create user balances - user needs tokens to swap
75
+ userlaunchpadGalaBalance = plainToInstance(TokenBalance, {
76
+ ...launchpadgala.tokenBalance(),
77
+ owner: users.testUser1.identityKey,
78
+ quantity: new BigNumber("10000") // User has 10k launchpadGala tokens
79
+ });
80
+ userCurrencyBalance = plainToInstance(TokenBalance, {
81
+ ...currency.tokenBalance(),
82
+ owner: users.testUser1.identityKey,
83
+ quantity: new BigNumber("10000") // User has 10k CURRENCY tokens
84
+ });
85
+ });
86
+
87
+ it("should calculate native token required for exact token purchase", async () => {
88
+ // Given
89
+ const { ctx, contract } = fixture(LaunchpadContract)
90
+ .registeredUsers(users.testUser1)
91
+ .savedState(
92
+ currencyClass,
93
+ currencyInstance,
94
+ launchpadGalaClass,
95
+ launchpadGalaInstance,
96
+ sale,
97
+ salelaunchpadGalaBalance,
98
+ saleCurrencyBalance,
99
+ userlaunchpadGalaBalance,
100
+ userCurrencyBalance
101
+ );
102
+
103
+ const callNativeTokenInDto = new ExactTokenQuantityDto(vaultAddress, new BigNumber(100));
104
+ callNativeTokenInDto.uniqueKey = randomUniqueKey();
105
+
106
+ const signedDto = callNativeTokenInDto.signed(users.testUser1.privateKey);
107
+
108
+ // When
109
+ const response = await contract.CallNativeTokenIn(ctx, signedDto);
110
+
111
+ // Then
112
+ expect(response.Status).toBe(1);
113
+ expect(response.Data).toHaveProperty("calculatedQuantity");
114
+ expect(response.Data).toHaveProperty("extraFees");
115
+ expect(response.Data?.extraFees).toHaveProperty("reverseBondingCurve", "0");
116
+ expect(response.Data?.extraFees).toHaveProperty("transactionFees");
117
+ });
118
+
119
+ it("should calculate correct price for small token purchase", async () => {
120
+ // Given
121
+ const { ctx, contract } = fixture(LaunchpadContract)
122
+ .registeredUsers(users.testUser1)
123
+ .savedState(
124
+ currencyClass,
125
+ currencyInstance,
126
+ launchpadGalaClass,
127
+ launchpadGalaInstance,
128
+ sale,
129
+ salelaunchpadGalaBalance,
130
+ saleCurrencyBalance,
131
+ userlaunchpadGalaBalance,
132
+ userCurrencyBalance
133
+ );
134
+
135
+ const callNativeTokenInDto = new ExactTokenQuantityDto(vaultAddress, new BigNumber(1));
136
+ callNativeTokenInDto.uniqueKey = randomUniqueKey();
137
+
138
+ const signedDto = callNativeTokenInDto.signed(users.testUser1.privateKey);
139
+
140
+ // When
141
+ const response = await contract.CallNativeTokenIn(ctx, signedDto);
142
+
143
+ // Then
144
+ expect(response.Status).toBe(1);
145
+ expect(response.Data?.calculatedQuantity).toBeDefined();
146
+ expect(new BigNumber(response.Data?.calculatedQuantity || "0").isPositive()).toBe(true);
147
+ });
148
+
149
+ it("should handle large token purchase amounts", async () => {
150
+ // Given
151
+ const { ctx, contract } = fixture(LaunchpadContract)
152
+ .registeredUsers(users.testUser1)
153
+ .savedState(
154
+ currencyClass,
155
+ currencyInstance,
156
+ launchpadGalaClass,
157
+ launchpadGalaInstance,
158
+ sale,
159
+ salelaunchpadGalaBalance,
160
+ saleCurrencyBalance,
161
+ userlaunchpadGalaBalance,
162
+ userCurrencyBalance
163
+ );
164
+
165
+ const callNativeTokenInDto = new ExactTokenQuantityDto(vaultAddress, new BigNumber(1000000)); // Large amount
166
+ callNativeTokenInDto.uniqueKey = randomUniqueKey();
167
+
168
+ const signedDto = callNativeTokenInDto.signed(users.testUser1.privateKey);
169
+
170
+ // When
171
+ const response = await contract.CallNativeTokenIn(ctx, signedDto);
172
+
173
+ // Then
174
+ expect(response.Status).toBe(1);
175
+ expect(response.Data?.calculatedQuantity).toBeDefined();
176
+ });
177
+
178
+ it("should calculate correct price after some tokens are already sold", async () => {
179
+ // Given
180
+ sale.buyToken(new BigNumber("500"), new BigNumber(0.01)); // Pre-sell some tokens
181
+ const { ctx, contract } = fixture(LaunchpadContract)
182
+ .registeredUsers(users.testUser1)
183
+ .savedState(
184
+ currencyClass,
185
+ currencyInstance,
186
+ launchpadGalaClass,
187
+ launchpadGalaInstance,
188
+ sale,
189
+ salelaunchpadGalaBalance,
190
+ saleCurrencyBalance,
191
+ userlaunchpadGalaBalance,
192
+ userCurrencyBalance
193
+ );
194
+
195
+ const callNativeTokenInDto = new ExactTokenQuantityDto(vaultAddress, new BigNumber(100));
196
+ callNativeTokenInDto.uniqueKey = randomUniqueKey();
197
+
198
+ const signedDto = callNativeTokenInDto.signed(users.testUser1.privateKey);
199
+
200
+ // When
201
+ const response = await contract.CallNativeTokenIn(ctx, signedDto);
202
+
203
+ // Then
204
+ expect(response.Status).toBe(1);
205
+ expect(response.Data?.calculatedQuantity).toBeDefined();
206
+ expect(new BigNumber(response.Data?.calculatedQuantity || "0").isPositive()).toBe(true);
207
+ });
208
+
209
+ it("should handle minimal token purchase", async () => {
210
+ // Given
211
+ const { ctx, contract } = fixture(LaunchpadContract)
212
+ .registeredUsers(users.testUser1)
213
+ .savedState(
214
+ currencyClass,
215
+ currencyInstance,
216
+ launchpadGalaClass,
217
+ launchpadGalaInstance,
218
+ sale,
219
+ salelaunchpadGalaBalance,
220
+ saleCurrencyBalance,
221
+ userlaunchpadGalaBalance,
222
+ userCurrencyBalance
223
+ );
224
+
225
+ const callNativeTokenInDto = new ExactTokenQuantityDto(vaultAddress, new BigNumber("0.001"));
226
+ callNativeTokenInDto.uniqueKey = randomUniqueKey();
227
+
228
+ const signedDto = callNativeTokenInDto.signed(users.testUser1.privateKey);
229
+
230
+ // When
231
+ const response = await contract.CallNativeTokenIn(ctx, signedDto);
232
+
233
+ // Then
234
+ expect(response.Status).toBe(1);
235
+ expect(response.Data?.calculatedQuantity).toBeDefined();
236
+ expect(new BigNumber(response.Data?.calculatedQuantity || "0").isFinite()).toBe(true);
237
+ });
238
+
239
+ it("should return proper fee structure", async () => {
240
+ // Given
241
+ const { ctx, contract } = fixture(LaunchpadContract)
242
+ .registeredUsers(users.testUser1)
243
+ .savedState(
244
+ currencyClass,
245
+ currencyInstance,
246
+ launchpadGalaClass,
247
+ launchpadGalaInstance,
248
+ sale,
249
+ salelaunchpadGalaBalance,
250
+ saleCurrencyBalance,
251
+ userlaunchpadGalaBalance,
252
+ userCurrencyBalance
253
+ );
254
+
255
+ const callNativeTokenInDto = new ExactTokenQuantityDto(vaultAddress, new BigNumber(50));
256
+ callNativeTokenInDto.uniqueKey = randomUniqueKey();
257
+
258
+ const signedDto = callNativeTokenInDto.signed(users.testUser1.privateKey);
259
+
260
+ // When
261
+ const response = await contract.CallNativeTokenIn(ctx, signedDto);
262
+
263
+ // Then
264
+ expect(response.Status).toBe(1);
265
+ expect(response.Data?.extraFees.reverseBondingCurve).toBe("0");
266
+ expect(response.Data?.extraFees.transactionFees).toBeDefined();
267
+ expect(new BigNumber(response.Data?.extraFees.transactionFees || "0").isFinite()).toBe(true);
268
+ });
269
+ });