LibBalance

Git Source

Author: LeoFib, Publius

Functions

getBalance

function getBalance(address account, IERC20 token) internal view returns (uint256 combined_balance);

increaseInternalBalance

Increases account's Internal Balance for token by amount.

function increaseInternalBalance(address account, IERC20 token, uint256 amount) internal;

decreaseInternalBalance

Decreases account's Internal Balance for token by amount. If allowPartial is true, this function doesn't revert if account doesn't have enough balance, and sets it to zero and returns the deducted amount instead.

function decreaseInternalBalance(address account, IERC20 token, uint256 amount, bool allowPartial)
    internal
    returns (uint256 deducted);

setInternalBalance

Sets account's Internal Balance for token to newBalance. Emits an InternalBalanceChanged event. This event includes delta, which is the amount the balance increased (if positive) or decreased (if negative). To avoid reading the current balance in order to compute the delta, this function relies on the caller providing it directly.

function setInternalBalance(address account, IERC20 token, uint256 newBalance, int256 delta) private;

getInternalBalance

Returns account's Internal Balance for token.

function getInternalBalance(address account, IERC20 token) internal view returns (uint256);

Events

InternalBalanceChanged

Emitted when a account's Internal Balance changes, through interacting using Internal Balance.

event InternalBalanceChanged(address indexed account, IERC20 indexed token, int256 delta);