Skip to main content

Currency

Git Source - Generated with forge doc

type Currency is address;

CurrencyLibrary

Git Source

This library allows for transferring and holding native tokens and ERC20 tokens

State Variables

ADDRESS_ZERO

A constant to represent the native currency

Currency public constant ADDRESS_ZERO = Currency.wrap(address(0));

Functions

transfer

function transfer(Currency currency, address to, uint256 amount) internal;

balanceOfSelf

function balanceOfSelf(Currency currency) internal view returns (uint256);

balanceOf

function balanceOf(Currency currency, address owner) internal view returns (uint256);

isAddressZero

function isAddressZero(Currency currency) internal pure returns (bool);

toId

function toId(Currency currency) internal pure returns (uint256);

fromId

function fromId(uint256 id) internal pure returns (Currency);

Errors

NativeTransferFailed

Additional context for ERC-7751 wrapped error when a native transfer fails

error NativeTransferFailed();

ERC20TransferFailed

Additional context for ERC-7751 wrapped error when an ERC20 transfer fails

error ERC20TransferFailed();

greaterThanOrEqualTo

Git Source

function greaterThanOrEqualTo(Currency currency, Currency other) pure returns (bool);

lessThan

Git Source

function lessThan(Currency currency, Currency other) pure returns (bool);

equals

Git Source

function equals(Currency currency, Currency other) pure returns (bool);

greaterThan

Git Source

function greaterThan(Currency currency, Currency other) pure returns (bool);