Closed
Description
What was wrong?
Documentation encourages using ConciseContract
and ImplicitContract
as a ContractFactoryClass
. They are not proper subclasses of Contract
, which causes confusion when the API changes (like deploy()
is no longer available)
How can it be fixed?
- Remove references to using these classes as a factory in the documentation
- Show preferred implementation instead
- Show using methods on the core contract before wrapping up in these convenience classes
- Add a deprecation warning when using
ConciseContract
orImplicitContract
as a factory.
Preferred implementation of ConciseContract
, with example core contract methods:
TokenContract = w3.eth.contract(abi=...)
deploy_hash = TokenContract.deploy()
# wait for deployment transaction to be mined
while True:
receipt = w3.eth.getTransactionReceipt(deploy_hash)
if receipt:
break
time.sleep(1)
token_contract = TokenContract(receipt['contractAddress'])
token = ConciseContract(token_contract)
# return my balance
token.balanceOf(MY_ADDR)
# returns my balance with the core contract (exactly equivalent to previous line)
token_contract.functions.balanceOf(MY_ADDR).call()
Metadata
Metadata
Assignees
Labels
No labels