-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c725925
commit fd7ce2d
Showing
5 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,46 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.0; | ||
import "../../../src/EVault/modules/Borrowing.sol"; | ||
import "../../../src/EVault/shared/types/UserStorage.sol"; | ||
import "../../../src/EVault/shared/types/Types.sol"; | ||
import {ERC20} from "../../../lib/ethereum-vault-connector/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; | ||
import "../AbstractBaseHarness.sol"; | ||
import "../../../src/EVault/modules/Borrowing.sol"; | ||
|
||
contract BorrowingHarness is Borrowing, AbstractBaseHarness { | ||
constructor(Integrations memory integrations) Borrowing (integrations) {} | ||
uint256 constant SHARES_MASK = 0x000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFF; | ||
|
||
contract BorrowingHarness is AbstractBaseHarness, Borrowing { | ||
constructor(Integrations memory integrations) Borrowing(integrations) {} | ||
|
||
function initOperationExternal(uint32 operation, address accountToCheck) | ||
public | ||
returns (VaultCache memory vaultCache, address account) | ||
{ | ||
return initOperation(operation, accountToCheck); | ||
} | ||
|
||
function getTotalBalance() external view returns (Shares) { | ||
return vaultStorage.totalShares; | ||
} | ||
|
||
function toAssetsExt(uint256 amount) external pure returns (uint256){ | ||
return TypesLib.toAssets(amount).toUint(); | ||
} | ||
|
||
function unpackBalanceExt(PackedUserSlot data) external view returns (Shares) { | ||
return Shares.wrap(uint112(PackedUserSlot.unwrap(data) & SHARES_MASK)); | ||
} | ||
|
||
function getUserInterestAccExt(address account) external view returns (uint256) { | ||
return vaultStorage.users[account].interestAccumulator; | ||
} | ||
|
||
function getVaultInterestAccExt() external returns (uint256) { | ||
VaultCache memory vaultCache = updateVault(); | ||
return vaultCache.interestAccumulator; | ||
} | ||
|
||
function getUnderlyingAssetExt() external returns (IERC20) { | ||
VaultCache memory vaultCache = updateVault(); | ||
return vaultCache.asset; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters