Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

LibUsdAccount

Git Source

State Variables

ACCOUNT_SIZE

uint64 constant ACCOUNT_SIZE = 32

Functions

decode

Decode an account.

Reverts if account is not 32 bytes long.

function decode(bytes calldata account)
    internal
    pure
    returns (address user, uint96 balance);

Parameters

NameTypeDescription
accountbytesThe account

Returns

NameTypeDescription
useraddressThe user address
balanceuint96The user balance

encode

Encode an account.

function encode(address user, uint96 balance)
    internal
    pure
    returns (bytes memory account);

Parameters

NameTypeDescription
useraddressThe user address
balanceuint96The user balance

Returns

NameTypeDescription
accountbytesThe account

_checkAccountSize

function _checkAccountSize(uint256 accountSize) internal pure;