@defisaver/sdk 1.0.66-dev-4 → 1.0.67-dev-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.
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/llamalend/LlamaLendBorrowAction.d.ts +15 -0
- package/esm/src/actions/llamalend/LlamaLendBorrowAction.js +22 -0
- package/esm/src/actions/llamalend/LlamaLendCreateAction.d.ts +22 -0
- package/esm/src/actions/llamalend/LlamaLendCreateAction.js +44 -0
- package/esm/src/actions/llamalend/LlamaLendPaybackAction.d.ts +22 -0
- package/esm/src/actions/llamalend/LlamaLendPaybackAction.js +43 -0
- package/esm/src/actions/llamalend/LlamaLendSelfLiquidateAction.d.ts +19 -0
- package/esm/src/actions/llamalend/LlamaLendSelfLiquidateAction.js +38 -0
- package/esm/src/actions/llamalend/LlamaLendSupplyAction.d.ts +20 -0
- package/esm/src/actions/llamalend/LlamaLendSupplyAction.js +40 -0
- package/esm/src/actions/llamalend/LlamaLendWithdrawAction.d.ts +15 -0
- package/esm/src/actions/llamalend/LlamaLendWithdrawAction.js +22 -0
- package/esm/src/actions/llamalend/index.d.ts +6 -0
- package/esm/src/actions/llamalend/index.js +6 -0
- package/esm/src/addresses.d.ts +24 -0
- package/esm/src/addresses.js +7 -0
- package/esm/src/index.d.ts +96 -0
- package/esm/src/utils/index.d.ts +2 -1
- package/esm/src/utils/index.js +2 -1
- package/esm/src/utils/llamalend-utils.d.ts +10 -0
- package/esm/src/utils/llamalend-utils.js +10 -0
- package/package.json +1 -1
- package/src/actions/index.ts +2 -0
- package/src/actions/llamalend/LlamaLendBorrowAction.ts +34 -0
- package/src/actions/llamalend/LlamaLendCreateAction.ts +49 -0
- package/src/actions/llamalend/LlamaLendPaybackAction.ts +48 -0
- package/src/actions/llamalend/LlamaLendSelfLiquidateAction.ts +41 -0
- package/src/actions/llamalend/LlamaLendSupplyAction.ts +44 -0
- package/src/actions/llamalend/LlamaLendWithdrawAction.ts +34 -0
- package/src/actions/llamalend/index.ts +6 -0
- package/src/addresses.ts +8 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/llamalend-utils.ts +11 -0
- package/umd/index.js +363 -56
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const controllerToCollateralAssetMap: {
|
|
2
|
+
'0x5E657c5227A596a860621C5551c9735d8f4A8BE3': string;
|
|
3
|
+
'0x7443944962D04720f8c220C0D25f56F869d6EfD4': string;
|
|
4
|
+
'0x43fc0f246F952ff12B757341A91cF4040711dDE9': string;
|
|
5
|
+
};
|
|
6
|
+
export declare const controllerToDebtAssetMap: {
|
|
7
|
+
'0x5E657c5227A596a860621C5551c9735d8f4A8BE3': string;
|
|
8
|
+
'0x7443944962D04720f8c220C0D25f56F869d6EfD4': string;
|
|
9
|
+
'0x43fc0f246F952ff12B757341A91cF4040711dDE9': string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const controllerToCollateralAssetMap = {
|
|
2
|
+
'0x5E657c5227A596a860621C5551c9735d8f4A8BE3': '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
3
|
+
'0x7443944962D04720f8c220C0D25f56F869d6EfD4': '0xD533a949740bb3306d119CC777fa900bA034cd52',
|
|
4
|
+
'0x43fc0f246F952ff12B757341A91cF4040711dDE9': '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
5
|
+
};
|
|
6
|
+
export const controllerToDebtAssetMap = {
|
|
7
|
+
'0x5E657c5227A596a860621C5551c9735d8f4A8BE3': '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
8
|
+
'0x7443944962D04720f8c220C0D25f56F869d6EfD4': '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
9
|
+
'0x43fc0f246F952ff12B757341A91cF4040711dDE9': '0xD533a949740bb3306d119CC777fa900bA034cd52',
|
|
10
|
+
};
|
package/package.json
CHANGED
package/src/actions/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ import * as lsv from './lsv';
|
|
|
27
27
|
import * as curveusd from './curveusd';
|
|
28
28
|
import * as spark from './spark';
|
|
29
29
|
import * as morphoblue from './morpho-blue';
|
|
30
|
+
import * as llamalend from './llamalend';
|
|
30
31
|
|
|
31
32
|
export {
|
|
32
33
|
aave,
|
|
@@ -58,4 +59,5 @@ export {
|
|
|
58
59
|
spark,
|
|
59
60
|
curveusd,
|
|
60
61
|
morphoblue,
|
|
62
|
+
llamalend,
|
|
61
63
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LlamaLendBorrowAction - Action that borrows debt asset from proxy llamalend position
|
|
7
|
+
*
|
|
8
|
+
* @category LlamaLend
|
|
9
|
+
*/
|
|
10
|
+
export class LlamaLendBorrowAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* address controllerAddress - Address of the llamalend market controller
|
|
13
|
+
* address to - Address that will receive the borrowed debt asset, will default to proxy
|
|
14
|
+
* uint256 debtAmount - Amount of debt asset to borrow
|
|
15
|
+
*/
|
|
16
|
+
/// @dev debtAmount must be non-zero
|
|
17
|
+
/// @dev if debtAmount == uintMax will borrow as much as the collateral will support
|
|
18
|
+
constructor(
|
|
19
|
+
controllerAddress: EthAddress,
|
|
20
|
+
to: EthAddress,
|
|
21
|
+
debtAmount: uint256,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'LlamaLendBorrow',
|
|
25
|
+
getAddr('LlamaLendBorrow'),
|
|
26
|
+
['address', 'address', 'uint256'],
|
|
27
|
+
[controllerAddress, to, debtAmount],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
this.mappableArgs = [
|
|
31
|
+
...this.args,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
import { controllerToCollateralAssetMap } from '../../utils/llamalend-utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* LlamaLendCreateAction - Action that creates a llamalend position on behalf of proxy
|
|
9
|
+
*
|
|
10
|
+
* @category LlamaLend
|
|
11
|
+
*/
|
|
12
|
+
export class LlamaLendCreateAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* address controllerAddress - Address of the llamalend market controller
|
|
15
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
16
|
+
* address to - Address that will receive the borrowed debt asset, will default to proxy
|
|
17
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
18
|
+
* uint256 debtAmount - Amount of debt asset to borrow
|
|
19
|
+
* uint256 nBands - Number of bands in which the collateral will be supplied
|
|
20
|
+
*/
|
|
21
|
+
/// @dev both collateralAmount and debtAmount must be non-zero and can be maxUint
|
|
22
|
+
constructor(
|
|
23
|
+
controllerAddress: EthAddress,
|
|
24
|
+
from: EthAddress,
|
|
25
|
+
to: EthAddress,
|
|
26
|
+
collateralAmount: uint256,
|
|
27
|
+
debtAmount: uint256,
|
|
28
|
+
nBands: uint256,
|
|
29
|
+
) {
|
|
30
|
+
requireAddress(to);
|
|
31
|
+
super(
|
|
32
|
+
'LlamaLendCreate',
|
|
33
|
+
getAddr('LlamaLendCreate'),
|
|
34
|
+
['address', 'address', 'address', 'uint256', 'uint256', 'uint256'],
|
|
35
|
+
[controllerAddress, from, to, collateralAmount, debtAmount, nBands],
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
this.mappableArgs = [
|
|
39
|
+
...this.args,
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async getAssetsToApprove() {
|
|
44
|
+
return [{
|
|
45
|
+
owner: this.args[1],
|
|
46
|
+
asset: controllerToCollateralAssetMap[this.args[0] as keyof typeof controllerToCollateralAssetMap],
|
|
47
|
+
}];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256, int256 } from '../../types';
|
|
4
|
+
import { controllerToDebtAssetMap } from '../../utils/llamalend-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LlamaLendPaybackAction - Action that pays back debt asset to a llamalend position
|
|
8
|
+
*
|
|
9
|
+
* @category LlamaLend
|
|
10
|
+
*/
|
|
11
|
+
export class LlamaLendPaybackAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* address controllerAddress - Address of the llamalend market controller
|
|
14
|
+
* address from - Address from which to pull debt asset, will default to proxy
|
|
15
|
+
* address onBehalfOf - Address for which we are paying back debt, will default to proxy
|
|
16
|
+
* address to - Address that will receive the debt asset and collateral asset if close, will default to proxy
|
|
17
|
+
* uint256 debtAmount - Amount of debt asset to payback
|
|
18
|
+
* int256 maxActiveBand - Don't allow active band to be higher than this (to prevent front-running the repay)
|
|
19
|
+
*/
|
|
20
|
+
/// @dev debtAmount must be non-zero
|
|
21
|
+
/// @dev if debtAmount >= debt will repay whole debt and close the position, transfering collateral
|
|
22
|
+
constructor(
|
|
23
|
+
controllerAddress: EthAddress,
|
|
24
|
+
from: EthAddress,
|
|
25
|
+
onBehalfOf: EthAddress,
|
|
26
|
+
to: EthAddress,
|
|
27
|
+
debtAmount: uint256,
|
|
28
|
+
maxActiveBand: int256,
|
|
29
|
+
) {
|
|
30
|
+
super(
|
|
31
|
+
'LlamaLendPayback',
|
|
32
|
+
getAddr('LlamaLendPayback'),
|
|
33
|
+
['address', 'address', 'address', 'address', 'uint256', 'int256'],
|
|
34
|
+
[controllerAddress, from, onBehalfOf, to, debtAmount, maxActiveBand],
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
this.mappableArgs = [
|
|
38
|
+
...this.args,
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async getAssetsToApprove() {
|
|
43
|
+
return [{
|
|
44
|
+
owner: this.args[1],
|
|
45
|
+
asset: controllerToDebtAssetMap[this.args[0] as keyof typeof controllerToDebtAssetMap],
|
|
46
|
+
}];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
import { controllerToDebtAssetMap } from '../../utils/llamalend-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @category LlamaLend
|
|
9
|
+
*/
|
|
10
|
+
export class LlamaLendSelfLiquidateAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
@param controllerAddress Address of the llamalend market controller
|
|
13
|
+
@param minDebtAssetExpected Minimum amount of debt asset as collateral for the user to have
|
|
14
|
+
@param from Address from which to pull debt asset if needed
|
|
15
|
+
@param to Address that will receive the debt asset and collateral asset
|
|
16
|
+
*/
|
|
17
|
+
constructor(
|
|
18
|
+
controllerAddress: EthAddress,
|
|
19
|
+
minDebtAssetExpected: uint256,
|
|
20
|
+
from: EthAddress,
|
|
21
|
+
to: EthAddress,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'LlamaLendSelfLiquidate',
|
|
25
|
+
getAddr('LlamaLendSelfLiquidate'),
|
|
26
|
+
['address', 'uint256', 'address', 'address'],
|
|
27
|
+
[controllerAddress, minDebtAssetExpected, from, to],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
this.mappableArgs = [
|
|
31
|
+
...this.args,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async getAssetsToApprove() {
|
|
36
|
+
return [{
|
|
37
|
+
owner: this.args[2],
|
|
38
|
+
asset: controllerToDebtAssetMap[this.args[0] as keyof typeof controllerToDebtAssetMap],
|
|
39
|
+
}];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
import { controllerToCollateralAssetMap } from '../../utils/llamalend-utils';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* LlamaLendSupplyAction - Action that supplies collateral to a llamalend position
|
|
9
|
+
*
|
|
10
|
+
* @category LlamaLend
|
|
11
|
+
*/
|
|
12
|
+
export class LlamaLendSupplyAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* address controllerAddress - Address of the llamalend market controller
|
|
15
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
16
|
+
* address onBehalfOf - Address for which we are supplying, will default to proxy
|
|
17
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
18
|
+
*/
|
|
19
|
+
/// @dev collateralAmount must be non-zero, can be maxUint
|
|
20
|
+
constructor(
|
|
21
|
+
controllerAddress: EthAddress,
|
|
22
|
+
from: EthAddress,
|
|
23
|
+
onBehalfOf: EthAddress,
|
|
24
|
+
collateralAmount: uint256,
|
|
25
|
+
) {
|
|
26
|
+
super(
|
|
27
|
+
'LlamaLendSupply',
|
|
28
|
+
getAddr('LlamaLendSupply'),
|
|
29
|
+
['address', 'address', 'address', 'uint256'],
|
|
30
|
+
[controllerAddress, from, onBehalfOf, collateralAmount],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
this.mappableArgs = [
|
|
34
|
+
...this.args,
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async getAssetsToApprove() {
|
|
39
|
+
return [{
|
|
40
|
+
owner: this.args[1],
|
|
41
|
+
asset: controllerToCollateralAssetMap[this.args[0] as keyof typeof controllerToCollateralAssetMap],
|
|
42
|
+
}];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LlamaLendWithdrawAction - Action that withdraws collateral from proxy llamalend position
|
|
7
|
+
*
|
|
8
|
+
* @category LlamaLend
|
|
9
|
+
*/
|
|
10
|
+
export class LlamaLendWithdrawAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* address controllerAddress - Address of the llamalend market controller
|
|
13
|
+
* address to - Address that will receive the withdrawn collateral, will default to proxy
|
|
14
|
+
* uint256 collateralAmount - Amount of collateral to withdraw
|
|
15
|
+
*/
|
|
16
|
+
/// @dev collateralAmount must be non-zero
|
|
17
|
+
/// @dev if collateralAmount == uintMax will withdraw as much as the debt will allow
|
|
18
|
+
constructor(
|
|
19
|
+
controllerAddress: EthAddress,
|
|
20
|
+
to: EthAddress,
|
|
21
|
+
collateralAmount: uint256,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'LlamaLendWithdraw',
|
|
25
|
+
getAddr('LlamaLendWithdraw'),
|
|
26
|
+
['address', 'address', 'uint256'],
|
|
27
|
+
[controllerAddress, to, collateralAmount],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
this.mappableArgs = [
|
|
31
|
+
...this.args,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/addresses.ts
CHANGED
|
@@ -259,6 +259,14 @@ export const actionAddresses = {
|
|
|
259
259
|
MorphoBluePayback: '0x9f437E5F705E02d77adC2e72C34926978776b085',
|
|
260
260
|
MorphoBlueSetAuth: '0xf30935e20c6357c7bcecd5e58ad6de26d54b9f64',
|
|
261
261
|
MorphoBlueSetAuthWithSig: '0xE2d5fCDBf73BAd24A0FCAf6B2733933A98021808',
|
|
262
|
+
|
|
263
|
+
// llamalend
|
|
264
|
+
LlamaLendCreate: '0x4349be191ea63173eD98b7fC1b0DeC1ef9Bc6c11',
|
|
265
|
+
LlamaLendSupply: '0x1900eF943bD1b038c58d9F35C3825F119F9BB730',
|
|
266
|
+
LlamaLendBorrow: '0xCF693585C47049F3eACc2285E7Fe4e80123b2520',
|
|
267
|
+
LlamaLendWithdraw: '0x2593Da3c4110C531541424e9e847cd7905894C52',
|
|
268
|
+
LlamaLendPayback: '0x5b506b7a0117dbcd086632575da599bb603eb602',
|
|
269
|
+
LlamaLendSelfLiquidate: '0xe4944e0e46177300fa4c351ef72b95b9655e8394',
|
|
262
270
|
},
|
|
263
271
|
[NETWORKS.optimism.chainId]: {
|
|
264
272
|
DFSSell: '0xC6c601fcAa870efd26C624F8c65fbc54cBe533b1',
|
package/src/utils/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import mstableAssetPairs from './mstableAssetPairs';
|
|
|
6
6
|
import * as curveUtils from './curve-utils';
|
|
7
7
|
import * as curveusdUtils from './curveusd-utils';
|
|
8
8
|
import * as basicUtils from './basic-utils';
|
|
9
|
+
import * as llamaLenUtils from './llamalend-utils';
|
|
9
10
|
|
|
10
11
|
export {
|
|
11
12
|
zeroExExchange,
|
|
@@ -16,4 +17,5 @@ export {
|
|
|
16
17
|
curveUtils,
|
|
17
18
|
curveusdUtils,
|
|
18
19
|
basicUtils,
|
|
20
|
+
llamaLenUtils,
|
|
19
21
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const controllerToCollateralAssetMap = {
|
|
2
|
+
'0x5E657c5227A596a860621C5551c9735d8f4A8BE3': '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
3
|
+
'0x7443944962D04720f8c220C0D25f56F869d6EfD4': '0xD533a949740bb3306d119CC777fa900bA034cd52',
|
|
4
|
+
'0x43fc0f246F952ff12B757341A91cF4040711dDE9': '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
5
|
+
};
|
|
6
|
+
export const controllerToDebtAssetMap = {
|
|
7
|
+
'0x5E657c5227A596a860621C5551c9735d8f4A8BE3': '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
8
|
+
'0x7443944962D04720f8c220C0D25f56F869d6EfD4': '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
9
|
+
'0x43fc0f246F952ff12B757341A91cF4040711dDE9': '0xD533a949740bb3306d119CC777fa900bA034cd52',
|
|
10
|
+
};
|
|
11
|
+
|