2020-11-20 10:41:58 +00:00
|
|
|
pragma solidity ^0.6.12;
|
2020-10-14 21:59:12 +00:00
|
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
|
2020-10-28 23:58:20 +00:00
|
|
|
import {UserConfiguration} from '../../contracts/libraries/configuration/UserConfiguration.sol';
|
2020-10-14 21:59:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
A wrapper contract for calling functions from the library UserConfiguration.
|
|
|
|
*/
|
|
|
|
contract UserConfigurationHarness {
|
2020-10-30 15:04:31 +00:00
|
|
|
UserConfiguration.Map internal usersConfig;
|
|
|
|
|
|
|
|
function setBorrowing(
|
|
|
|
address user,
|
|
|
|
uint256 reserveIndex,
|
|
|
|
bool borrowing
|
|
|
|
) public {
|
|
|
|
UserConfiguration.setBorrowing(usersConfig, reserveIndex, borrowing);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setUsingAsCollateral(
|
|
|
|
address user,
|
|
|
|
uint256 reserveIndex,
|
|
|
|
bool _usingAsCollateral
|
|
|
|
) public {
|
|
|
|
UserConfiguration.setUsingAsCollateral(usersConfig, reserveIndex, _usingAsCollateral);
|
|
|
|
}
|
|
|
|
|
|
|
|
function isUsingAsCollateralOrBorrowing(address user, uint256 reserveIndex)
|
|
|
|
public
|
2020-10-14 21:59:12 +00:00
|
|
|
view
|
2020-10-30 15:04:31 +00:00
|
|
|
returns (bool)
|
|
|
|
{
|
|
|
|
return UserConfiguration.isUsingAsCollateralOrBorrowing(usersConfig, reserveIndex);
|
|
|
|
}
|
2020-10-14 21:59:12 +00:00
|
|
|
|
2020-10-30 15:04:31 +00:00
|
|
|
function isBorrowing(address user, uint256 reserveIndex) public view returns (bool) {
|
|
|
|
return UserConfiguration.isBorrowing(usersConfig, reserveIndex);
|
|
|
|
}
|
2020-10-14 21:59:12 +00:00
|
|
|
|
2020-10-30 15:04:31 +00:00
|
|
|
function isUsingAsCollateral(address user, uint256 reserveIndex) public view returns (bool) {
|
|
|
|
return UserConfiguration.isUsingAsCollateral(usersConfig, reserveIndex);
|
|
|
|
}
|
2020-10-14 21:59:12 +00:00
|
|
|
|
2020-10-30 15:04:31 +00:00
|
|
|
function isBorrowingAny(address user) public view returns (bool) {
|
|
|
|
return UserConfiguration.isBorrowingAny(usersConfig);
|
|
|
|
}
|
2020-10-14 21:59:12 +00:00
|
|
|
|
2020-10-30 15:04:31 +00:00
|
|
|
function isEmpty(address user) public view returns (bool) {
|
|
|
|
return UserConfiguration.isEmpty(usersConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2020-10-14 21:59:12 +00:00
|
|
|
Mimics the original constructor of the contract.
|
|
|
|
*/
|
2020-10-30 15:04:31 +00:00
|
|
|
function init_state() public {}
|
2020-10-14 21:59:12 +00:00
|
|
|
}
|