Add testnets, minor constructor improvements#467
Conversation
Greptile SummaryThis PR adds two testnet networks (
Confidence Score: 3/5Not ready to merge — the empty-string position descriptor addresses on testnet will silently leave the instance partially initialised, and the broader swallow-and-continue pattern exposes every method that touches those contracts to opaque AttributeErrors at runtime. The constructor refactor is well-intentioned but leaves the object in an undefined state when a contract address is missing or empty; callers get no indication of this during construction and see confusing AttributeErrors later. This is directly triggered by the empty-string entries added in the same PR for position_descriptor on Sepolia and Unichain Sepolia. Both files need attention: uniswap/constants.py for the empty position_descriptor addresses and mixed-case hex strings, and uniswap/uniswap4.py for the silent partial-initialisation pattern in the constructor. Important Files ChangedSequence DiagramsequenceDiagram
participant Caller
participant Uniswap4.__init__
participant constants.py
participant _str_to_addr
participant _load_contract
Caller->>Uniswap4.__init__: new Uniswap4(address, key, ...)
Uniswap4.__init__->>constants.py: lookup address maps by net_name
constants.py-->>Uniswap4.__init__: returns address strings (may be "")
loop for each contract
Uniswap4.__init__->>_str_to_addr: _str_to_addr(address_string)
alt address valid
_str_to_addr-->>Uniswap4.__init__: Address bytes
Uniswap4.__init__->>_load_contract: load ABI + attach to Web3
_load_contract-->>Uniswap4.__init__: Contract object
Uniswap4.__init__->>Uniswap4.__init__: "self.X = contract"
else address is empty or invalid
_str_to_addr-->>Uniswap4.__init__: raises NameNotFound
Uniswap4.__init__->>Uniswap4.__init__: logger.error — self.X never set
end
end
Uniswap4.__init__-->>Caller: returns without error
Caller->>Uniswap4.__init__: self.position_descriptor.functions.tokenURI(...)
Uniswap4.__init__-->>Caller: AttributeError: no attribute 'position_descriptor'
Reviews (1): Last reviewed commit: "Add testnets, minor constructor improvem..." | Re-trigger Greptile |

No description provided.