@dhedge/v2-sdk 1.9.6 → 1.9.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/v2-sdk",
3
- "version": "1.9.6",
3
+ "version": "1.9.8",
4
4
  "license": "MIT",
5
5
  "description": "🛠 An SDK for building applications on top of dHEDGE V2",
6
6
  "main": "dist/index.js",
package/src/config.ts CHANGED
@@ -47,14 +47,16 @@ export const routerAddress: AddressDappNetworkMap = {
47
47
  },
48
48
  [Network.ARBITRUM]: {
49
49
  [Dapp.ONEINCH]: "0x1111111254EEB25477B68fb85Ed929f73A960582",
50
- [Dapp.UNISWAPV3]: "0xe592427a0aece92de3edee1f18e0157c05861564",
50
+ [Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
51
51
  [Dapp.AAVEV3]: "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
52
52
  [Dapp.BALANCER]: "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
53
53
  [Dapp.RAMSES]: "0xaaa87963efeb6f7e0a2711f397663105acb1805e"
54
54
  },
55
55
  [Network.BASE]: {
56
56
  [Dapp.ONEINCH]: "0x1111111254EEB25477B68fb85Ed929f73A960582",
57
- [Dapp.ZEROEX]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff"
57
+ [Dapp.ZEROEX]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
58
+ [Dapp.AERODROME]: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
59
+ [Dapp.AAVEV3]: "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5"
58
60
  }
59
61
  };
60
62
 
@@ -119,14 +119,19 @@ export class Pool {
119
119
  * @param {string} nasset Address of deposit asset
120
120
  * @param {BigNumber | string} amount Amount to be approved
121
121
  * @param {any} options Transaction options
122
+ * @param {boolean} estimateGas Simulate/estimate gas
122
123
  * @returns {Promise<any>} Transaction
123
124
  */
124
125
  async approveDeposit(
125
126
  asset: string,
126
127
  amount: BigNumber | string,
127
- options: any = null
128
+ options: any = null,
129
+ estimateGas = false
128
130
  ): Promise<any> {
129
131
  const iERC20 = new ethers.Contract(asset, IERC20.abi, this.signer);
132
+ if (estimateGas) {
133
+ return await iERC20.estimateGas.approve(this.address, amount, options);
134
+ }
130
135
  const tx = await iERC20.approve(this.address, amount, options);
131
136
  return tx;
132
137
  }
@@ -136,13 +141,18 @@ export class Pool {
136
141
  * @param {string} asset Address of asset
137
142
  * @param {BigNumber | string} amount Amount to be deposited
138
143
  * @param {any} options Transaction options
144
+ * @param {boolean} estimateGas Simulate/estimate gas
139
145
  * @returns {Promise<any>} Transaction
140
146
  */
141
147
  async deposit(
142
148
  asset: string,
143
149
  amount: string | BigNumber,
144
- options: any = null
150
+ options: any = null,
151
+ estimateGas = false
145
152
  ): Promise<any> {
153
+ if (estimateGas) {
154
+ return await this.poolLogic.estimateGas.deposit(asset, amount, options);
155
+ }
146
156
  const tx = await this.poolLogic.deposit(asset, amount, options);
147
157
  return tx;
148
158
  }
@@ -151,12 +161,20 @@ export class Pool {
151
161
  * Withdraw assets from a pool
152
162
  * @param fundTokenAmount Amount of pool tokens to be withdrawn
153
163
  * @param {any} options Transaction options
164
+ * @param {boolean} estimateGas Simulate/estimate gas
154
165
  * @returns {Promise<any>} Transaction
155
166
  */
156
167
  async withdraw(
157
168
  fundTokenAmount: string | BigNumber,
158
- options: any = null
169
+ options: any = null,
170
+ estimateGas = false
159
171
  ): Promise<any> {
172
+ if (estimateGas) {
173
+ return await this.poolLogic.estimateGas.withdraw(
174
+ fundTokenAmount,
175
+ options
176
+ );
177
+ }
160
178
  const tx = await this.poolLogic.withdraw(fundTokenAmount, options);
161
179
  return tx;
162
180
  }
@@ -513,6 +531,7 @@ export class Pool {
513
531
  stakeTxData = getVelodromeStakeTxData(amount, false);
514
532
  break;
515
533
  case Dapp.VELODROMEV2:
534
+ case Dapp.AERODROME:
516
535
  stakeTxData = getVelodromeStakeTxData(amount, true);
517
536
  break;
518
537
  default:
@@ -742,11 +761,13 @@ export class Pool {
742
761
  * Change enabled pool assets
743
762
  * @param {AssetEnabled[]} assets New pool assets
744
763
  * @param {any} options Transaction options
764
+ * @param {boolean} estimateGas Simulate/estimate gas
745
765
  * @returns {Promise<any>} Transaction
746
766
  */
747
767
  public async changeAssets(
748
768
  assets: AssetEnabled[],
749
- options: any = null
769
+ options: any = null,
770
+ estimateGas = false
750
771
  ): Promise<any> {
751
772
  const currentAssetsEnabled = await this.getComposition();
752
773
  const currentAssets = currentAssetsEnabled.map(e =>
@@ -755,6 +776,14 @@ export class Pool {
755
776
  const newAssets = assets.map(e => e.asset.toLocaleLowerCase());
756
777
  const removedAssets = currentAssets.filter(e => !newAssets.includes(e));
757
778
  const changedAssets = assets.map(e => [e.asset, e.isDeposit]);
779
+
780
+ if (estimateGas) {
781
+ return await this.managerLogic.estimateGas.changeAssets(
782
+ changedAssets,
783
+ removedAssets,
784
+ options
785
+ );
786
+ }
758
787
  const tx = await this.managerLogic.changeAssets(
759
788
  changedAssets,
760
789
  removedAssets,
@@ -767,9 +796,17 @@ export class Pool {
767
796
  * Set a new trader with trading permissions
768
797
  * @param {string} trader Address trader account
769
798
  * @param {any} options Transaction options
799
+ * @param {boolean} estimateGas Simulate/estimate gas
770
800
  * @returns {Promise<any>} Transaction
771
801
  */
772
- async setTrader(trader: string, options: any = null): Promise<any> {
802
+ async setTrader(
803
+ trader: string,
804
+ options: any = null,
805
+ estimateGas = false
806
+ ): Promise<any> {
807
+ if (estimateGas) {
808
+ return await this.managerLogic.estimateGas.setTrader(trader, options);
809
+ }
773
810
  const tx = await this.managerLogic.setTrader(trader, options);
774
811
  return tx;
775
812
  }
@@ -1117,6 +1154,7 @@ export class Pool {
1117
1154
  txData = getVelodromeClaimTxData(this, tokenId, false);
1118
1155
  break;
1119
1156
  case Dapp.VELODROMEV2:
1157
+ case Dapp.AERODROME:
1120
1158
  contractAddress = tokenId;
1121
1159
  txData = getVelodromeClaimTxData(this, tokenId, true);
1122
1160
  break;
@@ -1320,7 +1358,7 @@ export class Pool {
1320
1358
 
1321
1359
  /**
1322
1360
  * Add liquidity to Velodrome V2 or Ramses pool
1323
- * @param {Dapp} dapp VelodromeV2 or Ramses
1361
+ * @param {Dapp} dapp VelodromeV2, Ramses or Aerodrome
1324
1362
  * @param {string} assetA First asset
1325
1363
  * @param {string} assetB Second asset
1326
1364
  * @param {BigNumber | string} amountA Amount first asset
@@ -1331,7 +1369,7 @@ export class Pool {
1331
1369
  * @returns {Promise<any>} Transaction
1332
1370
  */
1333
1371
  async addLiquidityV2(
1334
- dapp: Dapp.VELODROMEV2 | Dapp.RAMSES,
1372
+ dapp: Dapp.VELODROMEV2 | Dapp.RAMSES | Dapp.AERODROME,
1335
1373
  assetA: string,
1336
1374
  assetB: string,
1337
1375
  amountA: BigNumber | string,
@@ -1361,7 +1399,7 @@ export class Pool {
1361
1399
 
1362
1400
  /**
1363
1401
  * Remove liquidity from Velodrome V2 or Ramses pool
1364
- * @param {Dapp} dapp VelodromeV2 or Ramses
1402
+ * @param {Dapp} dapp VelodromeV2, Ramses or Aerodrome
1365
1403
  * @param {string} assetA First asset
1366
1404
  * @param {string} assetB Second asset
1367
1405
  * @param {BigNumber | string} amount Amount of LP tokens
@@ -1371,7 +1409,7 @@ export class Pool {
1371
1409
  * @returns {Promise<any>} Transaction
1372
1410
  */
1373
1411
  async removeLiquidityV2(
1374
- dapp: Dapp.VELODROMEV2 | Dapp.RAMSES,
1412
+ dapp: Dapp.VELODROMEV2 | Dapp.RAMSES | Dapp.AERODROME,
1375
1413
  assetA: string,
1376
1414
  assetB: string,
1377
1415
  amount: BigNumber | string,
@@ -1526,9 +1564,13 @@ export class Pool {
1526
1564
  /**
1527
1565
  * mintManagerFee
1528
1566
  * @param {any} options Transaction options
1567
+ * @param {boolean} estimateGas Simulate/estimate gas
1529
1568
  * @returns {Promise<any>} Transaction
1530
1569
  */
1531
- async mintManagerFee(options: any = null): Promise<any> {
1570
+ async mintManagerFee(options: any = null, estimateGas = false): Promise<any> {
1571
+ if (estimateGas) {
1572
+ return await this.poolLogic.estimateGas.mintManagerFee(options);
1573
+ }
1532
1574
  const tx = await this.poolLogic.mintManagerFee(options);
1533
1575
  return tx;
1534
1576
  }
@@ -0,0 +1,154 @@
1
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import BigNumber from "bignumber.js";
4
+ import { Dhedge, Pool } from "..";
5
+ import { routerAddress } from "../config";
6
+ import { Dapp, Network } from "../types";
7
+ import { CONTRACT_ADDRESS, MAX_AMOUNT, TEST_POOL } from "./constants";
8
+ import {
9
+ TestingRunParams,
10
+ beforeAfterReset,
11
+ setUSDCAmount,
12
+ testingHelper
13
+ } from "./utils/testingHelper";
14
+ import { allowanceDelta, balanceDelta } from "./utils/token";
15
+ import { getWalletData } from "./wallet";
16
+
17
+ const testAerodrome = ({ network, provider }: TestingRunParams) => {
18
+ const WETH_USDC_Lp = "0xcDAC0d6c6C59727a65F871236188350531885C43";
19
+ const WETH_USDC__Gauge = "0x519BBD1Dd8C6A94C46080E24f316c14Ee758C025";
20
+
21
+ const USDC = CONTRACT_ADDRESS[network].USDC;
22
+ const WETH = CONTRACT_ADDRESS[network].WETH;
23
+ const AERO = "0x940181a94A35A4569E4529A3CDfB74e38FD98631";
24
+
25
+ let dhedge: Dhedge;
26
+ let pool: Pool;
27
+ jest.setTimeout(100000);
28
+
29
+ describe(`[${network}] aerodrome tests`, () => {
30
+ beforeAll(async () => {
31
+ const { wallet } = getWalletData(network);
32
+ // top up ETH (gas)
33
+ await provider.send("hardhat_setBalance", [
34
+ wallet.address,
35
+ "0x100000000000000"
36
+ ]);
37
+ dhedge = new Dhedge(wallet, network);
38
+ pool = await dhedge.loadPool(TEST_POOL[network]);
39
+ await setUSDCAmount({
40
+ amount: new BigNumber(10).times(1e6).toFixed(0),
41
+ userAddress: pool.address,
42
+ network,
43
+ provider
44
+ });
45
+ await pool.approve(Dapp.ONEINCH, USDC, MAX_AMOUNT);
46
+ await pool.trade(Dapp.ONEINCH, USDC, WETH, (5 * 1e6).toString());
47
+ });
48
+ beforeAfterReset({ beforeAll, afterAll, provider });
49
+
50
+ it("approves unlimited USDC and swETH on for Aerodrome", async () => {
51
+ await pool.approve(Dapp.AERODROME, USDC, MAX_AMOUNT);
52
+ await pool.approve(Dapp.AERODROME, WETH, MAX_AMOUNT);
53
+ const UsdcAllowanceDelta = await allowanceDelta(
54
+ pool.address,
55
+ USDC,
56
+ routerAddress[network].aerodrome!,
57
+ pool.signer
58
+ );
59
+ await expect(UsdcAllowanceDelta.gt(0));
60
+ });
61
+
62
+ it("adds USDC and WETH to a Aerodrome volatile pool", async () => {
63
+ const usdcBalance = await pool.utils.getBalance(USDC, pool.address);
64
+ const wethBalance = await pool.utils.getBalance(WETH, pool.address);
65
+ await pool.addLiquidityV2(
66
+ Dapp.AERODROME,
67
+ WETH,
68
+ USDC,
69
+ wethBalance,
70
+ usdcBalance,
71
+ false
72
+ );
73
+
74
+ const lpTokenDelta = await balanceDelta(
75
+ pool.address,
76
+ WETH_USDC_Lp,
77
+ pool.signer
78
+ );
79
+ expect(lpTokenDelta.gt(0));
80
+ });
81
+
82
+ it("should stake WETH-USDC LP in a gauge", async () => {
83
+ const balance = await dhedge.utils.getBalance(WETH_USDC_Lp, pool.address);
84
+ await pool.approveSpender(WETH_USDC__Gauge, WETH_USDC_Lp, MAX_AMOUNT);
85
+ await pool.stakeInGauge(Dapp.AERODROME, WETH_USDC__Gauge, balance);
86
+ const gaugeBalance = await balanceDelta(
87
+ pool.address,
88
+ WETH_USDC__Gauge,
89
+ pool.signer
90
+ );
91
+ expect(gaugeBalance.gt(0));
92
+ });
93
+
94
+ it("should claim rewards from Gauge", async () => {
95
+ await provider.send("evm_increaseTime", [24 * 60 * 60]); // 1 day
96
+ await provider.send("evm_mine", []);
97
+ const claimTx = await pool.claimFees(Dapp.AERODROME, WETH_USDC__Gauge);
98
+ expect(claimTx).not.toBe(null);
99
+ const aeroBalanceDelta = await balanceDelta(
100
+ pool.address,
101
+ AERO,
102
+ pool.signer
103
+ );
104
+ expect(aeroBalanceDelta.gt(0));
105
+ });
106
+
107
+ it("should unStakeWETH-USDC LP from a gauge", async () => {
108
+ const gaugeBalance = await dhedge.utils.getBalance(
109
+ WETH_USDC__Gauge,
110
+ pool.address
111
+ );
112
+ await pool.unstakeFromGauge(WETH_USDC__Gauge, gaugeBalance);
113
+ const lpTokenDelta = await balanceDelta(
114
+ pool.address,
115
+ WETH_USDC_Lp,
116
+ pool.signer
117
+ );
118
+ expect(lpTokenDelta.gt(0));
119
+ });
120
+
121
+ it("approves unlimited WETH-USDC LP for Aerodrome", async () => {
122
+ await pool.approve(Dapp.AERODROME, WETH_USDC_Lp, MAX_AMOUNT);
123
+ const lpAllowanceDelta = await allowanceDelta(
124
+ pool.address,
125
+ WETH_USDC_Lp,
126
+ routerAddress[network].aerodrome!,
127
+ pool.signer
128
+ );
129
+ expect(lpAllowanceDelta.gt(0));
130
+ });
131
+
132
+ it("should remove all liquidity from an existing pool ", async () => {
133
+ const balance = await dhedge.utils.getBalance(WETH_USDC_Lp, pool.address);
134
+ await pool.removeLiquidityV2(Dapp.AERODROME, WETH, USDC, balance, false);
135
+ const usdcBalanceDelta = await balanceDelta(
136
+ pool.address,
137
+ USDC,
138
+ pool.signer
139
+ );
140
+ const wethBalanceDelta = await balanceDelta(
141
+ pool.address,
142
+ WETH,
143
+ pool.signer
144
+ );
145
+ expect(usdcBalanceDelta.gt(0));
146
+ expect(wethBalanceDelta.gt(0));
147
+ });
148
+ });
149
+ };
150
+
151
+ testingHelper({
152
+ network: Network.BASE,
153
+ testingRun: testAerodrome
154
+ });
@@ -1,95 +1,139 @@
1
1
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import BigNumber from "bignumber.js";
3
4
  import { Dhedge, Pool } from "..";
4
5
  import { routerAddress } from "../config";
5
- import { Dapp, Network } from "../types";
6
+ import { AssetEnabled, Dapp, Network } from "../types";
6
7
  import { CONTRACT_ADDRESS, MAX_AMOUNT, TEST_POOL } from "./constants";
8
+ import {
9
+ TestingRunParams,
10
+ setUSDCAmount,
11
+ testingHelper,
12
+ wait
13
+ } from "./utils/testingHelper";
7
14
  import { allowanceDelta, balanceDelta } from "./utils/token";
8
15
 
9
- import { wallet } from "./wallet";
10
-
11
16
  //const network = Network.OPTIMISM;
12
17
  const network = Network.POLYGON;
13
18
  const USDC = CONTRACT_ADDRESS[network].USDC;
14
19
  const WETH = CONTRACT_ADDRESS[network].WETH;
15
-
16
- let dhedge: Dhedge;
17
- let pool: Pool;
18
20
  jest.setTimeout(100000);
19
21
 
20
- describe("pool", () => {
21
- beforeAll(async () => {
22
- dhedge = new Dhedge(wallet, network);
23
- pool = await dhedge.loadPool(TEST_POOL[network]);
24
- await pool.approve(Dapp.ONEINCH, USDC, MAX_AMOUNT);
25
- await pool.trade(Dapp.ONEINCH, USDC, WETH, "1000000", 0.5);
26
- });
22
+ const testArrakis = ({ wallet, network, provider }: TestingRunParams) => {
23
+ let dhedge: Dhedge;
24
+ let pool: Pool;
27
25
 
28
- it("approves unlimited USDC on Arrakis", async () => {
29
- await pool.approve(Dapp.ARRAKIS, USDC, MAX_AMOUNT);
30
- const usdcAllowanceDelta = await allowanceDelta(
31
- pool.address,
32
- USDC,
33
- routerAddress[network].arrakis!,
34
- pool.signer
35
- );
36
- await expect(usdcAllowanceDelta.gt(0));
37
- });
26
+ describe("pool", () => {
27
+ beforeAll(async () => {
28
+ dhedge = new Dhedge(wallet, network);
29
+ pool = await dhedge.loadPool(TEST_POOL[network]);
38
30
 
39
- it("approves unlimited WETH on Arrakis", async () => {
40
- await pool.approve(Dapp.ARRAKIS, WETH, MAX_AMOUNT);
41
- const wethAllowanceDelta = await allowanceDelta(
42
- pool.address,
43
- USDC,
44
- routerAddress[network].arrakis!,
45
- pool.signer
46
- );
47
- await expect(wethAllowanceDelta.gt(0));
48
- });
31
+ // top up gas
32
+ await provider.send("hardhat_setBalance", [
33
+ wallet.address,
34
+ "0x10000000000000000"
35
+ ]);
36
+ await provider.send("evm_mine", []);
37
+ await setUSDCAmount({
38
+ amount: new BigNumber(10000000).times(1e6).toFixed(0),
39
+ userAddress: pool.address,
40
+ network,
41
+ provider
42
+ });
49
43
 
50
- it("should add liquidity and stake in an WETH/USDC Arrakis pool", async () => {
51
- const usdcBalance = await pool.utils.getBalance(USDC, pool.address);
52
- const wethBalance = await pool.utils.getBalance(WETH, pool.address);
53
- await pool.increaseLiquidity(
54
- Dapp.ARRAKIS,
55
- CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
56
- usdcBalance,
57
- wethBalance
58
- );
59
- const lpBalanceDelta = await balanceDelta(
60
- pool.address,
61
- CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_LP,
62
- pool.signer
63
- );
64
- expect(lpBalanceDelta.gt(0));
65
- });
44
+ const newAssets: AssetEnabled[] = [
45
+ { asset: CONTRACT_ADDRESS[network].USDC, isDeposit: true },
46
+ { asset: CONTRACT_ADDRESS[network].WETH, isDeposit: true },
47
+ {
48
+ asset: CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
49
+ isDeposit: false
50
+ },
51
+ {
52
+ asset: CONTRACT_ADDRESS[network].WMATIC, // reward token
53
+ isDeposit: false
54
+ },
55
+ {
56
+ asset: CONTRACT_ADDRESS[network].uniswapV3.nonfungiblePositionManager,
57
+ isDeposit: false
58
+ }
59
+ ];
60
+ await pool.changeAssets(newAssets);
61
+ await pool.approve(Dapp.ONEINCH, USDC, MAX_AMOUNT);
62
+ await pool.trade(Dapp.ONEINCH, USDC, WETH, "10000000", 0.5, null, false);
63
+ });
66
64
 
67
- it("approves unlimited LP staking Token before on Arrakis", async () => {
68
- await pool.approve(
69
- Dapp.ARRAKIS,
70
- CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
71
- MAX_AMOUNT
72
- );
73
- const gaugeAllowanceDelta = await allowanceDelta(
74
- pool.address,
75
- CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
76
- routerAddress[network].arrakis!,
77
- pool.signer
78
- );
79
- await expect(gaugeAllowanceDelta.gt(0));
80
- });
65
+ it("approves unlimited USDC on Arrakis", async () => {
66
+ await pool.approve(Dapp.ARRAKIS, USDC, MAX_AMOUNT);
67
+ const usdcAllowanceDelta = await allowanceDelta(
68
+ pool.address,
69
+ USDC,
70
+ routerAddress[network].arrakis!,
71
+ pool.signer
72
+ );
73
+ await expect(usdcAllowanceDelta.gt(0));
74
+ await wait(5);
75
+ });
76
+
77
+ it("approves unlimited WETH on Arrakis", async () => {
78
+ await pool.approve(Dapp.ARRAKIS, WETH, MAX_AMOUNT);
79
+ const wethAllowanceDelta = await allowanceDelta(
80
+ pool.address,
81
+ USDC,
82
+ routerAddress[network].arrakis!,
83
+ pool.signer
84
+ );
85
+ await expect(wethAllowanceDelta.gt(0));
86
+ });
87
+
88
+ it("should add liquidity and stake in an WETH/USDC Arrakis pool", async () => {
89
+ const usdcBalance = await pool.utils.getBalance(USDC, pool.address);
90
+ const wethBalance = await pool.utils.getBalance(WETH, pool.address);
91
+ await pool.increaseLiquidity(
92
+ Dapp.ARRAKIS,
93
+ CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
94
+ usdcBalance,
95
+ wethBalance
96
+ );
97
+ const lpBalanceDelta = await balanceDelta(
98
+ pool.address,
99
+ CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_LP,
100
+ pool.signer
101
+ );
102
+ expect(lpBalanceDelta.gt(0));
103
+ });
81
104
 
82
- it("should remove liquidity from an existing pool ", async () => {
83
- await pool.decreaseLiquidity(
84
- Dapp.ARRAKIS,
85
- CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
86
- 100
87
- );
88
- const wethBalanceDelta = await balanceDelta(
89
- pool.address,
90
- CONTRACT_ADDRESS[network].WETH,
91
- pool.signer
92
- );
93
- expect(wethBalanceDelta.gt(0));
105
+ it("approves unlimited LP staking Token before on Arrakis", async () => {
106
+ await pool.approve(
107
+ Dapp.ARRAKIS,
108
+ CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
109
+ MAX_AMOUNT
110
+ );
111
+ const gaugeAllowanceDelta = await allowanceDelta(
112
+ pool.address,
113
+ CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
114
+ routerAddress[network].arrakis!,
115
+ pool.signer
116
+ );
117
+ await expect(gaugeAllowanceDelta.gt(0));
118
+ });
119
+
120
+ it("should remove liquidity from an existing pool ", async () => {
121
+ await pool.decreaseLiquidity(
122
+ Dapp.ARRAKIS,
123
+ CONTRACT_ADDRESS[network].ARRAKIS_USDC_WETH_GAUGE,
124
+ 100
125
+ );
126
+ const wethBalanceDelta = await balanceDelta(
127
+ pool.address,
128
+ CONTRACT_ADDRESS[network].WETH,
129
+ pool.signer
130
+ );
131
+ expect(wethBalanceDelta.gt(0));
132
+ });
94
133
  });
134
+ };
135
+
136
+ testingHelper({
137
+ network: Network.POLYGON,
138
+ testingRun: testArrakis
95
139
  });
@@ -52,15 +52,27 @@ export const CONTRACT_ADDRESS = {
52
52
  WETH: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
53
53
  WBTC: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",
54
54
  ARRAKIS_USDC_WETH_GAUGE: "0x33d1ad9Cd88A509397CD924C2d7613C285602C20",
55
- ARRAKIS_USDC_WETH_LP: "0xa173340f1e942c2845bcbce8ebd411022e18eb13"
55
+ ARRAKIS_USDC_WETH_LP: "0xa173340f1e942c2845bcbce8ebd411022e18eb13",
56
+ WMATIC: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
57
+ uniswapV3: {
58
+ nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
59
+ }
56
60
  },
61
+
57
62
  [Network.OPTIMISM]: {
58
63
  USDC: "0x7F5c764cBc14f9669B88837ca1490cCa17c31607",
59
64
  SUSD: "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9",
60
65
  SWETH: "",
61
66
  WETH: "0x4200000000000000000000000000000000000006",
62
67
  WBTC: "0x68f180fcCe6836688e9084f035309E29Bf0A2095",
63
- KWENTA_ETH_PERP_V2: "0x2b3bb4c683bfc5239b029131eef3b1d214478d93"
68
+ KWENTA_ETH_PERP_V2: "0x2b3bb4c683bfc5239b029131eef3b1d214478d93",
69
+ uniswapV3: {
70
+ nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
71
+ },
72
+ WMATIC: "",
73
+ //
74
+ ARRAKIS_USDC_WETH_GAUGE: "",
75
+ ARRAKIS_USDC_WETH_LP: ""
64
76
  },
65
77
  [Network.ARBITRUM]: {
66
78
  USDC: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
@@ -69,13 +81,29 @@ export const CONTRACT_ADDRESS = {
69
81
  WBTC: "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
70
82
  WSTETH: "0x5979d7b546e38e414f7e9822514be443a4800529",
71
83
  BALANCER_WSTETH_WETH_POOL: "0x36bf227d6bac96e2ab1ebb5492ecec69c691943f",
72
- BALANCER_WSTETH_WETH_GAUGE: "0x251e51b25afa40f2b6b9f05aaf1bc7eaa0551771"
84
+ BALANCER_WSTETH_WETH_GAUGE: "0x251e51b25afa40f2b6b9f05aaf1bc7eaa0551771",
85
+
86
+ uniswapV3: {
87
+ nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
88
+ },
89
+
90
+ //
91
+ ARRAKIS_USDC_WETH_GAUGE: "",
92
+ ARRAKIS_USDC_WETH_LP: "",
93
+ WMATIC: ""
73
94
  },
74
95
  [Network.BASE]: {
75
96
  USDC: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
76
97
  WETH: "0x4200000000000000000000000000000000000006",
77
98
  WBTC: "",
78
- SWETH: ""
99
+ SWETH: "",
100
+ uniswapV3: {
101
+ nonfungiblePositionManager: ""
102
+ },
103
+ //
104
+ ARRAKIS_USDC_WETH_GAUGE: "",
105
+ ARRAKIS_USDC_WETH_LP: "",
106
+ WMATIC: ""
79
107
  }
80
108
  };
81
109