seaport.py
seaport.py copied to clipboard
Ens token id is too long to generate order hash
ENS token id:https://etherscan.io/token/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85?a=108861993803383587718287980759679847201418463157940019272373961662837649489180
class OfferItem(BaseModelWithEnumValues):
itemType: ItemType
token: str
identifierOrCriteria: int
startAmount: int
endAmount: int
class ConsiderationItem(BaseModelWithEnumValues):
itemType: ItemType
token: str
identifierOrCriteria: int
startAmount: int
endAmount: int
recipient: str
OfferItem and ConsiderationItem identifier type is int, cannot be compatible with BigNumber
When generate order hash, it raise an exception
lambda item: Web3.solidityKeccak(
abi_types=["bytes"],
values=[
"0x"
+ "".join(
[
offer_item_type_hash[2:],
str(item.itemType.value).zfill(64),
item.token[2:].zfill(64),
hex(item.identifierOrCriteria)[2:].zfill(64),
hex(item.startAmount)[2:].zfill(64),
hex(item.endAmount)[2:].zfill(64),
]
)
],
).hex()[2:]