-
Notifications
You must be signed in to change notification settings - Fork 8
/
uni-v2-like-add-liquidity-beefy-deposit-combo-meal.ts
65 lines (57 loc) · 2.19 KB
/
uni-v2-like-add-liquidity-beefy-deposit-combo-meal.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import {
ComboMealConfig,
RecipeERC20Amount,
RecipeERC20Info,
UniswapV2Fork,
} from '../../models/export-models';
import { Recipe } from '../../recipes';
import { UniV2LikeAddLiquidityRecipe } from '../../recipes/liquidity/uni-v2-like/uni-v2-like-add-liquidity-recipe';
import { BeefyDepositRecipe } from '../../recipes/vault/beefy/beefy-deposit-recipe';
import { ComboMeal } from '../combo-meal';
import { UniV2LikeSDK } from '../../api/uni-v2-like/uni-v2-like-sdk';
import { NetworkName } from '@railgun-community/shared-models';
import { Provider } from 'ethers';
import { MIN_GAS_LIMIT_COMBO_MEAL } from '../../models/min-gas-limits';
export class UniV2LikeAddLiquidity_BeefyDeposit_ComboMeal extends ComboMeal {
readonly config: ComboMealConfig = {
name: '[NAME] Add Liquidity + Beefy Vault Deposit Combo Meal',
description:
'Adds liquidity to a [NAME] Pool and deposits the LP tokens into a Beefy Vault.',
minGasLimit: MIN_GAS_LIMIT_COMBO_MEAL,
};
private readonly uniV2LikeAddLiquidityRecipe: UniV2LikeAddLiquidityRecipe;
private readonly beefyDepositRecipe: BeefyDepositRecipe;
constructor(
uniswapV2Fork: UniswapV2Fork,
erc20InfoA: RecipeERC20Info,
erc20InfoB: RecipeERC20Info,
slippageBasisPoints: bigint,
vaultID: string,
provider: Provider,
) {
super();
this.uniV2LikeAddLiquidityRecipe = new UniV2LikeAddLiquidityRecipe(
uniswapV2Fork,
erc20InfoA,
erc20InfoB,
slippageBasisPoints,
provider,
);
this.beefyDepositRecipe = new BeefyDepositRecipe(vaultID);
const forkName = UniV2LikeSDK.getForkName(uniswapV2Fork);
this.config.name = `${forkName} Add Liquidity + Beefy Vault Deposit Combo Meal`;
this.config.description = `Adds liquidity to a ${forkName} Pool and deposits the LP tokens into a Beefy Vault.`;
}
getAddLiquidityAmountBForUnshield(
networkName: NetworkName,
targetUnshieldERC20AmountA: RecipeERC20Amount,
) {
return this.uniV2LikeAddLiquidityRecipe.getAddLiquidityAmountBForUnshield(
networkName,
targetUnshieldERC20AmountA,
);
}
protected async getRecipes(): Promise<Recipe[]> {
return [this.uniV2LikeAddLiquidityRecipe, this.beefyDepositRecipe];
}
}