punkkit-sdk 1.0.25 → 1.0.27
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/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +75 -9
- package/dist/index.mjs +75 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -131,6 +131,16 @@ interface ModifyPositionParams {
|
|
|
131
131
|
|
|
132
132
|
declare function addLiq(wallet: Wallet, priceLower: number, priceUpper: number, amount0: bigint | number, amount1: bigint | number, poolKey: PoolKey): Promise<ethers.providers.TransactionReceipt>;
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Removes liquidity by directly specifying exact tick ranges and the liquidity delta to remove.
|
|
136
|
+
* This is primarily used when matching with the frontend's position data.
|
|
137
|
+
*/
|
|
138
|
+
declare function removeLiqByPosition(wallet: Wallet, tickLower: number, tickUpper: number, liquidityToRemove: bigint | string): Promise<providers.TransactionReceipt>;
|
|
139
|
+
/**
|
|
140
|
+
* Legacy support: calculate liquidity to remove via token amount projections.
|
|
141
|
+
*/
|
|
142
|
+
declare function removeLiq(wallet: Wallet, priceLower: number, priceUpper: number, amount0: bigint, amount1: bigint, poolKey: PoolKey): Promise<providers.TransactionReceipt>;
|
|
143
|
+
|
|
134
144
|
interface UserPosition {
|
|
135
145
|
tokenId: number;
|
|
136
146
|
tickLower: number;
|
|
@@ -204,4 +214,4 @@ declare function balanceOf(contractAddress: string, provider: SignerOrProvider,
|
|
|
204
214
|
declare function getAllVouchers(contractAddress: string, provider: SignerOrProvider): Promise<string[]>;
|
|
205
215
|
declare function BuildUseVoucherTx(tx: providers.TransactionRequest, voucherName: string): providers.TransactionRequest;
|
|
206
216
|
|
|
207
|
-
export { BuildUseVoucherTx, type ChallengeMatchResultParams, type CreateAuctionConfigParams, type CreateAuctionParams, type ModifyPositionParams, type PlaceBidParams, type PoolKey, type RevealBidParams, type RevealLockParams, type SetUnlockStrategyParams, type SignerOrProvider, type SubmitMatchResultsParams, type SwapParams, type UnlockTokensParams, type UserPosition, type WithdrawMatchResultParams, addLiq, amount0, amount1, balanceOf, buyVoucher, buyVoucherWithEth, calculateLiqDelta, calculatePriceFromTick, calculateTickFromPrice, calculateTickFromPriceWithSpacing, createAuction$1 as createAuction, createAuctionConfig, createAuction as createAuctionOnVault, createVoucher, getActiveAuctionsCount, getAllVouchers, getAuctionContract, getAuctionInfo, getAuctionLockInfo, getContract, getCurrentTick, getLiquidity, getLockInfo, getMatchResult, getPoolId, getPoolPrice, getPoolSqrtPrice, getProvider, getSqrtPriceAtTick, getUserPositions, getVoucherContract, getVoucherInfo, liquidity0, liquidity1, main, modifyPosition, mutiVoucherABI, placeBid, priceToSqrtPrice, revealBid, revealLock, submitMatchResults, swap, toWei, unlockTokens, useVoucher, withdrawMatchResult };
|
|
217
|
+
export { BuildUseVoucherTx, type ChallengeMatchResultParams, type CreateAuctionConfigParams, type CreateAuctionParams, type ModifyPositionParams, type PlaceBidParams, type PoolKey, type RevealBidParams, type RevealLockParams, type SetUnlockStrategyParams, type SignerOrProvider, type SubmitMatchResultsParams, type SwapParams, type UnlockTokensParams, type UserPosition, type WithdrawMatchResultParams, addLiq, amount0, amount1, balanceOf, buyVoucher, buyVoucherWithEth, calculateLiqDelta, calculatePriceFromTick, calculateTickFromPrice, calculateTickFromPriceWithSpacing, createAuction$1 as createAuction, createAuctionConfig, createAuction as createAuctionOnVault, createVoucher, getActiveAuctionsCount, getAllVouchers, getAuctionContract, getAuctionInfo, getAuctionLockInfo, getContract, getCurrentTick, getLiquidity, getLockInfo, getMatchResult, getPoolId, getPoolPrice, getPoolSqrtPrice, getProvider, getSqrtPriceAtTick, getUserPositions, getVoucherContract, getVoucherInfo, liquidity0, liquidity1, main, modifyPosition, mutiVoucherABI, placeBid, priceToSqrtPrice, removeLiq, removeLiqByPosition, revealBid, revealLock, submitMatchResults, swap, toWei, unlockTokens, useVoucher, withdrawMatchResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -131,6 +131,16 @@ interface ModifyPositionParams {
|
|
|
131
131
|
|
|
132
132
|
declare function addLiq(wallet: Wallet, priceLower: number, priceUpper: number, amount0: bigint | number, amount1: bigint | number, poolKey: PoolKey): Promise<ethers.providers.TransactionReceipt>;
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Removes liquidity by directly specifying exact tick ranges and the liquidity delta to remove.
|
|
136
|
+
* This is primarily used when matching with the frontend's position data.
|
|
137
|
+
*/
|
|
138
|
+
declare function removeLiqByPosition(wallet: Wallet, tickLower: number, tickUpper: number, liquidityToRemove: bigint | string): Promise<providers.TransactionReceipt>;
|
|
139
|
+
/**
|
|
140
|
+
* Legacy support: calculate liquidity to remove via token amount projections.
|
|
141
|
+
*/
|
|
142
|
+
declare function removeLiq(wallet: Wallet, priceLower: number, priceUpper: number, amount0: bigint, amount1: bigint, poolKey: PoolKey): Promise<providers.TransactionReceipt>;
|
|
143
|
+
|
|
134
144
|
interface UserPosition {
|
|
135
145
|
tokenId: number;
|
|
136
146
|
tickLower: number;
|
|
@@ -204,4 +214,4 @@ declare function balanceOf(contractAddress: string, provider: SignerOrProvider,
|
|
|
204
214
|
declare function getAllVouchers(contractAddress: string, provider: SignerOrProvider): Promise<string[]>;
|
|
205
215
|
declare function BuildUseVoucherTx(tx: providers.TransactionRequest, voucherName: string): providers.TransactionRequest;
|
|
206
216
|
|
|
207
|
-
export { BuildUseVoucherTx, type ChallengeMatchResultParams, type CreateAuctionConfigParams, type CreateAuctionParams, type ModifyPositionParams, type PlaceBidParams, type PoolKey, type RevealBidParams, type RevealLockParams, type SetUnlockStrategyParams, type SignerOrProvider, type SubmitMatchResultsParams, type SwapParams, type UnlockTokensParams, type UserPosition, type WithdrawMatchResultParams, addLiq, amount0, amount1, balanceOf, buyVoucher, buyVoucherWithEth, calculateLiqDelta, calculatePriceFromTick, calculateTickFromPrice, calculateTickFromPriceWithSpacing, createAuction$1 as createAuction, createAuctionConfig, createAuction as createAuctionOnVault, createVoucher, getActiveAuctionsCount, getAllVouchers, getAuctionContract, getAuctionInfo, getAuctionLockInfo, getContract, getCurrentTick, getLiquidity, getLockInfo, getMatchResult, getPoolId, getPoolPrice, getPoolSqrtPrice, getProvider, getSqrtPriceAtTick, getUserPositions, getVoucherContract, getVoucherInfo, liquidity0, liquidity1, main, modifyPosition, mutiVoucherABI, placeBid, priceToSqrtPrice, revealBid, revealLock, submitMatchResults, swap, toWei, unlockTokens, useVoucher, withdrawMatchResult };
|
|
217
|
+
export { BuildUseVoucherTx, type ChallengeMatchResultParams, type CreateAuctionConfigParams, type CreateAuctionParams, type ModifyPositionParams, type PlaceBidParams, type PoolKey, type RevealBidParams, type RevealLockParams, type SetUnlockStrategyParams, type SignerOrProvider, type SubmitMatchResultsParams, type SwapParams, type UnlockTokensParams, type UserPosition, type WithdrawMatchResultParams, addLiq, amount0, amount1, balanceOf, buyVoucher, buyVoucherWithEth, calculateLiqDelta, calculatePriceFromTick, calculateTickFromPrice, calculateTickFromPriceWithSpacing, createAuction$1 as createAuction, createAuctionConfig, createAuction as createAuctionOnVault, createVoucher, getActiveAuctionsCount, getAllVouchers, getAuctionContract, getAuctionInfo, getAuctionLockInfo, getContract, getCurrentTick, getLiquidity, getLockInfo, getMatchResult, getPoolId, getPoolPrice, getPoolSqrtPrice, getProvider, getSqrtPriceAtTick, getUserPositions, getVoucherContract, getVoucherInfo, liquidity0, liquidity1, main, modifyPosition, mutiVoucherABI, placeBid, priceToSqrtPrice, removeLiq, removeLiqByPosition, revealBid, revealLock, submitMatchResults, swap, toWei, unlockTokens, useVoucher, withdrawMatchResult };
|
package/dist/index.js
CHANGED
|
@@ -36179,7 +36179,7 @@ var require_place = __commonJS({
|
|
|
36179
36179
|
const epoch = await placeLimitOrder(hook, poolKey, ticklow, zeroForOne, liquidity);
|
|
36180
36180
|
return epoch;
|
|
36181
36181
|
}
|
|
36182
|
-
async function
|
|
36182
|
+
async function main4() {
|
|
36183
36183
|
const provider2 = new ethers_exports.providers.JsonRpcProvider(RPC_URL);
|
|
36184
36184
|
const wallet2 = new ethers_exports.Wallet(PRIVATE_KEY, provider2);
|
|
36185
36185
|
const token0 = await getContract(wallet2, "Token0");
|
|
@@ -36196,7 +36196,7 @@ var require_place = __commonJS({
|
|
|
36196
36196
|
console.log("Token1 change:", token1After - token1Before);
|
|
36197
36197
|
}
|
|
36198
36198
|
if (typeof require !== "undefined" && typeof module2 !== "undefined" && require.main === module2) {
|
|
36199
|
-
|
|
36199
|
+
main4().catch((error) => {
|
|
36200
36200
|
console.error(error);
|
|
36201
36201
|
process.exit(1);
|
|
36202
36202
|
});
|
|
@@ -36247,6 +36247,8 @@ __export(index_exports, {
|
|
|
36247
36247
|
mutiVoucherABI: () => mutiVoucherABI,
|
|
36248
36248
|
placeBid: () => placeBid,
|
|
36249
36249
|
priceToSqrtPrice: () => priceToSqrtPrice,
|
|
36250
|
+
removeLiq: () => removeLiq,
|
|
36251
|
+
removeLiqByPosition: () => removeLiqByPosition,
|
|
36250
36252
|
revealBid: () => revealBid,
|
|
36251
36253
|
revealLock: () => revealLock,
|
|
36252
36254
|
submitMatchResults: () => submitMatchResults,
|
|
@@ -38582,13 +38584,6 @@ async function addLiq(wallet2, priceLower, priceUpper, amount02, amount12, poolK
|
|
|
38582
38584
|
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38583
38585
|
const amount0Big = BigInt(amount02);
|
|
38584
38586
|
const amount1Big = BigInt(amount12);
|
|
38585
|
-
console.log(`[SDK] Validating network and wallet...`);
|
|
38586
|
-
if (wallet2.provider) {
|
|
38587
|
-
const net = await wallet2.provider.getNetwork();
|
|
38588
|
-
console.log(`[SDK] Wallet connected to chainId: ${net.chainId}`);
|
|
38589
|
-
} else {
|
|
38590
|
-
console.warn(`[SDK] Wallet has no provider attached!`);
|
|
38591
|
-
}
|
|
38592
38587
|
const ticklow = calculateTickFromPriceWithSpacing(priceLower, poolKey.tickSpacing);
|
|
38593
38588
|
const tickhigh = calculateTickFromPriceWithSpacing(priceUpper, poolKey.tickSpacing);
|
|
38594
38589
|
let sqrtCurrent;
|
|
@@ -38648,6 +38643,75 @@ if (typeof require !== "undefined" && typeof module !== "undefined" && require.m
|
|
|
38648
38643
|
});
|
|
38649
38644
|
}
|
|
38650
38645
|
|
|
38646
|
+
// src/uniswap/1-marketprice/removeLiquidity.ts
|
|
38647
|
+
init_lib49();
|
|
38648
|
+
init_uniswap_config();
|
|
38649
|
+
init_pool();
|
|
38650
|
+
init_ERC20();
|
|
38651
|
+
init_liqCalculation();
|
|
38652
|
+
init_contract();
|
|
38653
|
+
async function removeLiqByPosition(wallet2, tickLower, tickUpper, liquidityToRemove) {
|
|
38654
|
+
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38655
|
+
let liqDelta = BigInt(liquidityToRemove.toString());
|
|
38656
|
+
if (liqDelta > 0n) {
|
|
38657
|
+
liqDelta = liqDelta * -1n;
|
|
38658
|
+
}
|
|
38659
|
+
console.log(`[SDK] Attempting to remove liquidity ${liqDelta} from ticks [${tickLower}, ${tickUpper}]`);
|
|
38660
|
+
const modifyPositionParams = {
|
|
38661
|
+
tickLower,
|
|
38662
|
+
tickUpper,
|
|
38663
|
+
liquidityDelta: liqDelta
|
|
38664
|
+
};
|
|
38665
|
+
const receipt = await modifyPosition(liqPool, modifyPositionParams, "0x00");
|
|
38666
|
+
return receipt;
|
|
38667
|
+
}
|
|
38668
|
+
async function removeLiq(wallet2, priceLower, priceUpper, amount02, amount12, poolKey) {
|
|
38669
|
+
const ticklow = calculateTickFromPriceWithSpacing(priceLower, poolKey.tickSpacing);
|
|
38670
|
+
const tickhigh = calculateTickFromPriceWithSpacing(priceUpper, poolKey.tickSpacing);
|
|
38671
|
+
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38672
|
+
const sqrtCurrent = await getPoolSqrtPrice(liqPool);
|
|
38673
|
+
const [liqDelta, amount0Rmv, amount1Rmv] = calculateLiqDelta(ticklow, sqrtCurrent, tickhigh, amount02, amount12);
|
|
38674
|
+
console.log(`Attempting to remove liquidity ${liqDelta} to price range [${priceLower}, ${priceUpper}] with amount0[${amount0Rmv.toString()}], amount1[${amount1Rmv.toString()}]`);
|
|
38675
|
+
const modifyPositionParams = {
|
|
38676
|
+
tickLower: ticklow,
|
|
38677
|
+
tickUpper: tickhigh,
|
|
38678
|
+
liquidityDelta: liqDelta * -1n
|
|
38679
|
+
};
|
|
38680
|
+
const receipt = await modifyPosition(liqPool, modifyPositionParams, "0x00");
|
|
38681
|
+
return receipt;
|
|
38682
|
+
}
|
|
38683
|
+
async function main3() {
|
|
38684
|
+
const provider2 = new lib_exports3.JsonRpcProvider(RPC_URL);
|
|
38685
|
+
const wallet2 = new Wallet(PRIVATE_KEY, provider2);
|
|
38686
|
+
const liqPoolAddress = CONTRACT_ADDRESSES.LiquidPool;
|
|
38687
|
+
const token0 = await getContract(wallet2, "Token0");
|
|
38688
|
+
const token1 = await getContract(wallet2, "Token1");
|
|
38689
|
+
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38690
|
+
let poolPrice = await getPoolPrice(liqPool);
|
|
38691
|
+
console.log(`Current price of pool ${liqPool.address} before removing liquidity is ${poolPrice}`);
|
|
38692
|
+
const token0Before = await getERC20Balance(token0, wallet2.address);
|
|
38693
|
+
const token1Before = await getERC20Balance(token1, wallet2.address);
|
|
38694
|
+
console.log("Token0 balance before removing liquidity:", token0Before.toString());
|
|
38695
|
+
console.log("Token1 balance before removing liquidity:", token1Before.toString());
|
|
38696
|
+
const priceLower = 0.5;
|
|
38697
|
+
const priceUpper = 1.5;
|
|
38698
|
+
const amount02 = 100n;
|
|
38699
|
+
const amount12 = 100n;
|
|
38700
|
+
await removeLiq(wallet2, priceLower, priceUpper, amount02, amount12, POOL_KEYS.limitOrderPoolKey);
|
|
38701
|
+
poolPrice = await getPoolPrice(liqPool);
|
|
38702
|
+
console.log(`Current price of pool ${liqPool.address} after removing liquidity is ${poolPrice}`);
|
|
38703
|
+
const token0After = await getERC20Balance(token0, wallet2.address);
|
|
38704
|
+
const token1After = await getERC20Balance(token1, wallet2.address);
|
|
38705
|
+
console.log("Token0 change:", token0After - token0Before);
|
|
38706
|
+
console.log("Token1 change:", token1After - token1Before);
|
|
38707
|
+
}
|
|
38708
|
+
if (typeof require !== "undefined" && typeof module !== "undefined" && require.main === module) {
|
|
38709
|
+
main3().catch((error) => {
|
|
38710
|
+
console.error(error);
|
|
38711
|
+
process.exit(1);
|
|
38712
|
+
});
|
|
38713
|
+
}
|
|
38714
|
+
|
|
38651
38715
|
// src/uniswap/1-marketprice/getPositions.ts
|
|
38652
38716
|
init_contract();
|
|
38653
38717
|
async function getUserPositions(wallet2, userAddress) {
|
|
@@ -38979,6 +39043,8 @@ function BuildUseVoucherTx(tx, voucherName) {
|
|
|
38979
39043
|
mutiVoucherABI,
|
|
38980
39044
|
placeBid,
|
|
38981
39045
|
priceToSqrtPrice,
|
|
39046
|
+
removeLiq,
|
|
39047
|
+
removeLiqByPosition,
|
|
38982
39048
|
revealBid,
|
|
38983
39049
|
revealLock,
|
|
38984
39050
|
submitMatchResults,
|
package/dist/index.mjs
CHANGED
|
@@ -36183,7 +36183,7 @@ var require_place = __commonJS({
|
|
|
36183
36183
|
const epoch = await placeLimitOrder(hook, poolKey, ticklow, zeroForOne, liquidity);
|
|
36184
36184
|
return epoch;
|
|
36185
36185
|
}
|
|
36186
|
-
async function
|
|
36186
|
+
async function main4() {
|
|
36187
36187
|
const provider2 = new ethers_exports.providers.JsonRpcProvider(RPC_URL);
|
|
36188
36188
|
const wallet2 = new ethers_exports.Wallet(PRIVATE_KEY, provider2);
|
|
36189
36189
|
const token0 = await getContract(wallet2, "Token0");
|
|
@@ -36200,7 +36200,7 @@ var require_place = __commonJS({
|
|
|
36200
36200
|
console.log("Token1 change:", token1After - token1Before);
|
|
36201
36201
|
}
|
|
36202
36202
|
if (typeof __require !== "undefined" && typeof module2 !== "undefined" && __require.main === module2) {
|
|
36203
|
-
|
|
36203
|
+
main4().catch((error) => {
|
|
36204
36204
|
console.error(error);
|
|
36205
36205
|
process.exit(1);
|
|
36206
36206
|
});
|
|
@@ -36251,6 +36251,8 @@ __export(index_exports, {
|
|
|
36251
36251
|
mutiVoucherABI: () => mutiVoucherABI,
|
|
36252
36252
|
placeBid: () => placeBid,
|
|
36253
36253
|
priceToSqrtPrice: () => priceToSqrtPrice,
|
|
36254
|
+
removeLiq: () => removeLiq,
|
|
36255
|
+
removeLiqByPosition: () => removeLiqByPosition,
|
|
36254
36256
|
revealBid: () => revealBid,
|
|
36255
36257
|
revealLock: () => revealLock,
|
|
36256
36258
|
submitMatchResults: () => submitMatchResults,
|
|
@@ -38585,13 +38587,6 @@ async function addLiq(wallet2, priceLower, priceUpper, amount02, amount12, poolK
|
|
|
38585
38587
|
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38586
38588
|
const amount0Big = BigInt(amount02);
|
|
38587
38589
|
const amount1Big = BigInt(amount12);
|
|
38588
|
-
console.log(`[SDK] Validating network and wallet...`);
|
|
38589
|
-
if (wallet2.provider) {
|
|
38590
|
-
const net = await wallet2.provider.getNetwork();
|
|
38591
|
-
console.log(`[SDK] Wallet connected to chainId: ${net.chainId}`);
|
|
38592
|
-
} else {
|
|
38593
|
-
console.warn(`[SDK] Wallet has no provider attached!`);
|
|
38594
|
-
}
|
|
38595
38590
|
const ticklow = calculateTickFromPriceWithSpacing(priceLower, poolKey.tickSpacing);
|
|
38596
38591
|
const tickhigh = calculateTickFromPriceWithSpacing(priceUpper, poolKey.tickSpacing);
|
|
38597
38592
|
let sqrtCurrent;
|
|
@@ -38651,6 +38646,75 @@ if (typeof __require !== "undefined" && typeof module !== "undefined" && __requi
|
|
|
38651
38646
|
});
|
|
38652
38647
|
}
|
|
38653
38648
|
|
|
38649
|
+
// src/uniswap/1-marketprice/removeLiquidity.ts
|
|
38650
|
+
init_lib49();
|
|
38651
|
+
init_uniswap_config();
|
|
38652
|
+
init_pool();
|
|
38653
|
+
init_ERC20();
|
|
38654
|
+
init_liqCalculation();
|
|
38655
|
+
init_contract();
|
|
38656
|
+
async function removeLiqByPosition(wallet2, tickLower, tickUpper, liquidityToRemove) {
|
|
38657
|
+
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38658
|
+
let liqDelta = BigInt(liquidityToRemove.toString());
|
|
38659
|
+
if (liqDelta > 0n) {
|
|
38660
|
+
liqDelta = liqDelta * -1n;
|
|
38661
|
+
}
|
|
38662
|
+
console.log(`[SDK] Attempting to remove liquidity ${liqDelta} from ticks [${tickLower}, ${tickUpper}]`);
|
|
38663
|
+
const modifyPositionParams = {
|
|
38664
|
+
tickLower,
|
|
38665
|
+
tickUpper,
|
|
38666
|
+
liquidityDelta: liqDelta
|
|
38667
|
+
};
|
|
38668
|
+
const receipt = await modifyPosition(liqPool, modifyPositionParams, "0x00");
|
|
38669
|
+
return receipt;
|
|
38670
|
+
}
|
|
38671
|
+
async function removeLiq(wallet2, priceLower, priceUpper, amount02, amount12, poolKey) {
|
|
38672
|
+
const ticklow = calculateTickFromPriceWithSpacing(priceLower, poolKey.tickSpacing);
|
|
38673
|
+
const tickhigh = calculateTickFromPriceWithSpacing(priceUpper, poolKey.tickSpacing);
|
|
38674
|
+
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38675
|
+
const sqrtCurrent = await getPoolSqrtPrice(liqPool);
|
|
38676
|
+
const [liqDelta, amount0Rmv, amount1Rmv] = calculateLiqDelta(ticklow, sqrtCurrent, tickhigh, amount02, amount12);
|
|
38677
|
+
console.log(`Attempting to remove liquidity ${liqDelta} to price range [${priceLower}, ${priceUpper}] with amount0[${amount0Rmv.toString()}], amount1[${amount1Rmv.toString()}]`);
|
|
38678
|
+
const modifyPositionParams = {
|
|
38679
|
+
tickLower: ticklow,
|
|
38680
|
+
tickUpper: tickhigh,
|
|
38681
|
+
liquidityDelta: liqDelta * -1n
|
|
38682
|
+
};
|
|
38683
|
+
const receipt = await modifyPosition(liqPool, modifyPositionParams, "0x00");
|
|
38684
|
+
return receipt;
|
|
38685
|
+
}
|
|
38686
|
+
async function main3() {
|
|
38687
|
+
const provider2 = new lib_exports3.JsonRpcProvider(RPC_URL);
|
|
38688
|
+
const wallet2 = new Wallet(PRIVATE_KEY, provider2);
|
|
38689
|
+
const liqPoolAddress = CONTRACT_ADDRESSES.LiquidPool;
|
|
38690
|
+
const token0 = await getContract(wallet2, "Token0");
|
|
38691
|
+
const token1 = await getContract(wallet2, "Token1");
|
|
38692
|
+
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38693
|
+
let poolPrice = await getPoolPrice(liqPool);
|
|
38694
|
+
console.log(`Current price of pool ${liqPool.address} before removing liquidity is ${poolPrice}`);
|
|
38695
|
+
const token0Before = await getERC20Balance(token0, wallet2.address);
|
|
38696
|
+
const token1Before = await getERC20Balance(token1, wallet2.address);
|
|
38697
|
+
console.log("Token0 balance before removing liquidity:", token0Before.toString());
|
|
38698
|
+
console.log("Token1 balance before removing liquidity:", token1Before.toString());
|
|
38699
|
+
const priceLower = 0.5;
|
|
38700
|
+
const priceUpper = 1.5;
|
|
38701
|
+
const amount02 = 100n;
|
|
38702
|
+
const amount12 = 100n;
|
|
38703
|
+
await removeLiq(wallet2, priceLower, priceUpper, amount02, amount12, POOL_KEYS.limitOrderPoolKey);
|
|
38704
|
+
poolPrice = await getPoolPrice(liqPool);
|
|
38705
|
+
console.log(`Current price of pool ${liqPool.address} after removing liquidity is ${poolPrice}`);
|
|
38706
|
+
const token0After = await getERC20Balance(token0, wallet2.address);
|
|
38707
|
+
const token1After = await getERC20Balance(token1, wallet2.address);
|
|
38708
|
+
console.log("Token0 change:", token0After - token0Before);
|
|
38709
|
+
console.log("Token1 change:", token1After - token1Before);
|
|
38710
|
+
}
|
|
38711
|
+
if (typeof __require !== "undefined" && typeof module !== "undefined" && __require.main === module) {
|
|
38712
|
+
main3().catch((error) => {
|
|
38713
|
+
console.error(error);
|
|
38714
|
+
process.exit(1);
|
|
38715
|
+
});
|
|
38716
|
+
}
|
|
38717
|
+
|
|
38654
38718
|
// src/uniswap/1-marketprice/getPositions.ts
|
|
38655
38719
|
init_contract();
|
|
38656
38720
|
async function getUserPositions(wallet2, userAddress) {
|
|
@@ -38981,6 +39045,8 @@ export {
|
|
|
38981
39045
|
mutiVoucherABI,
|
|
38982
39046
|
placeBid,
|
|
38983
39047
|
priceToSqrtPrice,
|
|
39048
|
+
removeLiq,
|
|
39049
|
+
removeLiqByPosition,
|
|
38984
39050
|
revealBid,
|
|
38985
39051
|
revealLock,
|
|
38986
39052
|
submitMatchResults,
|