approve() (required)

This function is called by the token owner to delegate control of a certain balance to a particular account. This can be called multiple times for different delegate accounts:

function approve(address _spender, uint256 _value)
public
returns (bool success)
{
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}

Note that there is no check to confirm that the approving account, associated with msg.sender, has a large enough balance to cover the amount being delegated. This is only the approval step of the delegation—the actual transfer step occurs later. It is assumed that the token owner's balance could change before the eventual transfer event, so any checks are deferred until then.

The standard requires that the function returns true, even though there are no parts of the function that can fail. An Approval event, explained next, must also be emitted.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset