test: 🚧 Added fixtures for new test schema

This commit is contained in:
PedroCailleret
2022-12-03 01:17:48 -03:00
parent 4403541660
commit c69d82ccee
49 changed files with 931 additions and 1126 deletions

View File

@@ -5,41 +5,43 @@ import { IReputation } from "./lib/interfaces/IReputation.sol";
import { Owned } from "./lib/auth/Owned.sol";
import { FixedPointMathLib as WADMath } from "./lib/utils/FixedPointMathLib.sol";
contract Reputation is IReputation, Owned(msg.sender) {
using WADMath for uint256;
contract Reputation is
IReputation,
Owned(msg.sender)
{
/// @dev Asymptote numerator constant value for the `limiter` fx.
uint256 public constant maxLimit = 1e6;
/// @dev Denominator's constant operand for the `limiter` fx.
uint256 public constant magicValue = 2.5e11;
using WADMath for uint256;
/// @dev Asymptote numerator constant value for the `limiter` fx.
uint256 constant public maxLimit = 1e6;
/// @dev Denominator's constant operand for the `limiter` fx.
uint256 constant public magicValue = 2.5e11;
constructor(/* */) {/* */}
function limiter(uint256 _userCredit)
external
pure
override(IReputation)
returns(uint256 _spendLimit)
{
// _spendLimit = 1 + ( ( maxLimit * _userCredit ) / sqrt( magicValue * ( _userCredit * _userCredit ) ) );
// return _spendLimit;
unchecked {
uint256 numeratorWad =
maxLimit.mulWadDown(_userCredit);
uint256 userCreditSquaredWad =
_userCredit.mulWadDown(_userCredit);
uint256 denominatorSqrtWad =
(userCreditSquaredWad.mulWadDown(magicValue)).sqrt();
_spendLimit = (1 + (numeratorWad).divWadDown(denominatorSqrtWad));
constructor() /* */ {
/* */
}
}
function limiter(
uint256 _userCredit
)
external
pure
override(IReputation)
returns (uint256 _spendLimit)
{
// _spendLimit = 1 + ( ( maxLimit * _userCredit ) / sqrt( magicValue * ( _userCredit * _userCredit ) ) );
// return _spendLimit;
unchecked {
uint256 numeratorWad = maxLimit.mulWadDown(
_userCredit
);
uint256 userCreditSquaredWad = _userCredit
.mulWadDown(_userCredit);
uint256 denominatorSqrtWad = (
userCreditSquaredWad.mulWadDown(magicValue)
).sqrt();
_spendLimit = (1 +
(numeratorWad).divWadDown(
denominatorSqrtWad
));
}
}
}