@defisaver/sdk 0.3.28 → 0.4.0

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": "@defisaver/sdk",
3
- "version": "0.3.28",
3
+ "version": "0.4.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,21 +2,23 @@ const Action = require("../../Action");
2
2
  const {getAddr} = require("../../addresses.js");
3
3
 
4
4
  /**
5
- * CompoundV3RatioCheckAction - Checks comp V3 ratio for users proxy position and reverts if faulty
5
+ * CompoundV3RatioCheckAction - Checks comp V3 ratio for user position and reverts if faulty
6
6
  */
7
7
  class CompoundV3RatioCheckAction extends Action {
8
8
  /**
9
9
  * @param ratioState {uint8} If it should lower/higher
10
10
  * @param targetRatio {string} The ratio user want to be at
11
11
  * @param market {address} Address of compV3 market
12
+ * @param user {address} Address of the user we are checking the ratio for (default to proxy)
12
13
  */
13
- constructor(ratioState, targetRatio, market) {
14
- super("CompV3RatioCheck", getAddr("CompV3RatioCheck"), ["uint8","uint256","address"], [ratioState, targetRatio, market]);
14
+ constructor(ratioState, targetRatio, market, user) {
15
+ super("CompV3RatioCheck", getAddr("CompV3RatioCheck"), ["uint8","uint256","address","address"], [ratioState, targetRatio, market, user]);
15
16
 
16
17
  this.mappableArgs = [
17
18
  this.args[0],
18
19
  this.args[1],
19
- this.args[2]
20
+ this.args[2],
21
+ this.args[3]
20
22
  ];
21
23
  }
22
24
 
@@ -8,17 +8,19 @@ const { getAddr } = require('../../addresses.js');
8
8
  class CompoundV3BorrowAction extends Action {
9
9
  /**
10
10
  * @param market {EthAddress} Comet proxy address of the market
11
- * @param amount {string} Wei amount in underlying asset decimals (not cAsset) - ie. 18 dec for cETH, not 8
12
- * @param to {EthAddress}
11
+ * @param amount {string} Wei amount in underlying asset decimals
12
+ * @param to {EthAddress} Address where we send the borrowed tokens
13
+ * @param onBehalf {EthAddress} Address from which we are borrowing the tokens
13
14
  */
14
- constructor(market, amount, to) {
15
+ constructor(market, amount, to, onBehalf) {
15
16
  requireAddress(to);
16
- super('CompV3Borrow', getAddr('CompV3Borrow'), ['address','uint256','address'], [...arguments]);
17
+ super('CompV3Borrow', getAddr('CompV3Borrow'), ['address','uint256','address','address'], [...arguments]);
17
18
 
18
19
  this.mappableArgs = [
19
20
  this.args[0],
20
21
  this.args[1],
21
22
  this.args[2],
23
+ this.args[3],
22
24
  ];
23
25
  }
24
26
  }
@@ -11,16 +11,18 @@ const {getAssetInfoByAddress} = require("@defisaver/tokens");
11
11
  * @param market {EthAddress} Comet proxy address of the market
12
12
  * @param tokenAddr {EthAddress}
13
13
  * @param amount {uint256} wei amount of asset to supply
14
- * @param from {EthAddress}
14
+ * @param from {EthAddress} Address from where we're pulling the tokens
15
+ * @param onBehalf {EthAddress} Address of the account we are supplying the tokens
15
16
  */
16
- constructor(market, tokenAddr, amount, from,) {
17
- super('CompV3Supply', getAddr('CompV3Supply'), ['address','address','uint256','address'], [market, tokenAddr, amount, from]);
17
+ constructor(market, tokenAddr, amount, from, onBehalf) {
18
+ super('CompV3Supply', getAddr('CompV3Supply'), ['address','address','uint256','address', 'address'], [market, tokenAddr, amount, from, onBehalf]);
18
19
 
19
20
  this.mappableArgs = [
20
21
  this.args[0],
21
22
  this.args[1],
22
23
  this.args[2],
23
- this.args[3]
24
+ this.args[3],
25
+ this.args[4]
24
26
  ];
25
27
  this.tokenForApproval = tokenAddr;
26
28
  }
@@ -8,17 +8,18 @@ const { getAddr } = require("../../addresses.js");
8
8
  class CompoundV3WithdrawAction extends Action {
9
9
  /**
10
10
  * @param market {EthAddress} Comet proxy address of the market
11
- * @param to {EthAddress} Address of the recipient
11
+ * @param to {EthAddress} Address where we are sending the tokens
12
12
  * @param asset {EthAddress} Address of asset to withdraw
13
13
  * @param amount {string} Wei amount in specified asset
14
+ * @param onBehalf {EthAddress} Address from where we are withdrawing the tokens
14
15
  */
15
- constructor(market, to, asset, amount) {
16
+ constructor(market, to, asset, amount, onBehalf) {
16
17
  requireAddress(to);
17
18
  requireAddress(asset);
18
19
  super(
19
20
  "CompV3Withdraw",
20
21
  getAddr("CompV3Withdraw"),
21
- ["address","address", "address", "uint256"],
22
+ ["address","address", "address","uint256","address"],
22
23
  [...arguments]
23
24
  );
24
25
 
@@ -27,6 +28,7 @@ class CompoundV3WithdrawAction extends Action {
27
28
  this.args[1],
28
29
  this.args[2],
29
30
  this.args[3],
31
+ this.args[4],
30
32
  ];
31
33
  }
32
34
  }
package/src/addresses.js CHANGED
@@ -150,12 +150,12 @@ const actionAddresses = {
150
150
  CBChickenOut: '0x3d2f2d88749BB387abD07A2408b68D2Bf2D4be3f',
151
151
  // CompV3
152
152
  CompV3Allow: '0xC4a80f22bf56E0dFa2CB378561B934F41E14bc9f',
153
- CompV3Borrow: '0xAb01C815063178C3021a516ecaf56915fD0E6534',
153
+ CompV3Borrow: '0x11e7b984299a771C92CD42A87358a32791A75CEA',
154
154
  CompV3Claim: '0x4CEa369B63daAc0dA3423c5038a57483c5150986',
155
155
  CompV3Payback: '0x6d14b9d69aADcb0d31a3e5d89fba75AB053fc9f0',
156
- CompV3Supply: '0xAB53342d922Cc52b33486B92dC5dc361b7E4B436',
156
+ CompV3Supply: '0xaF36Eca43bb26468078B8163fe5Bc1fCFc292095',
157
157
  CompV3Transfer: '0xeD7450e9C17146476137b77198DFfB17857906c4',
158
- CompV3Withdraw: '0x59fED9975cd3bb07bB75490e86751D6025ce0bC2',
158
+ CompV3Withdraw: '0x0b0F21EDE32DE4243D9145a899E97FC2366Aec46',
159
159
  },
160
160
  [NETWORKS.optimism.chainId]: {
161
161
  DFSSell: '0xBA0f6039b95CC0A02B5fc983eCf0FC4437BaacC7',