openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

Fix wording inconsistency between amount and value

Open baermathias opened this issue 3 years ago • 2 comments

Why are we talking about value in the Interface, but passing amount when invoking the event? And why is the argument named value at all? The value of the same amount could be different, depending on the personal view of it couldn't it?

I am looking at version 4.5.0 right now:

Inside the interface https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol#L75 we use value as an argument name for Transfer and Approval event:

event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);

Inside the contract https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol#L243 we pass amount when invoking the event. Also we use the naming amount in all other functions. This is confusing and inside events should be changed to amount or tokenAmount.

baermathias avatar Feb 12 '22 08:02 baermathias

Hello @baermathias

The amount keyword was introduced by this commit in may 2019. It also changed some wording such as from and to

We recently re-introduced the for and to wording, following the ERC20 specifications.

The events somehow follow the specifications in using in using value (the specification uses _value).

The function parameters could be changed to match this naming. AFAIK, this has no impact on the way the contract can be used/overridden (let us know if that has consequences to you) ... but feel free to create a PR proposing that change.

Amxx avatar Feb 13 '22 14:02 Amxx

Note: one of the reasons for using "amount" of token is possibly because value often refers to Eth, and we wanted to avoid confusion.

Amxx avatar Feb 13 '22 14:02 Amxx