Skip to main content

MockNonStandardToken

MockNonStandardToken

Mock token contract to simulate tokens that don't throw/revert when a transfer/transferFrom call fails

constructor

constructor() public

decimals

function decimals() public pure returns (uint8)

Returns the number of decimals used to get its user representation. For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5.05 (505 / 10 ** 2).

Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value ERC20 uses, unless this function is overridden;

NOTE: This information is only used for display purposes: it in no way affects any of the arithmetic of the contract, including IERC20-balanceOf and IERC20-transfer.

transfer

function transfer(address recipient, uint256 amount) public returns (bool)

See IERC20-transfer.

Requirements:

  • recipient cannot be the zero address.
  • the caller must have a balance of at least amount.

transferFrom

function transferFrom(address sender, address recipient, uint256 amount) public returns (bool)

See IERC20-transferFrom.

Emits an Approval event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of ERC20.

Requirements:

  • sender and recipient cannot be the zero address.
  • sender must have a balance of at least amount.
  • the caller must have allowance for sender's tokens of at least amount.