• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

delvtech / hyperdrive / 9179140169

21 May 2024 05:53PM UTC coverage: 88.259% (-2.8%) from 91.088%
9179140169

push

github

cashd
wip

16 of 32 new or added lines in 4 files covered. (50.0%)

77 existing lines in 15 files now uncovered.

1774 of 2010 relevant lines covered (88.26%)

371757.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/contracts/src/instances/lseth/LsETHBase.sol
1
// SPDX-License-Identifier: Apache-2.0
2
pragma solidity 0.8.20;
3

4
import { ERC20 } from "openzeppelin/token/ERC20/ERC20.sol";
5
import { SafeERC20 } from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
6
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
7
import { IRiverV1 } from "../../interfaces/IRiverV1.sol";
8
import { HyperdriveBase } from "../../internal/HyperdriveBase.sol";
9

10
/// @author DELV
11
/// @title LsETHHyperdrive
12
/// @notice The base contract for the LsETH Hyperdrive implementation.
13
/// @dev River has it's own notion of shares to account for the accrual of
14
///      interest on the ether pooled in the River protocol. Instead of
15
///      maintaining a balance of shares, this integration can simply use River's
16
///      shares directly.
17
/// @custom:disclaimer The language used in this code is for coding convenience
18
///                    only, and is not intended to, and does not, have any
19
///                    particular legal or regulatory significance.
20
abstract contract LsETHBase is HyperdriveBase {
21
    using SafeERC20 for ERC20;
22

23
    /// Yield Source ///
24

25
    /// @dev Deposits as base asset not supported for this integration.
26
    function _depositWithBase(
27
        uint256, // unused
28
        bytes calldata // unused
29
    ) internal pure override returns (uint256, uint256) {
UNCOV
30
        revert IHyperdrive.UnsupportedToken();
×
31
    }
32

33
    /// @dev Process a deposit in vault shares.
34
    /// @param _shareAmount The vault shares amount to deposit.
35
    function _depositWithShares(
36
        uint256 _shareAmount,
37
        bytes calldata // unused
38
    ) internal override {
39
        // Transfer LsETH shares into the contract.
UNCOV
40
        ERC20(address(_vaultSharesToken)).safeTransferFrom(
×
41
            msg.sender,
42
            address(this),
43
            _shareAmount
44
        );
45
    }
46

47
    /// @dev Withdrawals as base asset not supported for this integration.
48
    function _withdrawWithBase(
49
        uint256, // unused
50
        address, // unused
51
        bytes calldata // unused
52
    ) internal pure override returns (uint256) {
53
        // LsETH withdrawals aren't necessarily instantaneous. Users that want
54
        // to withdraw can manage their withdrawal separately.
UNCOV
55
        revert IHyperdrive.UnsupportedToken();
×
56
    }
57

58
    /// @dev Process a withdrawal in vault shares and send the proceeds to the
59
    ///      destination.
60
    /// @param _shareAmount The amount of vault shares to withdraw.
61
    /// @param _destination The destination of the withdrawal.
62
    function _withdrawWithShares(
63
        uint256 _shareAmount,
64
        address _destination,
65
        bytes calldata // unused
66
    ) internal override {
67
        // Transfer the LsETH shares to the destination.
UNCOV
68
        ERC20(address(_vaultSharesToken)).safeTransfer(
×
69
            _destination,
70
            _shareAmount
71
        );
72
    }
73

74
    /// @dev We override the message value check since this integration is
75
    ///      not payable.
76
    function _checkMessageValue() internal view override {
UNCOV
77
        if (msg.value != 0) {
×
UNCOV
78
            revert IHyperdrive.NotPayable();
×
79
        }
80
    }
81

82
    /// @dev Convert an amount of vault shares to an amount of base.
83
    /// @param _shareAmount The vault shares amount.
84
    /// @return baseAmount The base amount.
85
    function _convertToBase(
86
        uint256 _shareAmount
87
    ) internal view override returns (uint256) {
UNCOV
88
        return
×
UNCOV
89
            IRiverV1(address(_vaultSharesToken)).underlyingBalanceFromShares(
×
90
                _shareAmount
91
            );
92
    }
93

94
    /// @dev Convert an amount of base to an amount of vault shares.
95
    /// @param _baseAmount The base amount.
96
    /// @return shareAmount The vault shares amount.
97
    function _convertToShares(
98
        uint256 _baseAmount
99
    ) internal view override returns (uint256) {
UNCOV
100
        return
×
UNCOV
101
            IRiverV1(address(_vaultSharesToken)).sharesFromUnderlyingBalance(
×
102
                _baseAmount
103
            );
104
    }
105

106
    /// @dev Gets the total amount of shares held by the pool in the yield
107
    ///      source.
108
    /// @return shareAmount The total amount of shares.
109
    function _totalShares()
110
        internal
111
        view
112
        override
113
        returns (uint256 shareAmount)
114
    {
UNCOV
115
        return _vaultSharesToken.balanceOf(address(this));
×
116
    }
117
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc