Return a proxy to interact with a token.
(self, token_address: TokenAddress, block_identifier: BlockIdentifier)
| 109 | self._one_to_n_creation_lock = Semaphore() |
| 110 | |
| 111 | def token(self, token_address: TokenAddress, block_identifier: BlockIdentifier) -> Token: |
| 112 | """Return a proxy to interact with a token.""" |
| 113 | if not is_binary_address(token_address): |
| 114 | raise ValueError("token_address must be a valid address") |
| 115 | |
| 116 | with self._token_creation_lock: |
| 117 | if token_address not in self.address_to_token: |
| 118 | self.address_to_token[token_address] = Token( |
| 119 | jsonrpc_client=self.client, |
| 120 | token_address=token_address, |
| 121 | contract_manager=self.contract_manager, |
| 122 | block_identifier=block_identifier, |
| 123 | ) |
| 124 | |
| 125 | return self.address_to_token[token_address] |
| 126 | |
| 127 | def custom_token( |
| 128 | self, token_address: TokenAddress, block_identifier: BlockIdentifier |