2020-11-20 10:45:20 +00:00
|
|
|
pragma solidity 0.6.12;
|
2020-10-14 21:59:12 +00:00
|
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
|
2021-01-12 11:11:03 +00:00
|
|
|
import {
|
|
|
|
UserConfiguration
|
|
|
|
} from '../../contracts/protocol/libraries/configuration/UserConfiguration.sol';
|
2020-12-03 15:20:11 +00:00
|
|
|
import {DataTypes} from '../../contracts/protocol/libraries/types/DataTypes.sol';
|
2020-10-14 21:59:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
A wrapper contract for calling functions from the library UserConfiguration.
|
|
|
|
*/
|
|
|
|
contract UserConfigurationHarness {
|
2020-11-24 15:17:27 +00:00
|
|
|
DataTypes.UserConfigurationMap internal usersConfig;
|
2020-10-30 15:04:31 +00:00
|
|
|
|
2021-01-12 11:11:03 +00:00
|
|
|
function setBorrowing(uint256 reserveIndex, bool borrowing) public {
|
2020-10-30 15:04:31 +00:00
|
|
|
UserConfiguration.setBorrowing(usersConfig, reserveIndex, borrowing);
|
|
|
|
}
|
|
|
|
|
2021-01-12 11:11:03 +00:00
|
|
|
function setUsingAsCollateral(uint256 reserveIndex, bool _usingAsCollateral) public {
|
2020-10-30 15:04:31 +00:00
|
|
|
UserConfiguration.setUsingAsCollateral(usersConfig, reserveIndex, _usingAsCollateral);
|
|
|
|
}
|
|
|
|
|
2021-01-12 11:11:03 +00:00
|
|
|
function isUsingAsCollateralOrBorrowing(uint256 reserveIndex) public view returns (bool) {
|
2020-10-30 15:04:31 +00:00
|
|
|
return UserConfiguration.isUsingAsCollateralOrBorrowing(usersConfig, reserveIndex);
|
|
|
|
}
|
2020-10-14 21:59:12 +00:00
|
|
|
|
2020-12-03 15:20:11 +00:00
|
|
|
function isBorrowing(uint256 reserveIndex) public view returns (bool) {
|
2020-10-30 15:04:31 +00:00
|
|
|
return UserConfiguration.isBorrowing(usersConfig, reserveIndex);
|
|
|
|
}
|
2020-10-14 21:59:12 +00:00
|
|
|
|
2020-12-03 15:20:11 +00:00
|
|
|
function isUsingAsCollateral(uint256 reserveIndex) public view returns (bool) {
|
2020-10-30 15:04:31 +00:00
|
|
|
return UserConfiguration.isUsingAsCollateral(usersConfig, reserveIndex);
|
|
|
|
}
|
2020-10-14 21:59:12 +00:00
|
|
|
|
2020-12-03 15:20:11 +00:00
|
|
|
function isBorrowingAny() public view returns (bool) {
|
2020-10-30 15:04:31 +00:00
|
|
|
return UserConfiguration.isBorrowingAny(usersConfig);
|
|
|
|
}
|
2020-10-14 21:59:12 +00:00
|
|
|
|
2020-12-03 15:20:11 +00:00
|
|
|
function isEmpty() public view returns (bool) {
|
2020-10-30 15:04:31 +00:00
|
|
|
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
|
|
|
}
|