-
Notifications
You must be signed in to change notification settings - Fork 113
get_contract function makes me confused #83
Comments
No , its a function that is used for mapping |
but if we check the deploy scripts: https://github.com/PatrickAlphaC/smartcontract-lottery/blob/main/scripts/deploy_lottery.py
|
If you see get_contract function else statement its uses config file address and contract name rather than mapping else: |
yes, it uses contract_type again for _name and abi parameters... contract_type._name, contract_address, contract_type.abi |
|
the reason why we can use contract_type.abi here is that , for example, MockV3Aggregator in fact has same abi as AggregatorV3Interface because MockV3Aggregator inherits from AggregatorV2V3Interface, right? Thanks for your time and patience to me, a newbie, thank you ! |
I have read it several times both in lottery and NFT course. Does it mean when we deploy on test or real network, e.g., goerli, we still keep on using the mocks? since we will always excute the mock mapping for Aggregator, vrf_coordinator and linktoken
" contract_type = contract_to_mock[contract_name]"
whenever we start the function, and we also use the "contract_type" variable in our "else" part codes in the function
"contract = Contract.from_abi(
contract_type._name, contract_address, contract_type.abi
)"
----raw codes from the course----
contract_type = contract_to_mock[contract_name]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
if len(contract_type) <= 0:
deploy_mocks()
contract = contract_type[-1]
else:
contract_address = config["networks"][network.show_active()][contract_name]
# address
# ABI
contract = Contract.from_abi(
contract_type._name, contract_address, contract_type.abi
)
# MockV3Aggregator.abi
The text was updated successfully, but these errors were encountered: