create pools script (uncommenting approvals and adding reset USDT)
This commit is contained in:
@@ -139,13 +139,13 @@ const TEST_TOKENS = currentConfig.tokens;
|
|||||||
|
|
||||||
// Default pool parameters
|
// Default pool parameters
|
||||||
const DEFAULT_POOL_PARAMS = {
|
const DEFAULT_POOL_PARAMS = {
|
||||||
name: 'Liquidity Party POC',
|
name: 'Original Genesis of Liquidity Party',
|
||||||
symbol: 'POC.LP',
|
symbol: 'OG.LP',
|
||||||
kappa: ethers.BigNumber.from('184467440737095520'), //0.01 * 2^64
|
kappa: ethers.BigNumber.from('184467440737095520'), //0.01 * 2^64
|
||||||
swapFeesPpm: Object.values(TEST_TOKENS).map(t => t.feePpm),
|
swapFeesPpm: Object.values(TEST_TOKENS).map(t => t.feePpm),
|
||||||
flashFeePpm: 5, // 0.0005%
|
flashFeePpm: 5, // 0.0005%
|
||||||
stable: false,
|
stable: false,
|
||||||
initialLpAmount: ethers.utils.parseUnits('100', 18) // 100 USD in 18 decimals
|
initialLpAmount: ethers.utils.parseUnits('1', 18) // 100 USD in 18 decimals
|
||||||
};
|
};
|
||||||
|
|
||||||
// Input amount in USD
|
// Input amount in USD
|
||||||
@@ -289,13 +289,13 @@ async function approveTokens(provider, tokenAmounts, receiverPrivateKey) {
|
|||||||
console.log(` [~] Approving ${symbol} ${tokenInfo.address} ${approvalAmount} (1% buffer)...`);
|
console.log(` [~] Approving ${symbol} ${tokenInfo.address} ${approvalAmount} (1% buffer)...`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// // USDT and some tokens require setting allowance to 0 before setting a new value
|
// USDT and some tokens require setting allowance to 0 before setting a new value
|
||||||
// // Skip for BNB as it has a broken approve function
|
// Skip for BNB as it has a broken approve function
|
||||||
// if (symbol !== 'BNB') {
|
if (symbol == 'USDT') {
|
||||||
// const resetTx = await tokenContract.approve(PARTY_PLANNER_ADDRESS, 0);
|
const resetTx = await tokenContract.approve(PARTY_PLANNER_ADDRESS, 0);
|
||||||
// await resetTx.wait();
|
await resetTx.wait();
|
||||||
// console.log(` [+] ${symbol} allowance reset to 0`);
|
console.log(` [+] ${symbol} allowance reset to 0`);
|
||||||
// }
|
}
|
||||||
|
|
||||||
const tx = await tokenContract.approve(PARTY_PLANNER_ADDRESS, approvalAmount);
|
const tx = await tokenContract.approve(PARTY_PLANNER_ADDRESS, approvalAmount);
|
||||||
await tx.wait();
|
await tx.wait();
|
||||||
@@ -445,14 +445,14 @@ async function main() {
|
|||||||
// Step 4: Check balances
|
// Step 4: Check balances
|
||||||
await checkBalances(provider, wallet, tokenAmounts, RECEIVER_ADDRESS);
|
await checkBalances(provider, wallet, tokenAmounts, RECEIVER_ADDRESS);
|
||||||
|
|
||||||
// // // Step 5: Approve tokens
|
// // Step 5: Approve tokens
|
||||||
// if (NETWORK === 'mockchain' && currentConfig.receiverPrivateKey) {
|
if (NETWORK === 'mockchain' && currentConfig.receiverPrivateKey) {
|
||||||
// // On mockchain, use receiver wallet for approvals
|
// On mockchain, use receiver wallet for approvals
|
||||||
// await approveTokens(provider, tokenAmounts, currentConfig.receiverPrivateKey);
|
await approveTokens(provider, tokenAmounts, currentConfig.receiverPrivateKey);
|
||||||
// } else if (NETWORK === 'mainnet') {
|
} else if (NETWORK === 'mainnet') {
|
||||||
// // On mainnet, use the main wallet (payer and receiver are the same)
|
// On mainnet, use the main wallet (payer and receiver are the same)
|
||||||
// await approveTokens(provider, tokenAmounts, PRIVATE_KEY);
|
await approveTokens(provider, tokenAmounts, PRIVATE_KEY);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Step 6: Create pool
|
// Step 6: Create pool
|
||||||
await createPool(wallet, tokenAmounts);
|
await createPool(wallet, tokenAmounts);
|
||||||
|
|||||||
Reference in New Issue
Block a user