WIKI_DESCRIPTION='Incorrect return values for ERC20 functions. A contract compiled with solidity > 0.4.22 interacting with these functions will fail to execute them, as the return value is missing.'
WIKI_DESCRIPTION='Incorrect return values for `ERC20` functions. A contract compiled with Solidity > 0.4.22 interacting with these functions will fail to execute them, as the return value is missing.'
WIKI_EXPLOIT_SCENARIO='''
WIKI_EXPLOIT_SCENARIO='''
```solidity
```solidity
contractToken{
contractToken{
@ -26,9 +26,9 @@ contract Token{
//...
//...
}
}
```
```
`Token.transfer`doesnotreturnaboolean.Bobdeploysthetoken.AlicecreatesacontractthatinteractswithitbutassumesacorrectERC20interfaceimplementation.Alice's contract is unable to interact with Bob'scontract.'''
`Token.transfer`doesnotreturnaboolean.Bobdeploysthetoken.Alicecreatesacontractthatinteractswithitbutassumesacorrect`ERC20`interfaceimplementation.Alice's contract is unable to interact with Bob'scontract.'''
WIKI_RECOMMENDATION='Set the appropriate return values and value-types for the defined ERC20 functions.'
WIKI_RECOMMENDATION='Set the appropriate return values and types for the defined `ERC20` functions.'
WIKI_DESCRIPTION='Incorrect return values for ERC721 functions. A contract compiled with solidity > 0.4.22 interacting with these functions will fail to execute them, as the return value is missing.'
WIKI_DESCRIPTION='Incorrect return values for `ERC721` functions. A contract compiled with solidity > 0.4.22 interacting with these functions will fail to execute them, as the return value is missing.'
WIKI_EXPLOIT_SCENARIO='''
WIKI_EXPLOIT_SCENARIO='''
```solidity
```solidity
contractToken{
contractToken{
@ -25,9 +25,9 @@ contract Token{
//...
//...
}
}
```
```
`Token.ownerOf`doesnotreturnanaddressasERC721expects.Bobdeploysthetoken.AlicecreatesacontractthatinteractswithitbutassumesacorrectERC721interfaceimplementation.Alice's contract is unable to interact with Bob'scontract.'''
`Token.ownerOf`doesnotreturnanaddresslike`ERC721`expects.Bobdeploysthetoken.Alicecreatesacontractthatinteractswithitbutassumesacorrect`ERC721`interfaceimplementation.Alice's contract is unable to interact with Bob'scontract.'''
WIKI_RECOMMENDATION='Set the appropriate return values and value-types for the defined ERC721 functions.'
WIKI_RECOMMENDATION='Set the appropriate return values and vtypes for the defined `ERC721` functions.'
WIKI_DESCRIPTION='Detects that events defined by the ERC20 specification which are meant to have some parameters as `indexed`, are missing the `indexed` keyword.'
WIKI_DESCRIPTION='Detects whether events defined by the `ERC20` specification that should have some parameters as `indexed` are missing the `indexed` keyword.'
WIKI_EXPLOIT_SCENARIO='''
WIKI_EXPLOIT_SCENARIO='''
```solidity
```solidity
contractERC20Bad{
contractERC20Bad{
@ -28,9 +28,10 @@ contract ERC20Bad {
//...
//...
}
}
```
```
Inthiscase,TransferandApprovaleventsshouldhavethe'indexed'keywordontheirtwofirstparameters,asdefinedbytheERC20specification.Failuretoincludethesekeywordswillnotincludetheparameterdatainthetransaction/block's bloom filter. This may cause external tooling searching for these parameters to overlook them, and fail to index logs from this token contract.'''
Failuretoincludethesekeywordswillexcludetheparameterdatainthetransaction/block's bloom filter, so external tooling searching for these parameters may overlook them and fail to index logs from this token contract.'''
WIKI_RECOMMENDATION='Add the `indexed` keyword to event parameters which should include it, according to the ERC20 specification.'
WIKI_RECOMMENDATION='Add the `indexed` keyword to event parameters that should include it, according to the `ERC20` specification.'
WIKI_DESCRIPTION='The use of low-level calls is error-prone. Low-level calls do not check for [code existence](https://solidity.readthedocs.io/en/v0.4.25/control-structures.html#error-handling-assert-require-revert-and-exceptions) or call success.'
WIKI_DESCRIPTION='The use of low-level calls is error-prone. Low-level calls do not check for [code existence](https://solidity.readthedocs.io/en/v0.4.25/control-structures.html#error-handling-assert-require-revert-and-exceptions) or call success.'
WIKI_RECOMMENDATION='Avoid low-level calls. Check the call success. If the call is meant for a contract, check for code existence.'
WIKI_RECOMMENDATION='Avoid low-level calls. Check the call success. If the call is meant for a contract, check for code existence.'
@ -38,7 +38,7 @@ Only report reentrancy that acts as a double call (see `reentrancy-eth`, `reentr
`callme`containsareentrancy.Thereentrancyisbenignbecauseit's exploitation would have the same effect as two consecutive calls.'''
`callme`containsareentrancy.Thereentrancyisbenignbecauseit's exploitation would have the same effect as two consecutive calls.'''
WIKI_RECOMMENDATION='Apply the [check-effects-interactions pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Apply the [`check-effects-interactions` pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Apply the [check-effects-interactions pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Apply the [`check-effects-interactions pattern`](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Apply the [check-effects-interactions pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Apply the [`check-effects-interactions` pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Apply the [check-effects-interactions pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Apply the [`check-effects-interactions` pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
@ -38,7 +38,7 @@ Do not report reentrancies that involve ethers (see `reentrancy-eth`)'''
}
}
```
```
'''
'''
WIKI_RECOMMENDATION='Apply the [check-effects-interactions pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Apply the [`check-effects-interactions` pattern](http://solidity.readthedocs.io/en/v0.4.21/security-considerations.html#re-entrancy).'
WIKI_RECOMMENDATION='Rename the local variable/state variable/function/modifier/event, so as not to mistakenly overshadow any built-in symbol definitions.'
WIKI_RECOMMENDATION='Rename the local variables, state variables, functions, modifiers, and events that shadow a builtin symbol.'
WIKI_RECOMMENDATION='Favor [pull over push](https://github.com/ethereum/wiki/wiki/Safety#favor-pull-over-push-for-external-calls) strategy for external calls.'
WIKI_RECOMMENDATION='Favor [pull over push](https://github.com/ethereum/wiki/wiki/Safety#favor-pull-over-push-for-external-calls) strategy for external calls.'
@ -58,7 +58,7 @@ class DivideBeforeMultiply(AbstractDetector):
WIKI_TITLE='Divide before multiply'
WIKI_TITLE='Divide before multiply'
WIKI_DESCRIPTION='''Solidity only supports integers, so division will often truncate; performing a multiply before a divison can sometimes avoid loss of precision.'''
WIKI_DESCRIPTION='''Solidity only supports integers, so division will often truncate; performing a multiply before a divison can sometimes avoid loss of precision.'''
WIKI_DESCRIPTION='''Solidity integer division might truncate. As a result, performing a multiply before a divison might lead to loss of precision.'''
WIKI_DESCRIPTION='''Solidity integer division might truncate. As a result, performing multiplication before divison might reduce precision.'''
Ingeneral,it's usually a good idea to re-arrange arithmetic to perform multiply before divide, unless the limit of a smaller type makes this dangerous.'''
Ingeneral,it's usually a good idea to re-arrange arithmetic to perform multiplication before division, unless the limit of a smaller type makes this dangerous.'''