@defisaver/sdk 1.3.27 → 1.3.28-audit-dev

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.
@@ -1,20 +0,0 @@
1
- import { Action } from '../../Action';
2
- import { EthAddress, uint256 } from '../../types';
3
- /**
4
- * EtherFiStakeFromLidoAction - Converts wstETH to weETH through Ether.fi's Lido staking route
5
- *
6
- * @category EtherFi
7
- */
8
- export declare class EtherFiStakeFromLidoAction extends Action {
9
- /**
10
- * @param amount - amount of wstETH to pull
11
- * @param minAmountOut - minimum amount of weETH to receive
12
- * @param from - address from which to pull wstETH
13
- * @param to - address where received weETH will be sent
14
- */
15
- constructor(amount: uint256, minAmountOut: uint256, from: EthAddress, to: EthAddress);
16
- getAssetsToApprove(): Promise<{
17
- asset: string;
18
- owner: any;
19
- }[]>;
20
- }
@@ -1,41 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { getAssetInfo } from '@defisaver/tokens';
11
- import { Action } from '../../Action';
12
- import { getAddr } from '../../addresses';
13
- import { requireAddress } from '../../utils/general';
14
- /**
15
- * EtherFiStakeFromLidoAction - Converts wstETH to weETH through Ether.fi's Lido staking route
16
- *
17
- * @category EtherFi
18
- */
19
- export class EtherFiStakeFromLidoAction extends Action {
20
- /**
21
- * @param amount - amount of wstETH to pull
22
- * @param minAmountOut - minimum amount of weETH to receive
23
- * @param from - address from which to pull wstETH
24
- * @param to - address where received weETH will be sent
25
- */
26
- constructor(amount, minAmountOut, from, to) {
27
- requireAddress(to);
28
- super('EtherFiStakeFromLido', getAddr('EtherFiStakeFromLido'), ['uint256', 'uint256', 'address', 'address'], [amount, minAmountOut, from, to]);
29
- this.mappableArgs = [
30
- this.args[0],
31
- this.args[1],
32
- this.args[2],
33
- this.args[3],
34
- ];
35
- }
36
- getAssetsToApprove() {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- return [{ asset: getAssetInfo('WSTETH').address, owner: this.args[2] }];
39
- });
40
- }
41
- }
@@ -1,38 +0,0 @@
1
- import { getAssetInfo } from '@defisaver/tokens';
2
- import { Action } from '../../Action';
3
- import { getAddr } from '../../addresses';
4
- import { EthAddress, uint256 } from '../../types';
5
- import { requireAddress } from '../../utils/general';
6
-
7
- /**
8
- * EtherFiStakeFromLidoAction - Converts wstETH to weETH through Ether.fi's Lido staking route
9
- *
10
- * @category EtherFi
11
- */
12
- export class EtherFiStakeFromLidoAction extends Action {
13
- /**
14
- * @param amount - amount of wstETH to pull
15
- * @param minAmountOut - minimum amount of weETH to receive
16
- * @param from - address from which to pull wstETH
17
- * @param to - address where received weETH will be sent
18
- */
19
- constructor(amount:uint256, minAmountOut:uint256, from:EthAddress, to:EthAddress) {
20
- requireAddress(to);
21
- super(
22
- 'EtherFiStakeFromLido',
23
- getAddr('EtherFiStakeFromLido'),
24
- ['uint256', 'uint256', 'address', 'address'],
25
- [amount, minAmountOut, from, to],
26
- );
27
- this.mappableArgs = [
28
- this.args[0],
29
- this.args[1],
30
- this.args[2],
31
- this.args[3],
32
- ];
33
- }
34
-
35
- async getAssetsToApprove() {
36
- return [{ asset: getAssetInfo('WSTETH').address, owner: this.args[2] }];
37
- }
38
- }
@@ -1,40 +0,0 @@
1
- const dfs = require('../../../src');
2
- const { getAssetInfo } = require('@defisaver/tokens');
3
- const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
- const { assert } = require('chai');
5
-
6
- describe('Action: EtherFiStakeFromLidoAction', () => {
7
- let action;
8
- const amount = 100;
9
- const minAmountOut = 90;
10
- const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
11
- const to = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
12
-
13
- it('constructor', () => {
14
- action = new dfs.actions.etherfi.EtherFiStakeFromLidoAction(
15
- amount,
16
- minAmountOut,
17
- from,
18
- to,
19
- );
20
-
21
- assert.equal(action.args[0], amount);
22
- assert.equal(action.args[1], minAmountOut);
23
- assert.equal(action.args[2], from);
24
- assert.equal(action.args[3], to);
25
- });
26
-
27
- it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
28
- it('encodeForRecipe', () => encodeForRecipe(action));
29
-
30
- it('getEthValue', async () => {
31
- assert.equal(await action.getEthValue(), '0');
32
- });
33
-
34
- it('getAssetsToApprove', async () => {
35
- const assetOwnerPairs = await action.getAssetsToApprove();
36
- assert.lengthOf(assetOwnerPairs, 1);
37
- assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WSTETH').address);
38
- assert.equal(assetOwnerPairs[0].owner, from);
39
- });
40
- });