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

delvtech / hyperdrive / 9960075739

16 Jul 2024 03:49PM UTC coverage: 91.882% (+0.5%) from 91.352%
9960075739

Pull #1097

github

mcclurejt
basic testing harness setup
Pull Request #1097: Everlong testing harness

13 of 19 new or added lines in 3 files covered. (68.42%)

2094 of 2279 relevant lines covered (91.88%)

378830.88 hits per line

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

72.73
/contracts/src/everlong/EverlongERC4626.sol
1
// SPDX-License-Identifier: Apache-2.0
2
pragma solidity 0.8.20;
3

4
import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol";
5
import { ERC4626 } from "solady/tokens/ERC4626.sol";
6

7
contract EverlongERC4626 is ERC4626 {
8
    /// @notice Whether virtual shares will be used to mitigate the inflation attack.
9
    bool public constant useVirtualShares = true;
10

11
    /// @notice Used to reduce the feasibility of an inflation attack.
12
    uint8 public constant decimalsOffset = 3;
13

14
    /// @notice Address of the underlying Hyperdrive instance.
15
    address internal immutable _underlying;
16

17
    /// @notice Decimals used by the underlying Hyperdrive asset.
18
    uint8 internal immutable _decimals;
19

20
    /// @notice Name of the Everlong token.
21
    string internal _name;
22

23
    /// @notice Symbol of the Everlong token.
24
    string internal _symbol;
25

26
    constructor(
27
        address underlying_,
28
        string memory name_,
29
        string memory symbol_
30
    ) {
31
        _underlying = underlying_;
14✔
32

33
        (bool success, uint8 result) = _tryGetAssetDecimals(underlying_);
18✔
34
        _decimals = success ? result : _DEFAULT_UNDERLYING_DECIMALS;
6✔
35

36
        _name = name_;
14✔
37
        _symbol = symbol_;
8✔
38
    }
39

40
    /// @dev Address of the underlying Hyperdrive instance.
41
    ///
42
    /// - MUST be an ERC20 token contract.
43
    /// - MUST NOT revert.
44
    function asset() public view virtual override returns (address) {
45
        return _underlying;
1✔
46
    }
47

48
    /// @dev Returns the name of the Everlong token.
49
    function name() public view virtual override returns (string memory) {
50
        return _name;
1✔
51
    }
52

53
    /// @dev Returns the symbol of the Everlong token.
54
    function symbol() public view virtual override returns (string memory) {
55
        return _symbol;
1✔
56
    }
57

58
    /// @dev Returns whether virtual shares will be used to mitigate the inflation attack.
59
    /// See: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3706
60
    ///
61
    /// - MUST NOT revert.
62
    function _useVirtualShares() internal view virtual override returns (bool) {
NEW
63
        return useVirtualShares;
×
64
    }
65

66
    /// @dev Returns the number of decimals of the underlying asset.
67
    ///
68
    /// - MUST NOT revert.
69
    function _underlyingDecimals()
70
        internal
71
        view
72
        virtual
73
        override
74
        returns (uint8)
75
    {
NEW
76
        return _decimals;
×
77
    }
78

79
    /// @dev A non-zero value used to make the inflation attack even more unfeasible.
80
    /// Only used when {_useVirtualShares} returns true.
81
    ///
82
    /// - MUST NOT revert.
83
    function _decimalsOffset() internal view virtual override returns (uint8) {
NEW
84
        return decimalsOffset;
×
85
    }
86

87
    // TODO: Might not need this but including for convenience.
88
    function _beforeWithdraw(uint256, uint256) internal override {
89
        // revert("TODO");
90
    }
91

92
    // TODO: Might not need this but including for convenience.
93
    function _afterDeposit(uint256, uint256) internal override {
94
        // revert("TODO");
95
    }
96
}
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