@dhedge/v2-sdk 1.11.0 → 1.11.1

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.
@@ -178,8 +178,8 @@ export declare class Pool {
178
178
  */
179
179
  lend(dapp: Dapp, asset: string, amount: BigNumber | string, referralCode?: number, options?: any, estimateGas?: boolean): Promise<any>;
180
180
  /**
181
- * Lend asset to a Compound V3 style lending pool
182
- * @param {string} market Address of market e.g cUSDCv3 address
181
+ * Lend asset to a Compound V3 or Fluid lending pool
182
+ * @param {string} market Address of cToken or fToken
183
183
  * @param {string} asset Asset
184
184
  * @param {BigNumber | string} amount Amount of asset to lend
185
185
  * @param {any} options Transaction options
@@ -198,8 +198,8 @@ export declare class Pool {
198
198
  */
199
199
  withdrawDeposit(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
200
200
  /**
201
- * Witdraw asset from a COmpound V3 style lending pool
202
- * @param {string} market Address of market e.g cUSDCv3 address
201
+ * Witdraw asset from a Compound V3 or Fluid lending pool
202
+ * @param {string} market Address of cToken or fToken
203
203
  * @param {string} asset Asset
204
204
  * @param {BigNumber | string} amount Amount of asset to withdraw
205
205
  * @param {any} options Transaction options
@@ -1,3 +1,4 @@
1
- import { ethers } from "../..";
2
- export declare function getCompoundV3LendTxData(asset: string, amount: ethers.BigNumber | string): string;
3
- export declare function getCompoundV3WithdrawTxData(asset: string, amount: ethers.BigNumber | string): string;
1
+ import { ethers, Pool } from "../..";
2
+ export declare function getCompoundV3LendTxData(pool: Pool, market: string, asset: string, amount: ethers.BigNumber | string): Promise<string>;
3
+ export declare function getCompoundV3WithdrawTxData(pool: Pool, market: string, asset: string, amount: ethers.BigNumber | string): Promise<string>;
4
+ export declare function isCompoundV3Market(pool: Pool, market: string): Promise<boolean>;
@@ -37,6 +37,7 @@ export declare const CONTRACT_ADDRESS: {
37
37
  VELODROME_CL_USDC_WETH_GAUGE: string;
38
38
  VELO: string;
39
39
  COMPOUNDV3_WETH: string;
40
+ FLUID_WETH: string;
40
41
  TOROS: string;
41
42
  UNIT: string;
42
43
  };
@@ -58,6 +59,7 @@ export declare const CONTRACT_ADDRESS: {
58
59
  VELODROME_CL_USDC_WETH_GAUGE: string;
59
60
  VELO: string;
60
61
  COMPOUNDV3_WETH: string;
62
+ FLUID_WETH: string;
61
63
  TOROS: string;
62
64
  };
63
65
  arbitrum: {
@@ -80,6 +82,7 @@ export declare const CONTRACT_ADDRESS: {
80
82
  VELODROME_CL_USDC_WETH_GAUGE: string;
81
83
  VELO: string;
82
84
  COMPOUNDV3_WETH: string;
85
+ FLUID_WETH: string;
83
86
  TOROS: string;
84
87
  };
85
88
  base: {
@@ -99,6 +102,7 @@ export declare const CONTRACT_ADDRESS: {
99
102
  VELODROME_CL_USDC_WETH_GAUGE: string;
100
103
  VELO: string;
101
104
  COMPOUNDV3_WETH: string;
105
+ FLUID_WETH: string;
102
106
  TOROS: string;
103
107
  };
104
108
  ethereum: {
@@ -117,6 +121,7 @@ export declare const CONTRACT_ADDRESS: {
117
121
  VELODROME_CL_USDC_WETH_GAUGE: string;
118
122
  VELO: string;
119
123
  COMPOUNDV3_WETH: string;
124
+ FLUID_WETH: string;
120
125
  TOROS: string;
121
126
  UNIT: string;
122
127
  };
@@ -10514,6 +10514,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10514
10514
  VELODROME_CL_USDC_WETH_GAUGE: "",
10515
10515
  VELO: "",
10516
10516
  COMPOUNDV3_WETH: "",
10517
+ FLUID_WETH: "",
10517
10518
  TOROS: "",
10518
10519
  UNIT: ""
10519
10520
  }, _CONTRACT_ADDRESS[exports.Network.OPTIMISM] = {
@@ -10535,6 +10536,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10535
10536
  VELODROME_CL_USDC_WETH_GAUGE: "0xa75127121d28a9BF848F3B70e7Eea26570aa7700",
10536
10537
  VELO: "0x9560e827aF36c94D2Ac33a39bCE1Fe78631088Db",
10537
10538
  COMPOUNDV3_WETH: "",
10539
+ FLUID_WETH: "",
10538
10540
  TOROS: "0x49bf093277bf4dde49c48c6aa55a3bda3eedef68" //USDmny
10539
10541
 
10540
10542
  }, _CONTRACT_ADDRESS[exports.Network.ARBITRUM] = {
@@ -10558,6 +10560,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10558
10560
  VELODROME_CL_USDC_WETH_GAUGE: "",
10559
10561
  VELO: "",
10560
10562
  COMPOUNDV3_WETH: "0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486",
10563
+ FLUID_WETH: "0x45df0656f8adf017590009d2f1898eeca4f0a205",
10561
10564
  TOROS: ""
10562
10565
  }, _CONTRACT_ADDRESS[exports.Network.BASE] = {
10563
10566
  USDC: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
@@ -10577,6 +10580,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10577
10580
  VELODROME_CL_USDC_WETH_GAUGE: "0xF33a96b5932D9E9B9A0eDA447AbD8C9d48d2e0c8",
10578
10581
  VELO: "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
10579
10582
  COMPOUNDV3_WETH: "",
10583
+ FLUID_WETH: "",
10580
10584
  TOROS: ""
10581
10585
  }, _CONTRACT_ADDRESS[exports.Network.ETHEREUM] = {
10582
10586
  USDC: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
@@ -10595,6 +10599,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10595
10599
  VELODROME_CL_USDC_WETH_GAUGE: "",
10596
10600
  VELO: "",
10597
10601
  COMPOUNDV3_WETH: "",
10602
+ FLUID_WETH: "",
10598
10603
  TOROS: "",
10599
10604
  UNIT: ""
10600
10605
  }, _CONTRACT_ADDRESS);
@@ -23908,11 +23913,162 @@ var ICompoundV3Comet = [
23908
23913
  }
23909
23914
  ];
23910
23915
 
23911
- function getCompoundV3LendTxData(asset, amount) {
23912
- return new ethers.ethers.utils.Interface(ICompoundV3Comet).encodeFunctionData("supply", [asset, amount]);
23916
+ var IFToken = [
23917
+ {
23918
+ inputs: [
23919
+ {
23920
+ internalType: "uint256",
23921
+ name: "assets_",
23922
+ type: "uint256"
23923
+ },
23924
+ {
23925
+ internalType: "address",
23926
+ name: "receiver_",
23927
+ type: "address"
23928
+ }
23929
+ ],
23930
+ name: "deposit",
23931
+ outputs: [
23932
+ {
23933
+ internalType: "uint256",
23934
+ name: "shares_",
23935
+ type: "uint256"
23936
+ }
23937
+ ],
23938
+ stateMutability: "nonpayable",
23939
+ type: "function"
23940
+ },
23941
+ {
23942
+ inputs: [
23943
+ {
23944
+ internalType: "uint256",
23945
+ name: "shares_",
23946
+ type: "uint256"
23947
+ },
23948
+ {
23949
+ internalType: "address",
23950
+ name: "receiver_",
23951
+ type: "address"
23952
+ },
23953
+ {
23954
+ internalType: "address",
23955
+ name: "owner_",
23956
+ type: "address"
23957
+ }
23958
+ ],
23959
+ name: "redeem",
23960
+ outputs: [
23961
+ {
23962
+ internalType: "uint256",
23963
+ name: "assets_",
23964
+ type: "uint256"
23965
+ }
23966
+ ],
23967
+ stateMutability: "nonpayable",
23968
+ type: "function"
23969
+ }
23970
+ ];
23971
+
23972
+ function getCompoundV3LendTxData(_x, _x2, _x3, _x4) {
23973
+ return _getCompoundV3LendTxData.apply(this, arguments);
23913
23974
  }
23914
- function getCompoundV3WithdrawTxData(asset, amount) {
23915
- return new ethers.ethers.utils.Interface(ICompoundV3Comet).encodeFunctionData("withdraw", [asset, amount]);
23975
+
23976
+ function _getCompoundV3LendTxData() {
23977
+ _getCompoundV3LendTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, market, asset, amount) {
23978
+ return runtime_1.wrap(function _callee$(_context) {
23979
+ while (1) {
23980
+ switch (_context.prev = _context.next) {
23981
+ case 0:
23982
+ _context.next = 2;
23983
+ return isCompoundV3Market(pool, market);
23984
+
23985
+ case 2:
23986
+ if (!_context.sent) {
23987
+ _context.next = 6;
23988
+ break;
23989
+ }
23990
+
23991
+ return _context.abrupt("return", new ethers.ethers.utils.Interface(ICompoundV3Comet).encodeFunctionData("supply", [asset, amount]));
23992
+
23993
+ case 6:
23994
+ return _context.abrupt("return", new ethers.ethers.utils.Interface(IFToken).encodeFunctionData("deposit", [amount, pool.address]));
23995
+
23996
+ case 7:
23997
+ case "end":
23998
+ return _context.stop();
23999
+ }
24000
+ }
24001
+ }, _callee);
24002
+ }));
24003
+ return _getCompoundV3LendTxData.apply(this, arguments);
24004
+ }
24005
+
24006
+ function getCompoundV3WithdrawTxData(_x5, _x6, _x7, _x8) {
24007
+ return _getCompoundV3WithdrawTxData.apply(this, arguments);
24008
+ }
24009
+
24010
+ function _getCompoundV3WithdrawTxData() {
24011
+ _getCompoundV3WithdrawTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, market, asset, amount) {
24012
+ return runtime_1.wrap(function _callee2$(_context2) {
24013
+ while (1) {
24014
+ switch (_context2.prev = _context2.next) {
24015
+ case 0:
24016
+ _context2.next = 2;
24017
+ return isCompoundV3Market(pool, market);
24018
+
24019
+ case 2:
24020
+ if (!_context2.sent) {
24021
+ _context2.next = 6;
24022
+ break;
24023
+ }
24024
+
24025
+ return _context2.abrupt("return", new ethers.ethers.utils.Interface(ICompoundV3Comet).encodeFunctionData("withdraw", [asset, amount]));
24026
+
24027
+ case 6:
24028
+ return _context2.abrupt("return", new ethers.ethers.utils.Interface(IFToken).encodeFunctionData("redeem", [amount, pool.address, pool.address]));
24029
+
24030
+ case 7:
24031
+ case "end":
24032
+ return _context2.stop();
24033
+ }
24034
+ }
24035
+ }, _callee2);
24036
+ }));
24037
+ return _getCompoundV3WithdrawTxData.apply(this, arguments);
24038
+ }
24039
+
24040
+ function isCompoundV3Market(_x9, _x10) {
24041
+ return _isCompoundV3Market.apply(this, arguments);
24042
+ }
24043
+
24044
+ function _isCompoundV3Market() {
24045
+ _isCompoundV3Market = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, market) {
24046
+ var marketContract;
24047
+ return runtime_1.wrap(function _callee3$(_context3) {
24048
+ while (1) {
24049
+ switch (_context3.prev = _context3.next) {
24050
+ case 0:
24051
+ marketContract = new ethers.ethers.Contract(market, ICompoundV3Comet, pool.signer);
24052
+ _context3.prev = 1;
24053
+ _context3.next = 4;
24054
+ return marketContract.baseToken();
24055
+
24056
+ case 4:
24057
+ return _context3.abrupt("return", true);
24058
+
24059
+ case 7:
24060
+ _context3.prev = 7;
24061
+ _context3.t0 = _context3["catch"](1);
24062
+ return _context3.abrupt("return", false);
24063
+
24064
+ case 10:
24065
+ case "end":
24066
+ return _context3.stop();
24067
+ }
24068
+ }
24069
+ }, _callee3, null, [[1, 7]]);
24070
+ }));
24071
+ return _isCompoundV3Market.apply(this, arguments);
23916
24072
  }
23917
24073
 
23918
24074
  var ICometRewards = [
@@ -25820,8 +25976,8 @@ var Pool = /*#__PURE__*/function () {
25820
25976
  return lend;
25821
25977
  }()
25822
25978
  /**
25823
- * Lend asset to a Compound V3 style lending pool
25824
- * @param {string} market Address of market e.g cUSDCv3 address
25979
+ * Lend asset to a Compound V3 or Fluid lending pool
25980
+ * @param {string} market Address of cToken or fToken
25825
25981
  * @param {string} asset Asset
25826
25982
  * @param {BigNumber | string} amount Amount of asset to lend
25827
25983
  * @param {any} options Transaction options
@@ -25847,15 +26003,19 @@ var Pool = /*#__PURE__*/function () {
25847
26003
  estimateGas = false;
25848
26004
  }
25849
26005
 
25850
- supplyTxData = getCompoundV3LendTxData(asset, amount);
25851
- _context18.next = 5;
26006
+ _context18.next = 4;
26007
+ return getCompoundV3LendTxData(this, market, asset, amount);
26008
+
26009
+ case 4:
26010
+ supplyTxData = _context18.sent;
26011
+ _context18.next = 7;
25852
26012
  return getPoolTxOrGasEstimate(this, [market, supplyTxData, options], estimateGas);
25853
26013
 
25854
- case 5:
26014
+ case 7:
25855
26015
  tx = _context18.sent;
25856
26016
  return _context18.abrupt("return", tx);
25857
26017
 
25858
- case 7:
26018
+ case 9:
25859
26019
  case "end":
25860
26020
  return _context18.stop();
25861
26021
  }
@@ -25921,8 +26081,8 @@ var Pool = /*#__PURE__*/function () {
25921
26081
  return withdrawDeposit;
25922
26082
  }()
25923
26083
  /**
25924
- * Witdraw asset from a COmpound V3 style lending pool
25925
- * @param {string} market Address of market e.g cUSDCv3 address
26084
+ * Witdraw asset from a Compound V3 or Fluid lending pool
26085
+ * @param {string} market Address of cToken or fToken
25926
26086
  * @param {string} asset Asset
25927
26087
  * @param {BigNumber | string} amount Amount of asset to withdraw
25928
26088
  * @param {any} options Transaction options
@@ -25948,15 +26108,19 @@ var Pool = /*#__PURE__*/function () {
25948
26108
  estimateGas = false;
25949
26109
  }
25950
26110
 
25951
- withdrawTxData = getCompoundV3WithdrawTxData(asset, amount);
25952
- _context20.next = 5;
26111
+ _context20.next = 4;
26112
+ return getCompoundV3WithdrawTxData(this, market, asset, amount);
26113
+
26114
+ case 4:
26115
+ withdrawTxData = _context20.sent;
26116
+ _context20.next = 7;
25953
26117
  return getPoolTxOrGasEstimate(this, [market, withdrawTxData, options], estimateGas);
25954
26118
 
25955
- case 5:
26119
+ case 7:
25956
26120
  tx = _context20.sent;
25957
26121
  return _context20.abrupt("return", tx);
25958
26122
 
25959
- case 7:
26123
+ case 9:
25960
26124
  case "end":
25961
26125
  return _context20.stop();
25962
26126
  }