@gala-chain/launchpad 1.0.10 → 1.0.12
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/lib/package.json +2 -2
- package/lib/src/api/utils/error.js +1 -1
- package/lib/src/api/utils/error.js.map +1 -1
- package/lib/src/chaincode/launchpad/buyExactToken.js +1 -1
- package/lib/src/chaincode/launchpad/buyExactToken.js.map +1 -1
- package/lib/src/chaincode/launchpad/buyWithNative.js +1 -1
- package/lib/src/chaincode/launchpad/buyWithNative.js.map +1 -1
- package/lib/src/chaincode/launchpad/finaliseSale.js +6 -3
- package/lib/src/chaincode/launchpad/finaliseSale.js.map +1 -1
- package/lib/src/chaincode/launchpad/sellExactToken.js +1 -1
- package/lib/src/chaincode/launchpad/sellExactToken.js.map +1 -1
- package/lib/src/chaincode/launchpad/sellWithNative.js +1 -1
- package/lib/src/chaincode/launchpad/sellWithNative.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/api/utils/error.ts +1 -1
- package/src/chaincode/launchpad/buyExactToken.ts +1 -1
- package/src/chaincode/launchpad/buyWithNative.spec.ts +0 -1
- package/src/chaincode/launchpad/buyWithNative.ts +1 -1
- package/src/chaincode/launchpad/createSale.spec.ts +1 -1
- package/src/chaincode/launchpad/finaliseSale.ts +7 -7
- package/src/chaincode/launchpad/sellExactToken.ts +1 -1
- package/src/chaincode/launchpad/sellWithNative.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gala-chain/launchpad",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "GalaChain Launchpad Chaincode",
|
|
5
5
|
"main": "lib/src/index.js",
|
|
6
6
|
"types": "lib/src/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@gala-chain/api": "~2.3.4",
|
|
27
27
|
"@gala-chain/chaincode": "~2.3.4",
|
|
28
|
-
"@gala-chain/dex": "1.0.
|
|
28
|
+
"@gala-chain/dex": "1.0.20",
|
|
29
29
|
"@grpc/grpc-js": "1.10.10",
|
|
30
30
|
"decimal.js": "^10.5.0",
|
|
31
31
|
"dotenv": "^16.0.1",
|
package/src/api/utils/error.ts
CHANGED
|
@@ -82,7 +82,7 @@ export async function buyExactToken(
|
|
|
82
82
|
// Ensure the expected native token amount is not less than the actual amount required
|
|
83
83
|
if (buyTokenDTO.expectedNativeToken && buyTokenDTO.expectedNativeToken.comparedTo(nativeTokensToBuy) < 0) {
|
|
84
84
|
throw new SlippageToleranceExceededError(
|
|
85
|
-
|
|
85
|
+
`expected ${buyTokenDTO.expectedNativeToken.toString()}, but at least ${nativeTokensToBuy.toString()} are required to complete this operation. Increase the expected amount or adjust your slippage tolerance.`
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -101,7 +101,7 @@ export async function buyWithNative(
|
|
|
101
101
|
// Check for slippage condition
|
|
102
102
|
if (buyTokenDTO.expectedToken && buyTokenDTO.expectedToken.comparedTo(tokensToBuy) > 0) {
|
|
103
103
|
throw new SlippageToleranceExceededError(
|
|
104
|
-
|
|
104
|
+
`expected ${buyTokenDTO.expectedToken.toString()}, but only ${tokensToBuy.toString()} tokens can be provided. Reduce the expected amount or adjust your slippage tolerance.`
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
import { TokenBalance, TokenClass, TokenInstance, randomUniqueKey } from "@gala-chain/api";
|
|
16
|
-
import {
|
|
16
|
+
import { fixture, users } from "@gala-chain/test";
|
|
17
17
|
import BigNumber from "bignumber.js";
|
|
18
18
|
import { plainToInstance } from "class-transformer";
|
|
19
19
|
|
|
@@ -98,7 +98,7 @@ export async function finalizeSale(ctx: GalaChainContext, sale: LaunchpadSale):
|
|
|
98
98
|
const poolDTO = new CreatePoolDto(
|
|
99
99
|
areTokensSorted ? nativeTokenClassKey : sellingTokenClassKey,
|
|
100
100
|
areTokensSorted ? sellingTokenClassKey : nativeTokenClassKey,
|
|
101
|
-
|
|
101
|
+
10000, // TODO: make this configurable
|
|
102
102
|
sqrtPrice
|
|
103
103
|
);
|
|
104
104
|
|
|
@@ -136,10 +136,10 @@ export async function finalizeSale(ctx: GalaChainContext, sale: LaunchpadSale):
|
|
|
136
136
|
const expectedTokenDTO = new GetAddLiquidityEstimationDto(
|
|
137
137
|
token0,
|
|
138
138
|
token1,
|
|
139
|
-
|
|
139
|
+
10000, // TODO: make this configurable
|
|
140
140
|
liquidityAmount,
|
|
141
|
-
-
|
|
142
|
-
|
|
141
|
+
-887200,
|
|
142
|
+
887200,
|
|
143
143
|
zeroForOne
|
|
144
144
|
);
|
|
145
145
|
|
|
@@ -151,9 +151,9 @@ export async function finalizeSale(ctx: GalaChainContext, sale: LaunchpadSale):
|
|
|
151
151
|
const positionDto = new AddLiquidityDTO(
|
|
152
152
|
token0,
|
|
153
153
|
token1,
|
|
154
|
-
|
|
155
|
-
-
|
|
156
|
-
|
|
154
|
+
10000, // TODO: make this configurable
|
|
155
|
+
-887200,
|
|
156
|
+
887200,
|
|
157
157
|
amount0,
|
|
158
158
|
amount1,
|
|
159
159
|
amount0.times(0.9999999),
|
|
@@ -67,7 +67,7 @@ export async function sellExactToken(
|
|
|
67
67
|
sellTokenDTO.expectedNativeToken.comparedTo(nativeTokensToProvide) > 0
|
|
68
68
|
) {
|
|
69
69
|
throw new SlippageToleranceExceededError(
|
|
70
|
-
|
|
70
|
+
`expected ${sellTokenDTO.expectedNativeToken.toString()}, but only ${nativeTokensToProvide.toString()} tokens can be provided. Reduce the expected amount or adjust your slippage tolerance.`
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -83,7 +83,7 @@ export async function sellWithNative(
|
|
|
83
83
|
// Enforce slippage tolerance
|
|
84
84
|
if (sellTokenDTO.expectedToken && sellTokenDTO.expectedToken.comparedTo(tokensToSell) < 0) {
|
|
85
85
|
throw new SlippageToleranceExceededError(
|
|
86
|
-
|
|
86
|
+
`expected ${sellTokenDTO.expectedToken.toString()}, but at least ${tokensToSell.toString()} tokens are required. Increase the expected amount or adjust your slippage tolerance.`
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
|