aave-protocol-v2/specs/harness/UserConfigurationHarness.sol

48 lines
1.5 KiB
Solidity
Raw Permalink Normal View History

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;
2021-01-12 11:11:03 +00:00
function setBorrowing(uint256 reserveIndex, bool borrowing) public {
UserConfiguration.setBorrowing(usersConfig, reserveIndex, borrowing);
}
2021-01-12 11:11:03 +00:00
function setUsingAsCollateral(uint256 reserveIndex, bool _usingAsCollateral) public {
UserConfiguration.setUsingAsCollateral(usersConfig, reserveIndex, _usingAsCollateral);
}
2021-01-12 11:11:03 +00:00
function isUsingAsCollateralOrBorrowing(uint256 reserveIndex) public view returns (bool) {
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) {
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) {
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) {
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) {
return UserConfiguration.isEmpty(usersConfig);
}
/*
2020-10-14 21:59:12 +00:00
Mimics the original constructor of the contract.
*/
function init_state() public {}
2020-10-14 21:59:12 +00:00
}