pull/867/head
Josselin 3 years ago
parent 34a4ae1c2e
commit bc9fda1fe4
  1. 18
      slither/tools/erc_conformance/erc/erc1155.py
  2. 24
      slither/utils/erc.py

@ -5,12 +5,21 @@ from slither.utils import output
logger = logging.getLogger("Slither-conformance") logger = logging.getLogger("Slither-conformance")
def events_safeBatchTransferFrom(contract, ret): def events_safeBatchTransferFrom(contract, ret):
function = contract.get_function_from_signature("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)") function = contract.get_function_from_signature(
"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)"
)
events = [ events = [
{"name": "TransferSingle", "parameters": ["address", "address", "address", "uint256", "uint256"]}, {
{"name": "TransferBatch", "parameters": ["address", "address", "address", "uint256[]", "uint256[]"]} "name": "TransferSingle",
] "parameters": ["address", "address", "address", "uint256", "uint256"],
},
{
"name": "TransferBatch",
"parameters": ["address", "address", "address", "uint256[]", "uint256[]"],
},
]
event_counter_name = 0 event_counter_name = 0
event_counter_parameters = 0 event_counter_parameters = 0
@ -34,6 +43,7 @@ def events_safeBatchTransferFrom(contract, ret):
erroneous_erc1155_safeBatchTransferFrom_event.data erroneous_erc1155_safeBatchTransferFrom_event.data
) )
def check_erc1155(contract, ret, explored=None): def check_erc1155(contract, ret, explored=None):
if explored is None: if explored is None:
explored = set() explored = set()

@ -273,19 +273,21 @@ ERC1155_EVENTS = [
] ]
ERC1155 = [ ERC1155 = [
ERC("safeTransferFrom", ERC(
"safeTransferFrom",
["address", "address", "uint256", "uint256", "bytes"], ["address", "address", "uint256", "uint256", "bytes"],
"", "",
False, False,
True, True,
[ERC1155_transfersingle_event] [ERC1155_transfersingle_event],
), ),
ERC("safeBatchTransferFrom", ERC(
"safeBatchTransferFrom",
["address", "address", "uint256[]", "uint256[]", "bytes"], ["address", "address", "uint256[]", "uint256[]", "bytes"],
"", "",
False, False,
True, True,
[] [],
), ),
ERC("balanceOf", ["address", "uint256"], "uint256", True, True, []), ERC("balanceOf", ["address", "uint256"], "uint256", True, True, []),
ERC("balanceOfBatch", ["address[]", "uint256[]"], "uint256[]", True, True, []), ERC("balanceOfBatch", ["address[]", "uint256[]"], "uint256[]", True, True, []),
@ -294,25 +296,25 @@ ERC1155 = [
] + ERC165 ] + ERC165
ERC1155_TOKEN_RECEIVER = [ ERC1155_TOKEN_RECEIVER = [
ERC("onERC1155Received", ERC(
"onERC1155Received",
["address", "address", "uint256", "uint256", "bytes"], ["address", "address", "uint256", "uint256", "bytes"],
"bytes4", "bytes4",
False, False,
False, False,
[] [],
), ),
ERC("onERC1155BatchReceived", ERC(
"onERC1155BatchReceived",
["address", "address", "uint256[]", "uint256[]", "bytes"], ["address", "address", "uint256[]", "uint256[]", "bytes"],
"bytes4", "bytes4",
False, False,
False, False,
[] [],
), ),
] ]
ERC1155_METADATA = [ ERC1155_METADATA = [ERC("uri", ["uint256"], "string", True, False, [])]
ERC("uri", ["uint256"], "string", True, False, [])
]
ERC1155 = ERC1155 + ERC1155_TOKEN_RECEIVER + ERC1155_METADATA ERC1155 = ERC1155 + ERC1155_TOKEN_RECEIVER + ERC1155_METADATA

Loading…
Cancel
Save