@defisaver/sdk 1.0.15 → 1.0.17
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/esm/src/actions/bprotocol/BprotocolLiquitySPDepositAction.d.ts +20 -0
- package/esm/src/actions/bprotocol/BprotocolLiquitySPDepositAction.js +39 -0
- package/esm/src/actions/bprotocol/BprotocolLiquitySPWithdrawAction.d.ts +17 -0
- package/esm/src/actions/bprotocol/BprotocolLiquitySPWithdrawAction.js +24 -0
- package/esm/src/actions/bprotocol/index.d.ts +2 -0
- package/esm/src/actions/bprotocol/index.js +2 -0
- package/esm/src/actions/checkers/LiquityRatioCheckAction.d.ts +14 -0
- package/esm/src/actions/checkers/LiquityRatioCheckAction.js +20 -0
- package/esm/src/actions/checkers/index.d.ts +1 -0
- package/esm/src/actions/checkers/index.js +1 -0
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/liquity/LiquityAdjustAction.js +2 -1
- package/esm/src/actions/maker/MakerDsrDepositAction.d.ts +18 -0
- package/esm/src/actions/maker/MakerDsrDepositAction.js +31 -0
- package/esm/src/actions/maker/MakerDsrWithdrawAction.d.ts +15 -0
- package/esm/src/actions/maker/MakerDsrWithdrawAction.js +30 -0
- package/esm/src/actions/maker/index.d.ts +2 -0
- package/esm/src/actions/maker/index.js +2 -0
- package/esm/src/addresses.d.ts +18 -0
- package/esm/src/addresses.js +9 -2
- package/esm/src/index.d.ts +72 -0
- package/esm/src/utils/convex-utils.d.ts +10 -0
- package/esm/src/utils/convexPoolInfo.json +18 -0
- package/esm/src/utils/curvePoolInfo.json +96 -0
- package/esm/src/utils/index.d.ts +2 -1
- package/esm/src/utils/index.js +2 -1
- package/package-lock.json +21474 -0
- package/package.json +2 -2
- package/src/actions/bprotocol/BprotocolLiquitySPDepositAction.ts +32 -0
- package/src/actions/bprotocol/BprotocolLiquitySPWithdrawAction.ts +27 -0
- package/src/actions/bprotocol/index.ts +2 -0
- package/src/actions/checkers/LiquityRatioCheckAction.ts +23 -0
- package/src/actions/checkers/index.ts +1 -0
- package/src/actions/index.ts +2 -0
- package/src/actions/liquity/LiquityAdjustAction.ts +2 -1
- package/src/actions/maker/MakerDsrDepositAction.ts +23 -0
- package/src/actions/maker/MakerDsrWithdrawAction.ts +22 -0
- package/src/actions/maker/index.ts +2 -0
- package/src/addresses.ts +8 -0
- package/umd/index.js +616 -399
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./umd/index.js",
|
|
6
6
|
"module": "./esm/src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@defisaver/eslint-config": "^1.0.0",
|
|
23
|
-
"@defisaver/tokens": "^1.4.
|
|
23
|
+
"@defisaver/tokens": "^1.4.36",
|
|
24
24
|
"@ethersproject/address": "^5.0.10",
|
|
25
25
|
"@ethersproject/solidity": "^5.0.9",
|
|
26
26
|
"@types/web3-eth-abi": "^1.2.2",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* BprotocolLiquitySPDeposit - Action that deposits LUSD into Bprotocol
|
|
8
|
+
* @dev LQTY rewards accrue over time and are paid out each time the user interacts with the protocol
|
|
9
|
+
* @dev Deposit amount must be greater than zero, for LQTY only claim use BprotocolLiquitySPWithdraw
|
|
10
|
+
* @category Bprotocol
|
|
11
|
+
*/
|
|
12
|
+
export class BprotocolLiquitySPDepositAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param lusdAmount Amount of LUSD to deposit into Bprotocol
|
|
15
|
+
* @param from Address from where the LUSD is being pulled
|
|
16
|
+
* @param lqtyTo Address that will recieve LQTY rewards
|
|
17
|
+
*/
|
|
18
|
+
constructor(lusdAmount:uint256, from:EthAddress, lqtyTo:EthAddress) {
|
|
19
|
+
super('BprotocolLiquitySPDeposit', getAddr('BprotocolLiquitySPDeposit'), ['uint256', 'address', 'address'], [lusdAmount, from, lqtyTo]);
|
|
20
|
+
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0],
|
|
23
|
+
this.args[1],
|
|
24
|
+
this.args[2],
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async getAssetsToApprove() {
|
|
29
|
+
const asset = getAssetInfo('LUSD').address;
|
|
30
|
+
return [{ asset, owner: this.args[1] }];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* BprotocolLiquitySPWithdraw - Action that withdraws LUSD from Bprotocol
|
|
7
|
+
* @dev LQTY rewards accrue over time and are paid out each time the user interacts with the protocol
|
|
8
|
+
* @dev Idealy the WETH returned amount will be zero (shares paid out in LUSD in full) but depends on the protocol usage
|
|
9
|
+
* @dev Withdraw amount can be set to zero, only LQTY reward will be claimed
|
|
10
|
+
* @category Bprotocol
|
|
11
|
+
*/
|
|
12
|
+
export class BprotocolLiquitySPWithdrawAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param shareAmount Amount of shares to burn
|
|
15
|
+
* @param to Address that will recieve the LUSD and WETH withdrawn
|
|
16
|
+
* @param lqtyTo Address that will recieve LQTY rewards
|
|
17
|
+
*/
|
|
18
|
+
constructor(shareAmount:uint256, to:EthAddress, lqtyTo: EthAddress) {
|
|
19
|
+
super('BprotocolLiquitySPWithdraw', getAddr('BprotocolLiquitySPWithdraw'), ['uint256', 'address', 'address'], [shareAmount, to, lqtyTo]);
|
|
20
|
+
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0],
|
|
23
|
+
this.args[1],
|
|
24
|
+
this.args[2],
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { uint8, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiquityRatioCheckAction - Checks liquity ratio for user position and reverts if faulty
|
|
7
|
+
*
|
|
8
|
+
* @category Checkers
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityRatioCheckAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param ratioState If it should lower/higher
|
|
13
|
+
* @param targetRatio The ratio user want to be at
|
|
14
|
+
*/
|
|
15
|
+
constructor(ratioState:uint8, targetRatio:uint256) {
|
|
16
|
+
super('LiquityRatioCheck', getAddr('LiquityRatioCheck'), ['uint8', 'uint256'], [ratioState, targetRatio]);
|
|
17
|
+
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[0],
|
|
20
|
+
this.args[1],
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/actions/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ import * as convex from './convex';
|
|
|
22
22
|
import * as chickenBonds from './chickenBonds';
|
|
23
23
|
import * as compoundV3 from './compoundV3';
|
|
24
24
|
import * as morpho from './morpho';
|
|
25
|
+
import * as bprotocol from './bprotocol';
|
|
25
26
|
|
|
26
27
|
export {
|
|
27
28
|
aave,
|
|
@@ -48,4 +49,5 @@ export {
|
|
|
48
49
|
chickenBonds,
|
|
49
50
|
compoundV3,
|
|
50
51
|
morpho,
|
|
52
|
+
bprotocol,
|
|
51
53
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { uint256, EthAddress } from '../../types';
|
|
4
|
+
import { getAddr } from '../../addresses';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* MakerDsrDepositAction - Supply DAI to Maker DSR
|
|
8
|
+
*
|
|
9
|
+
* @category Maker
|
|
10
|
+
*/
|
|
11
|
+
export class MakerDsrDepositAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param amount Amount of DAI to deposit
|
|
14
|
+
* @param from Tokens will be supplied from this address
|
|
15
|
+
*/
|
|
16
|
+
constructor(amount:uint256, from:EthAddress) {
|
|
17
|
+
super('McdDsrDeposit', getAddr('McdDsrDeposit'), ['uint256', 'address'], [amount, from]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async getAssetsToApprove() {
|
|
21
|
+
return [{ asset: getAssetInfo('DAI').address, owner: this.args[1] }];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint256, EthAddress } from '../../types';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MakerDsrWithdrawAction - Withdraw DAI from Maker DSR
|
|
7
|
+
*
|
|
8
|
+
* @category Maker
|
|
9
|
+
*/
|
|
10
|
+
export class MakerDsrWithdrawAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param amount Amount of DAI to withdraw
|
|
13
|
+
* @param to Tokens will be withdrawn to this address
|
|
14
|
+
*/
|
|
15
|
+
constructor(amount:uint256, to:EthAddress) {
|
|
16
|
+
super('McdDsrWithdraw', getAddr('McdDsrWithdraw'), ['uint256', 'address'], [amount, to]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async getAssetsToApprove() {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/addresses.ts
CHANGED
|
@@ -30,6 +30,8 @@ export const actionAddresses = {
|
|
|
30
30
|
McdSupply: '0x84372e73e1A2E95510869D2D81A3ef1AEC9e0Da8',
|
|
31
31
|
McdWithdraw: '0xa704FBBe2f7ea8eF45a8280f6Bf96939eBC73252',
|
|
32
32
|
McdClaim: '0xc0FC0f5Ba156E16217F8C7f400AEc0a658419C13',
|
|
33
|
+
McdDsrDeposit: '0x64bde7F73e05c6a28b701D7f569f0c0Ae4f6aD33',
|
|
34
|
+
McdDsrWithdraw: '0x96190d1f1c040fd8449250b90778Aa360f2e0Ec1',
|
|
33
35
|
|
|
34
36
|
// reflexer
|
|
35
37
|
ReflexerSupply: '0xd7a36CD4ce7CCc2F1376Dc5C48BaC84380A4f698',
|
|
@@ -119,6 +121,11 @@ export const actionAddresses = {
|
|
|
119
121
|
LiquityEthGainToTrove: '0x65e19f967B3F3cB6466110aD238039F5423E3177',
|
|
120
122
|
LiquityClaim: '0x526735aDcBe5c9059275c5ED2E0574b4a24b875e',
|
|
121
123
|
LiquityRedeem: '0x20B78854658011394C931EF2BF3cEEA2Fe62E7f0',
|
|
124
|
+
LiquityAdjust: '0x0A398f6B97677192A5d5e7Ea8A937383FFf9304c',
|
|
125
|
+
|
|
126
|
+
// b.protocol
|
|
127
|
+
BprotocolLiquitySPDeposit: '0x5A0436c7559e37da8cD24B0f66C155a0a2fd6309',
|
|
128
|
+
BprotocolLiquitySPWithdraw: '0x20Ece7CB4463bB1DbA4C4fA800E321A05dfB028B',
|
|
122
129
|
|
|
123
130
|
// lido
|
|
124
131
|
LidoStake: '0x4a7dd38D2BcA817fb68165155F869ca4179d8060',
|
|
@@ -165,6 +172,7 @@ export const actionAddresses = {
|
|
|
165
172
|
TrailingStopTrigger: '0x0000000000000000000000000000000000000000',
|
|
166
173
|
CBRebondTrigger: '0x6Bb48580977e2aBfD6c70B522204EFbe828a9428',
|
|
167
174
|
CBUpdateRebondSub: '0x2709Fd59a27F35997dFf618E3C68ABA1c9e91465',
|
|
175
|
+
LiquityRatioCheck: '0x4AE38243936FAcb0f42993D676b7df1Bb31082d9',
|
|
168
176
|
|
|
169
177
|
// Convex
|
|
170
178
|
ConvexDeposit: '0x3Ecc4F1FD5aA09D2E13Ec9ebFdF102063d66F458',
|