[Collateral] Inline slashAmount() function

This commit is contained in:
Mark Spanbroek 2023-01-09 15:25:32 +01:00 committed by markspanbroek
parent 39da450c2a
commit a7397981bb
1 changed files with 1 additions and 9 deletions

View File

@ -48,19 +48,11 @@ abstract contract Collateral {
assert(token.transfer(msg.sender, amount));
}
function _slashAmount(address account, uint256 percentage)
internal
view
returns (uint256)
{
return (balanceOf(account) * percentage) / 100;
}
function _slash(address account, uint256 percentage)
internal
collateralInvariant
{
uint256 amount = _slashAmount(account, percentage);
uint256 amount = (balanceOf(account) * percentage) / 100;
funds.slashed += amount;
subtract(account, amount);
}