ODCdataManagersERC20extensions

ERC20Approvals

Abstract contract that provides the approval operations of the ERC20 Data Manager

AllowanceAmount

Struct to store the amount of an allowance (used to optimize mapping access)

struct AllowanceAmount {
  uint256 amount;
}

allowance

function allowance(address owner, address spender) public view returns (uint256)

_Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner through {transferFrom}. This is zero by default.

This value changes when {approve} or {transferFrom} are called._

approve

function approve(address spender, uint256 value) public returns (bool)

_Sets a value amount of tokens as the allowance of spender over the caller's tokens.

Returns a boolean value indicating whether the operation succeeded.

IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729

Emits an {Approval} event._

_spendAllowance

function _spendAllowance(address owner, address spender, uint256 amount) internal

if the current allowance is max uint256, it will not be decreased

On this page