@defisaver/sdk 0.3.25 → 0.3.26
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 +1 -1
- package/src/actions/basic/TransferNFTAction.js +20 -0
- package/src/actions/basic/index.js +2 -0
- package/src/actions/chickenBonds/CBChickenInAction.js +19 -0
- package/src/actions/chickenBonds/CBChickenOutAction.js +20 -0
- package/src/actions/chickenBonds/CBCreateAction.js +23 -0
- package/src/actions/chickenBonds/CBRedeemAction.js +27 -0
- package/src/actions/chickenBonds/index.js +11 -0
- package/src/actions/index.js +2 -0
- package/src/addresses.js +8 -0
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const Action = require("../../Action");
|
|
2
|
+
const { getAddr } = require('../../addresses.js');
|
|
3
|
+
|
|
4
|
+
class TransferNFTAction extends Action {
|
|
5
|
+
constructor(nftAddr, from, to, nftId) {
|
|
6
|
+
super(
|
|
7
|
+
'TransferNFT',
|
|
8
|
+
getAddr('TransferNFT'),
|
|
9
|
+
[
|
|
10
|
+
"address",
|
|
11
|
+
"address",
|
|
12
|
+
"address",
|
|
13
|
+
"uint256"
|
|
14
|
+
],
|
|
15
|
+
[...arguments]
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = TransferNFTAction;
|
|
@@ -13,6 +13,7 @@ const GasFeeAction = require('./GasFeeAction');
|
|
|
13
13
|
const UpdateSubAction = require('./UpdateSubAction');
|
|
14
14
|
const ToggleSubAction = require('./ToggleSubAction');
|
|
15
15
|
const GasFeeActionL2 = require('./GasFeeActionL2');
|
|
16
|
+
const TransferNFTAction = require('./TransferNFTAction');
|
|
16
17
|
|
|
17
18
|
module.exports = {
|
|
18
19
|
SellAction,
|
|
@@ -30,4 +31,5 @@ module.exports = {
|
|
|
30
31
|
SendTokenAndUnwrapAction,
|
|
31
32
|
ToggleSubAction,
|
|
32
33
|
GasFeeActionL2,
|
|
34
|
+
TransferNFTAction,
|
|
33
35
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const Action = require("../../Action");
|
|
2
|
+
const { requireAddress } = require("../../utils/general");
|
|
3
|
+
const { getAddr } = require('../../addresses.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CBCreateAction - Chickens in the pending bond
|
|
7
|
+
*/
|
|
8
|
+
class CBChickenInAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param bondID {string} Nft id of the bond
|
|
11
|
+
* @param to {EthAddress}
|
|
12
|
+
*/
|
|
13
|
+
constructor(bondId, to) {
|
|
14
|
+
requireAddress(to);
|
|
15
|
+
super('CBChickenIn', getAddr('CBChickenIn'), ['uint256','address'], [...arguments]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = CBChickenInAction;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const Action = require("../../Action");
|
|
2
|
+
const { requireAddress } = require("../../utils/general");
|
|
3
|
+
const { getAddr } = require('../../addresses.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CBChickenOutAction - Chickens out the pending bond
|
|
7
|
+
*/
|
|
8
|
+
class CBChickenOutAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param bondID {string} Nft id of the bond
|
|
11
|
+
* @param minLUSD {string} Min amount of lusd to receive
|
|
12
|
+
* @param to {EthAddress}
|
|
13
|
+
*/
|
|
14
|
+
constructor(bondId, minLUSD, to) {
|
|
15
|
+
requireAddress(to);
|
|
16
|
+
super('CBChickenOut', getAddr('CBChickenOut'), ['uint256','uint256','address'], [...arguments]);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = CBChickenOutAction;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const Action = require("../../Action");
|
|
2
|
+
const { requireAddress } = require("../../utils/general");
|
|
3
|
+
const { getAddr } = require('../../addresses.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CBCreateAction - Create a chicken bond nft
|
|
7
|
+
*/
|
|
8
|
+
class CBCreateAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param amount {string} Wei amount in LUSD
|
|
11
|
+
* @param from {EthAddress}
|
|
12
|
+
*/
|
|
13
|
+
constructor(amount, from) {
|
|
14
|
+
requireAddress(from);
|
|
15
|
+
super('CBCreate', getAddr('CBCreate'), ['uint256','address'], [...arguments]);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async getAssetsToApprove() {
|
|
19
|
+
return [{asset: getAddr('LUSD'), owner: this.args[1]}]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = CBCreateAction;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const Action = require("../../Action");
|
|
2
|
+
const { requireAddress } = require("../../utils/general");
|
|
3
|
+
const { getAddr } = require('../../addresses.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CBRedeemAction - Redeems bLUSD for Lusd (might also get yTokens)
|
|
7
|
+
*/
|
|
8
|
+
class CBRedeemAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param bLUSDAmount {string} Amount of bLUSD
|
|
11
|
+
* @param minLUSDFromSP {string} Min amount of lusd to receive
|
|
12
|
+
* @param from {EthAddress}
|
|
13
|
+
* @param to {EthAddress}
|
|
14
|
+
*/
|
|
15
|
+
constructor(bLUSDAmount, minLUSDFromSP, from, to) {
|
|
16
|
+
requireAddress(from);
|
|
17
|
+
requireAddress(to);
|
|
18
|
+
super('CBRedeem', getAddr('CBRedeem'), ['uint256','uint256','address','address'], [...arguments]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async getAssetsToApprove() {
|
|
22
|
+
return [{asset: getAddr('BLUSD'), owner: this.args[2]}]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = CBRedeemAction;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const CBCreateAction = require('./CBCreateAction');
|
|
2
|
+
const CBChickenInAction = require('./CBChickenInAction');
|
|
3
|
+
const CBChickenOutAction = require('./CBChickenOutAction');
|
|
4
|
+
const CBRedeemAction = require('./CBRedeemAction');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
CBCreateAction,
|
|
8
|
+
CBChickenInAction,
|
|
9
|
+
CBChickenOutAction,
|
|
10
|
+
CBRedeemAction,
|
|
11
|
+
};
|
package/src/actions/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const mstable = require('./mstable');
|
|
|
19
19
|
const rari = require('./rari');
|
|
20
20
|
const aaveV3 = require('./aaveV3');
|
|
21
21
|
const convex = require('./convex');
|
|
22
|
+
const chickenBonds = require('./chickenBonds');
|
|
22
23
|
const compoundV3 = require('./compoundV3');
|
|
23
24
|
|
|
24
25
|
module.exports = {
|
|
@@ -43,5 +44,6 @@ module.exports = {
|
|
|
43
44
|
rari,
|
|
44
45
|
aaveV3,
|
|
45
46
|
convex,
|
|
47
|
+
chickenBonds,
|
|
46
48
|
compoundV3,
|
|
47
49
|
};
|
package/src/addresses.js
CHANGED
|
@@ -15,6 +15,7 @@ const actionAddresses = {
|
|
|
15
15
|
SendTokenAndUnwrap: '0xeecd376026335261c89faD40D89625391b1eFF6a',
|
|
16
16
|
ToggleSub: '0x9A78E9d6538cfDbA0242Ca5eC46771E6132E8085',
|
|
17
17
|
UpdateSub: '0x94D707f411B852082a5ce49C3f47c49c7757761f',
|
|
18
|
+
TransferNFT: '0x861e893E1796F81248e75F06C0b09Abdc8fe2f6F',
|
|
18
19
|
|
|
19
20
|
// exchange
|
|
20
21
|
DFSSell: '0xB744474Bdd7226736ACa4Ba87593e32d8315e5c9',
|
|
@@ -142,6 +143,11 @@ const actionAddresses = {
|
|
|
142
143
|
ConvexWithdraw: '0x2B2c235F9e27A121947c34A39d447bD4C585aA15',
|
|
143
144
|
ConvexClaim: '0xA012afAA97B48894b8FCB2ECC007045Be7a8E8B6',
|
|
144
145
|
|
|
146
|
+
// Chicken Bonds
|
|
147
|
+
CBCreate: '0xAB38eCb27aBc1d75cb83725a4c408C22F426A1c1',
|
|
148
|
+
CBRedeem: '0xdD06754cA5367B03af7014AB359332eD82D988d1',
|
|
149
|
+
CBChickenIn: '0x1E990AF6dCf9E9f8a0b2fc76f3BC032A34fFfD14',
|
|
150
|
+
CBChickenOut: '0x3d2f2d88749BB387abD07A2408b68D2Bf2D4be3f',
|
|
145
151
|
// CompV3
|
|
146
152
|
CompV3Allow: '0xC4a80f22bf56E0dFa2CB378561B934F41E14bc9f',
|
|
147
153
|
CompV3Borrow: '0xAb01C815063178C3021a516ecaf56915fD0E6534',
|
|
@@ -244,6 +250,8 @@ const otherAddresses = {
|
|
|
244
250
|
CrvToken: '0xD533a949740bb3306d119CC777fa900bA034cd52',
|
|
245
251
|
CvxToken: '0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B',
|
|
246
252
|
DAI: '0x6b175474e89094c44da98b954eedeac495271d0f',
|
|
253
|
+
LUSD: '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0',
|
|
254
|
+
BLUSD: '0x76F7774139bf0097d2882C41AF5A37717e3641A7',
|
|
247
255
|
Empty: '0x0000000000000000000000000000000000000000',
|
|
248
256
|
},
|
|
249
257
|
[NETWORKS.optimism.chainId]: {
|