CMXERC20CompatibilityFacet
ERC-20 compatibility layer that delegates to lot-based system
Provides standard ERC-20 interface while using lot-based transfers behind the scenes
Functions
name
Returns the name of the token
function name() external view returns (string memory);
Returns
<none>
string
The token name
symbol
Returns the symbol of the token
function symbol() external view returns (string memory);
Returns
<none>
string
The token symbol
decimals
Returns the decimals of the token
function decimals() external view returns (uint8);
Returns
<none>
uint8
The token decimals
totalSupply
Returns the total supply of the token
function totalSupply() external view returns (uint256);
Returns
<none>
uint256
The total supply
balanceOf
Returns the balance of an account (aggregated from all lots)
function balanceOf(address account) external view returns (uint256);
Parameters
account
address
The account to query
Returns
<none>
uint256
The total balance across all lots
transfer
Transfer tokens from sender to recipient
Delegates to CMXTransferFacet using FIFO lot strategy
function transfer(address to, uint256 amount) external returns (bool);
Parameters
to
address
The recipient address
amount
uint256
The amount to transfer
Returns
<none>
bool
True if transfer succeeded
transferFrom
Transfer tokens from one account to another (requires allowance)
Manages allowances and delegates to lot-based transfer
function transferFrom(address from, address to, uint256 amount) external returns (bool);
Parameters
from
address
The sender address
to
address
The recipient address
amount
uint256
The amount to transfer
Returns
<none>
bool
True if transfer succeeded
allowance
Returns the allowance of spender for owner
function allowance(address owner, address spender) external view returns (uint256);
Parameters
owner
address
The owner address
spender
address
The spender address
Returns
<none>
uint256
The allowance amount
approve
Approve spender to spend tokens on behalf of caller
function approve(address spender, uint256 amount) external returns (bool);
Parameters
spender
address
The spender address
amount
uint256
The amount to approve
Returns
<none>
bool
True if approval succeeded
increaseAllowance
Increase the allowance for spender
function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
Parameters
spender
address
The spender address
addedValue
uint256
The amount to add to allowance
Returns
<none>
bool
True if increase succeeded
decreaseAllowance
Decrease the allowance for spender
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
Parameters
spender
address
The spender address
subtractedValue
uint256
The amount to subtract from allowance
Returns
<none>
bool
True if decrease succeeded
_approve
Internal approve function
function _approve(address owner, address spender, uint256 amount) internal;
Parameters
owner
address
The owner address
spender
address
The spender address
amount
uint256
The amount to approve
_spendAllowance
Internal function to spend allowance
function _spendAllowance(address owner, address spender, uint256 amount) internal;
Parameters
owner
address
The owner address
spender
address
The spender address
amount
uint256
The amount to spend
Events
Transfer
event Transfer(address indexed from, address indexed to, uint256 value);
Approval
event Approval(address indexed owner, address indexed spender, uint256 value);
Errors
ERC20_InsufficientAllowance
error ERC20_InsufficientAllowance();
ERC20_InvalidAddress
error ERC20_InvalidAddress();
Last updated
Was this helpful?