[Collateral] Inline slashAmount() function
This commit is contained in:
parent
39da450c2a
commit
a7397981bb
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue